From 1a98e15328dcb8596a3442f6887ee2638044784f Mon Sep 17 00:00:00 2001 From: Lee Clemens Date: Fri, 26 Jun 2015 12:09:10 -0400 Subject: [PATCH 1/3] Fix pep8 E703 statement ends with a semicolon --- fail2ban/tests/databasetestcase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fail2ban/tests/databasetestcase.py b/fail2ban/tests/databasetestcase.py index 9665e322..00539b32 100644 --- a/fail2ban/tests/databasetestcase.py +++ b/fail2ban/tests/databasetestcase.py @@ -305,7 +305,7 @@ class DatabaseTest(LogCaptureTestCase): def testActionWithDB(self): # test action together with database functionality self.testAddJail() # Jail required - self.jail.database = self.db; + self.jail.database = self.db actions = Actions(self.jail) actions.add( "action_checkainfo", From fe5e7a023e734fb5ba47b0e68f76336b4bd7fe14 Mon Sep 17 00:00:00 2001 From: Lee Clemens Date: Fri, 26 Jun 2015 12:11:49 -0400 Subject: [PATCH 2/3] Fix pep8 E701 multiple statements on one line (colon) --- fail2ban/tests/misctestcase.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fail2ban/tests/misctestcase.py b/fail2ban/tests/misctestcase.py index a682b63f..952c0e1c 100644 --- a/fail2ban/tests/misctestcase.py +++ b/fail2ban/tests/misctestcase.py @@ -66,7 +66,8 @@ class SetupTest(unittest.TestCase): " -- cannot locate setup.py") def testSetupInstallRoot(self): - if not self.setup: return # if verbose skip didn't work out + if not self.setup: + return # if verbose skip didn't work out tmp = tempfile.mkdtemp() try: os.system("%s %s install --root=%s >/dev/null" @@ -136,8 +137,10 @@ class TestsUtilsTest(unittest.TestCase): raise ValueError() def deep_function(i): - if i: deep_function(i-1) - else: func_raise() + if i: + deep_function(i-1) + else: + func_raise() try: print deep_function(3) From 31b34950f7944206f7a2ca2303b66550854ee1a4 Mon Sep 17 00:00:00 2001 From: Lee Clemens Date: Fri, 26 Jun 2015 12:14:11 -0400 Subject: [PATCH 3/3] Fix pep8 E712 comparison to False should be 'if cond is False:' or 'if not cond:' --- fail2ban/server/actions.py | 2 +- fail2ban/tests/failmanagertestcase.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fail2ban/server/actions.py b/fail2ban/server/actions.py index 95161290..b925ecee 100644 --- a/fail2ban/server/actions.py +++ b/fail2ban/server/actions.py @@ -295,7 +295,7 @@ class Actions(JailThread, Mapping): True if an IP address get banned. """ ticket = self._jail.getFailTicket() - if ticket != False: + if ticket: aInfo = CallingMap() bTicket = BanManager.createBanTicket(ticket) ip = bTicket.getIP() diff --git a/fail2ban/tests/failmanagertestcase.py b/fail2ban/tests/failmanagertestcase.py index 1f99d161..659a323d 100644 --- a/fail2ban/tests/failmanagertestcase.py +++ b/fail2ban/tests/failmanagertestcase.py @@ -100,7 +100,7 @@ class AddFailure(unittest.TestCase): self.assertEqual( ticket_repr, 'FailTicket: ip=193.168.0.128 time=1167605999.0 #attempts=5 matches=[]') - self.assertFalse(ticket == False) + self.assertFalse(not ticket) # and some get/set-ers otherwise not tested ticket.setTime(1000002000.0) self.assertEqual(ticket.getTime(), 1000002000.0)