Skip to content

Commit 30ef634

Browse files
committed
Fix spelling and remove ignored flake8 checks
Signed-off-by: Bernát Gábor <[email protected]>
1 parent c7dfa18 commit 30ef634

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

src/filelock/_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self, lock):
1717
def __enter__(self):
1818
return self.lock
1919

20-
def __exit__(self, exc_type, exc_value, traceback):
20+
def __exit__(self, exc_type, exc_value, traceback): # noqa: U100
2121
self.lock.release()
2222

2323

@@ -181,7 +181,7 @@ def __enter__(self):
181181
self.acquire()
182182
return self
183183

184-
def __exit__(self, exc_type, exc_value, traceback):
184+
def __exit__(self, exc_type, exc_value, traceback): # noqa: U100
185185
self.release()
186186

187187
def __del__(self):

src/filelock/_unix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def _acquire(self):
1919
fd = os.open(self._lock_file, open_mode)
2020
try:
2121
fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
22-
except (OSError, IOError):
22+
except (OSError, IOError): # noqa: B014 # IOError is not OSError on python 2
2323
os.close(fd)
2424
else:
2525
self._lock_file_fd = fd

src/filelock/_windows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def _acquire(self):
2020
else:
2121
try:
2222
msvcrt.locking(fd, msvcrt.LK_NBLCK, 1)
23-
except (OSError, IOError):
23+
except (OSError, IOError): # noqa: B014 # IOError is not OSError on python 2
2424
os.close(fd)
2525
else:
2626
self._lock_file_fd = fd

tests/test_filelock.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def run(self):
9494
self.ex = sys.exc_info()
9595

9696
def join(self, timeout=None):
97-
super(ExThread, self).join()
97+
super(ExThread, self).join(timeout=timeout)
9898
if self.ex is not None:
9999
if sys.version_info[0] == 2:
100100
wrapper_ex = self.ex[1]
@@ -114,7 +114,7 @@ def thread_work():
114114
with lock:
115115
assert lock.is_locked
116116

117-
threads = [ExThread(target=thread_work) for i in range(100)]
117+
threads = [ExThread(target=thread_work) for _ in range(100)]
118118
for thread in threads:
119119
thread.start()
120120
for thread in threads:
@@ -129,13 +129,13 @@ def test_threaded_lock_different_lock_obj(lock_type, tmp_path):
129129
# acquired the lock, thread group 2 must not hold their lock.
130130

131131
def thread_work_one():
132-
for i in range(1000):
132+
for _ in range(1000):
133133
with lock_1:
134134
assert lock_1.is_locked
135135
assert not lock_2.is_locked
136136

137137
def thread_work_two():
138-
for i in range(1000):
138+
for _ in range(1000):
139139
with lock_2:
140140
assert not lock_1.is_locked
141141
assert lock_2.is_locked

tox.ini

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,6 @@ commands =
110110
[flake8]
111111
max-complexity = 22
112112
max-line-length = 120
113-
ignore =
114-
N801 # CapWord convention
115-
N806 # variable should be in lowercase
116-
U100 # unused arguments
117-
PT009 # use regular assert
118-
E722 # bare except
119-
B001 # bare except
120-
B007 # loop variable not used within body
121-
B014 # redundant exception
122-
E741 # ambiguous variable
123113

124114
[pep8]
125115
max-line-length = 120

0 commit comments

Comments
 (0)