summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles-Henri de Boysson <ceache@users.noreply.github.com>2022-10-15 00:13:39 -0400
committerCharles-Henri de Boysson <ceache@users.noreply.github.com>2022-10-17 00:46:53 -0400
commitf3b7ff712d1d7b51180265674cb1e939432c7570 (patch)
treedecfa861ff1e5f90b6c0db3024e8864a5e8e0ca8
parenteacbc2e6871b558a75b200c251286e714962f917 (diff)
downloadkazoo-f3b7ff712d1d7b51180265674cb1e939432c7570.tar.gz
chore: bump pyflake, fix new warnings
-rw-r--r--.flake814
-rw-r--r--constraints.txt2
-rw-r--r--kazoo/protocol/connection.py4
-rw-r--r--kazoo/python2atexit.py2
-rw-r--r--kazoo/testing/common.py3
-rw-r--r--kazoo/tests/test_client.py2
-rw-r--r--kazoo/tests/test_lock.py17
-rw-r--r--kazoo/tests/test_paths.py2
-rw-r--r--kazoo/tests/test_watchers.py2
-rw-r--r--kazoo/tests/util.py4
-rw-r--r--setup.cfg11
11 files changed, 32 insertions, 31 deletions
diff --git a/.flake8 b/.flake8
index 20d6db4..ba8a3d6 100644
--- a/.flake8
+++ b/.flake8
@@ -1,2 +1,14 @@
[flake8]
-ignore = BLK100
+builtins = _
+exclude =
+ .git,
+ __pycache__,
+ .venv/,venv/,
+ .tox/,
+ build/,dist/,*egg,
+ docs/conf.py,
+ zookeeper/
+# See black's documentation for E203
+max-line-length = 79
+extend-ignore = BLK100,E203
+
diff --git a/constraints.txt b/constraints.txt
index ce767e3..37996b3 100644
--- a/constraints.txt
+++ b/constraints.txt
@@ -1,7 +1,7 @@
# Consistent testing environment.
black==22.10.0
coverage==6.3.2
-flake8==3.9.2
+flake8==5.0.2
mock==3.0.5
objgraph==3.5.0
pytest==6.2.5
diff --git a/kazoo/protocol/connection.py b/kazoo/protocol/connection.py
index e1bd996..d7d84d1 100644
--- a/kazoo/protocol/connection.py
+++ b/kazoo/protocol/connection.py
@@ -810,13 +810,13 @@ class ConnectionHandler(object):
except puresasl.SASLError as err:
six.reraise(
SASLException,
- SASLException("library error: %s" % err.message),
+ SASLException("library error: %s" % err),
sys.exc_info()[2],
)
except puresasl.SASLProtocolException as err:
six.reraise(
AuthFailedError,
- AuthFailedError("protocol error: %s" % err.message),
+ AuthFailedError("protocol error: %s" % err),
sys.exc_info()[2],
)
except Exception as err:
diff --git a/kazoo/python2atexit.py b/kazoo/python2atexit.py
index 499dc34..fdf78d2 100644
--- a/kazoo/python2atexit.py
+++ b/kazoo/python2atexit.py
@@ -25,7 +25,7 @@ def _run_exitfuncs():
func(*targs, **kargs)
except SystemExit:
exc_info = sys.exc_info()
- except:
+ except: # noqa
import traceback
sys.stderr.write("Error in atexit._run_exitfuncs:\n")
diff --git a/kazoo/testing/common.py b/kazoo/testing/common.py
index 7a12e2f..7918221 100644
--- a/kazoo/testing/common.py
+++ b/kazoo/testing/common.py
@@ -182,7 +182,8 @@ peerType=%s
# DEFAULT: console appender only
log4j.rootLogger=INFO, ROLLINGFILE
log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n
+log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} \
+[myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n
log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.ROLLINGFILE.Threshold=DEBUG
log4j.appender.ROLLINGFILE.File="""
diff --git a/kazoo/tests/test_client.py b/kazoo/tests/test_client.py
index 49aafe7..73876b8 100644
--- a/kazoo/tests/test_client.py
+++ b/kazoo/tests/test_client.py
@@ -37,7 +37,7 @@ if sys.version_info > (3,): # pragma: nocover
else: # pragma: nocover
def u(s):
- return unicode(s, "unicode_escape")
+ return unicode(s, "unicode_escape") # noqa
class TestClientTransitions(KazooTestCase):
diff --git a/kazoo/tests/test_lock.py b/kazoo/tests/test_lock.py
index 8c175f7..2301e9d 100644
--- a/kazoo/tests/test_lock.py
+++ b/kazoo/tests/test_lock.py
@@ -134,20 +134,21 @@ class KazooLockTests(KazooTestCase):
contender_bits = {}
for name in names:
- e = self.make_event()
- l = self.client.Lock(self.lockpath, name)
- t = self.make_thread(
- target=self._thread_lock_acquire_til_event, args=(name, l, e)
+ ev = self.make_event()
+ lock = self.client.Lock(self.lockpath, name)
+ thread = self.make_thread(
+ target=self._thread_lock_acquire_til_event,
+ args=(name, lock, ev),
)
- contender_bits[name] = (t, e)
- threads.append(t)
+ contender_bits[name] = (thread, ev)
+ threads.append(thread)
# acquire the lock ourselves first to make the others line up
lock = self.client.Lock(self.lockpath, "test")
lock.acquire()
- for t in threads:
- t.start()
+ for thread in threads:
+ thread.start()
# wait for everyone to line up on the lock
wait = self.make_wait()
diff --git a/kazoo/tests/test_paths.py b/kazoo/tests/test_paths.py
index 4e42538..2749634 100644
--- a/kazoo/tests/test_paths.py
+++ b/kazoo/tests/test_paths.py
@@ -14,7 +14,7 @@ if sys.version_info > (3,): # pragma: nocover
else: # pragma: nocover
def u(s):
- return unicode(s, "unicode_escape")
+ return unicode(s, "unicode_escape") # noqa
class NormPathTestCase(TestCase):
diff --git a/kazoo/tests/test_watchers.py b/kazoo/tests/test_watchers.py
index 9b0c339..dc36ef6 100644
--- a/kazoo/tests/test_watchers.py
+++ b/kazoo/tests/test_watchers.py
@@ -274,7 +274,7 @@ class KazooDataWatcherTests(KazooTestCase):
b = False
try:
self.client.stop()
- except:
+ except: # noqa
b = True
assert b is False
diff --git a/kazoo/tests/util.py b/kazoo/tests/util.py
index 223fe64..6351468 100644
--- a/kazoo/tests/util.py
+++ b/kazoo/tests/util.py
@@ -133,9 +133,7 @@ class Wait(object):
return
if now() > deadline:
raise self.TimeOutWaitingFor(
- message
- or getattr(func, "__doc__")
- or getattr(func, "__name__")
+ message or func.__doc__ or func.__name__
)
diff --git a/setup.cfg b/setup.cfg
index 5380435..9d30c34 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -86,14 +86,3 @@ alldeps =
[tool:pytest]
addopts = -ra -v
-[flake8]
-builtins = _
-exclude =
- .git,
- __pycache__,
- .venv/,venv/,
- .tox/,
- build/,dist/,*egg,
- docs/conf.py,
- zookeeper/
-