mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
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:
parent
71625af8a4
commit
56a483475b
4 changed files with 9 additions and 9 deletions
|
|
@ -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
|
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:
|
while True:
|
||||||
m = exp.search(s, pos)
|
m = exp.search(s, pos)
|
||||||
if not m:
|
if not m:
|
||||||
if pos < l or hardsep:
|
if pos < length or hardsep:
|
||||||
# ^ mimic "split()": ''.split() returns []
|
# ^ mimic "split()": ''.split() returns []
|
||||||
yield s[pos:]
|
yield s[pos:]
|
||||||
break
|
break
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import pytz
|
||||||
try:
|
try:
|
||||||
import tzlocal
|
import tzlocal
|
||||||
_DEFAULT_TIMEZONE = tzlocal.get_localzone().zone
|
_DEFAULT_TIMEZONE = tzlocal.get_localzone().zone
|
||||||
except:
|
except ImportError:
|
||||||
_DEFAULT_TIMEZONE = 'Europe/Paris'
|
_DEFAULT_TIMEZONE = 'Europe/Paris'
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
@ -114,7 +114,7 @@ def get_template(name, as_encoding='utf-8'):
|
||||||
|
|
||||||
|
|
||||||
@decoding_strings
|
@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:
|
if answer == str_compat:
|
||||||
r = ''
|
r = ''
|
||||||
while True:
|
while True:
|
||||||
|
|
@ -132,8 +132,8 @@ def ask(question, answer=str_compat, default=None, l=None):
|
||||||
else:
|
else:
|
||||||
print('You must enter something')
|
print('You must enter something')
|
||||||
else:
|
else:
|
||||||
if l and len(r) != l:
|
if length and len(r) != length:
|
||||||
print('You must enter a {0} letters long string'.format(l))
|
print('Entry must be {0} characters long'.format(length))
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
@ -180,7 +180,7 @@ def ask(question, answer=str_compat, default=None, l=None):
|
||||||
try:
|
try:
|
||||||
r = int(r)
|
r = int(r)
|
||||||
break
|
break
|
||||||
except:
|
except ValueError:
|
||||||
print('You must enter an integer')
|
print('You must enter an integer')
|
||||||
return r
|
return r
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ def err(msg, die=None):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pelican
|
import pelican
|
||||||
except:
|
except ImportError:
|
||||||
err('Cannot import pelican.\nYou must '
|
err('Cannot import pelican.\nYou must '
|
||||||
'install Pelican in order to run this script.',
|
'install Pelican in order to run this script.',
|
||||||
-1)
|
-1)
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
import sys
|
||||||
from io import open
|
from io import open
|
||||||
from os import walk
|
from os import walk
|
||||||
from os.path import join, relpath
|
from os.path import join, relpath
|
||||||
import sys
|
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue