Fix PEP8 E301 expected 1 blank line, found 0

pull/1094/head
Lee Clemens 2015-07-04 13:23:08 -04:00
parent e9e00d7599
commit 60c5c6951c
6 changed files with 9 additions and 0 deletions

View File

@ -46,6 +46,7 @@ if sys.version_info >= (3,):
logSys.error('json dumps failed: %s', e)
x = '{}'
return x
def _json_loads_safe(x):
try:
x = json.loads(x.decode(
@ -64,6 +65,7 @@ else:
return x.encode(locale.getpreferredencoding())
else:
return x
def _json_dumps_safe(x):
try:
x = json.dumps(_normalize(x), ensure_ascii=False).decode(
@ -72,6 +74,7 @@ else:
logSys.error('json dumps failed: %s', e)
x = '{}'
return x
def _json_loads_safe(x):
try:
x = _normalize(json.loads(x.decode(
@ -156,6 +159,7 @@ class Fail2BanDb(object):
"CREATE INDEX bans_jail_ip ON bans(jail, ip);" \
"CREATE INDEX bans_ip ON bans(ip);" \
def __init__(self, filename, purgeAge=24*60*60):
try:
self._lock = RLock()

View File

@ -57,6 +57,7 @@ class Regex:
except sre_constants.error:
raise RegexException("Unable to compile regular expression '%s'" %
regex)
def __str__(self):
return "%s(%r)" % (self.__class__.__name__, self._regex)
##

View File

@ -59,6 +59,7 @@ class JailThread(Thread):
# excepthook workaround for threads, derived from:
# http://bugs.python.org/issue1230540#msg91244
run = self.run
def run_with_except_hook(*args, **kwargs):
try:
run(*args, **kwargs)

View File

@ -475,6 +475,7 @@ def get_monitor_failures_testcase(Filter_):
class MonitorFailures(unittest.TestCase):
count = 0
def setUp(self):
"""Call before every test case."""
setUpMyTime()

View File

@ -50,6 +50,7 @@ TEST_FILES_DIR = os.path.join(os.path.dirname(__file__), "files")
class TestServer(Server):
def setLogLevel(self, *args, **kwargs):
pass
def setLogTarget(self, *args, **kwargs):
pass

View File

@ -86,6 +86,7 @@ def gatherTests(regexps=None, no_network=False):
else: # pragma: no cover
class FilteredTestSuite(unittest.TestSuite):
_regexps = [re.compile(r) for r in regexps]
def addTest(self, suite):
suite_str = str(suite)
for r in self._regexps: