ENH: minor formatting, no functional changes

pull/1002/head
Yaroslav Halchenko 2015-03-23 21:26:17 -04:00
parent 4a83741397
commit 9339293413
2 changed files with 6 additions and 4 deletions

View File

@ -47,7 +47,8 @@ if sys.version_info >= (3,):
return x
def _json_loads_safe(x):
try:
x = json.loads(x.decode(locale.getpreferredencoding(), 'replace'))
x = json.loads(x.decode(
locale.getpreferredencoding(), 'replace'))
except Exception, e: # pragma: no cover
logSys.error('json loads failed: %s', e)
x = {}
@ -72,7 +73,8 @@ else:
return x
def _json_loads_safe(x):
try:
x = _normalize(json.loads(x.decode(locale.getpreferredencoding(), 'replace')))
x = _normalize(json.loads(x.decode(
locale.getpreferredencoding(), 'replace')))
except Exception, e: # pragma: no cover
logSys.error('json loads failed: %s', e)
x = {}
@ -406,7 +408,7 @@ class Fail2BanDb(object):
"INSERT INTO bans(jail, ip, timeofban, data) VALUES(?, ?, ?, ?)",
(jail.name, ticket.getIP(), int(round(ticket.getTime())),
{"matches": ticket.getMatches(),
"failures": ticket.getAttempt()}))
"failures": ticket.getAttempt()}))
@commitandrollback
def delBan(self, cur, jail, ticket):

View File

@ -55,7 +55,7 @@ class Ticket:
def __eq__(self, other):
try:
return self.__ip == other.__ip and \
round(self.__time,2) == round(other.__time,2) and \
round(self.__time, 2) == round(other.__time, 2) and \
self.__attempt == other.__attempt and \
self.__matches == other.__matches
except AttributeError: