Skip to content

Commit

Permalink
chore: bump pyflake, fix new warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ceache committed Oct 17, 2022
1 parent eacbc2e commit f3b7ff7
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 31 deletions.
14 changes: 13 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion constraints.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions kazoo/protocol/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,13 +810,13 @@ def _authenticate_with_sasl(self, host, timeout):
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:
Expand Down
2 changes: 1 addition & 1 deletion kazoo/python2atexit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion kazoo/testing/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ def run(self):
# 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="""
Expand Down
2 changes: 1 addition & 1 deletion kazoo/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def u(s):
else: # pragma: nocover

def u(s):
return unicode(s, "unicode_escape")
return unicode(s, "unicode_escape") # noqa


class TestClientTransitions(KazooTestCase):
Expand Down
17 changes: 9 additions & 8 deletions kazoo/tests/test_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,21 @@ def test_lock(self):
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()
Expand Down
2 changes: 1 addition & 1 deletion kazoo/tests/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def u(s):
else: # pragma: nocover

def u(s):
return unicode(s, "unicode_escape")
return unicode(s, "unicode_escape") # noqa


class NormPathTestCase(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion kazoo/tests/test_watchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def changed(val, stat):
b = False
try:
self.client.stop()
except:
except: # noqa
b = True
assert b is False

Expand Down
4 changes: 1 addition & 3 deletions kazoo/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ def __call__(self, func=None, timeout=None, wait=None, message=None):
return
if now() > deadline:
raise self.TimeOutWaitingFor(
message
or getattr(func, "__doc__")
or getattr(func, "__name__")
message or func.__doc__ or func.__name__
)


Expand Down
11 changes: 0 additions & 11 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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/

0 comments on commit f3b7ff7

Please sign in to comment.