PyCodeStyle fixes to keep Flake8 happy

Travis appears to be using new versions of underlying code style
analyzers, so these changes were necessary in order to keep tests green.
This commit is contained in:
Justin Mayer 2017-10-26 13:53:32 -07:00
commit 56a483475b
4 changed files with 9 additions and 9 deletions

View file

@ -55,11 +55,11 @@ def isplit(s, sep=None):
"""
sep, hardsep = r'\s+' if sep is None else re.escape(sep), sep is not None
exp, pos, l = re.compile(sep), 0, len(s)
exp, pos, length = re.compile(sep), 0, len(s)
while True:
m = exp.search(s, pos)
if not m:
if pos < l or hardsep:
if pos < length or hardsep:
# ^ mimic "split()": ''.split() returns []
yield s[pos:]
break

View file

@ -14,7 +14,7 @@ import pytz
try:
import tzlocal
_DEFAULT_TIMEZONE = tzlocal.get_localzone().zone
except:
except ImportError:
_DEFAULT_TIMEZONE = 'Europe/Paris'
import six
@ -114,7 +114,7 @@ def get_template(name, as_encoding='utf-8'):
@decoding_strings
def ask(question, answer=str_compat, default=None, l=None):
def ask(question, answer=str_compat, default=None, length=None):
if answer == str_compat:
r = ''
while True:
@ -132,8 +132,8 @@ def ask(question, answer=str_compat, default=None, l=None):
else:
print('You must enter something')
else:
if l and len(r) != l:
print('You must enter a {0} letters long string'.format(l))
if length and len(r) != length:
print('Entry must be {0} characters long'.format(length))
else:
break
@ -180,7 +180,7 @@ def ask(question, answer=str_compat, default=None, l=None):
try:
r = int(r)
break
except:
except ValueError:
print('You must enter an integer')
return r
else:

View file

@ -17,7 +17,7 @@ def err(msg, die=None):
try:
import pelican
except:
except ImportError:
err('Cannot import pelican.\nYou must '
'install Pelican in order to run this script.',
-1)

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python
import sys
from io import open
from os import walk
from os.path import join, relpath
import sys
from setuptools import setup