Skip to content

Commit e0817fb

Browse files
committed
[lint] Add strict=True to all zip() calls
1 parent f4c6577 commit e0817fb

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

docs/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,4 +393,4 @@ This version of DVR-Scan includes a new, faster background subtraction algorithm
393393

394394
* [general] Minimum Python version is now 3.10 ([EOL](https://devguide.python.org/versions/))
395395
* [bugfix] Fix `quiet-mode` setting (`-q`/`--quiet` flag) still allowing extraneous output
396-
* [bugfix] Fix loading config from file in UI
396+
* [bugfix] Fix loading config from file in UI ([#252](https://github.com/Breakthrough/DVR-Scan/issues/252))

dvr_scan/overlays.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def draw(self, frame: numpy.ndarray, text: str):
102102
x_offset = max(0, frame.shape[1] - (self._margin + self._border + max_width))
103103
y_offset = self._margin + self._border
104104

105-
for text, size in zip(lines, sizes):
105+
for text, size in zip(lines, sizes, strict=True):
106106
text_pos = (x_offset, y_offset + size[0][1])
107107
cv2.putText(
108108
frame,

dvr_scan/region.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ def __init__(self, value: str):
3636
if not len(values) >= 6:
3737
raise ValueError(f"Regions must have at least 3 points.\n Input: {value}")
3838

39-
self._value = [Point(int(x), int(y)) for x, y in zip(values[0::2], values[1::2])]
39+
self._value = [
40+
Point(int(x), int(y)) for x, y in zip(values[0::2], values[1::2], strict=True)
41+
]
4042

4143
@property
4244
def value(self) -> ty.List[Point]:

dvr_scan/shared/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,5 +283,5 @@ def logging_redirect_tqdm(
283283
] + [tqdm_handler]
284284
yield
285285
finally:
286-
for logger, original_handlers in zip(loggers, original_handlers_list):
286+
for logger, original_handlers in zip(loggers, original_handlers_list, strict=True):
287287
logger.handlers = original_handlers

tests/test_scan_context.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def test_pre_event_shift_with_frame_skip(traffic_camera_video):
164164
assert all(
165165
[
166166
abs(x[0] - y[0]) <= frame_skip
167-
for x, y in zip(event_list, TRAFFIC_CAMERA_EVENTS_TIME_PRE_5)
167+
for x, y in zip(event_list, TRAFFIC_CAMERA_EVENTS_TIME_PRE_5, strict=True)
168168
]
169169
), "Comparison failure when frame_skip = %d" % (frame_skip)
170170

@@ -195,13 +195,16 @@ def test_post_event_shift_with_frame_skip(traffic_camera_video):
195195
assert all(
196196
[
197197
abs(x[1] - y[1]) <= frame_skip
198-
for x, y in zip(event_list, TRAFFIC_CAMERA_EVENTS_TIME_POST_40)
198+
for x, y in zip(event_list, TRAFFIC_CAMERA_EVENTS_TIME_POST_40, strict=True)
199199
]
200200
), "Comparison failure when frame_skip = %d" % (frame_skip)
201201
# The calculated end times must always be >= the ground truth's frame number, otherwise
202202
# we may be discarding frames containing motion due to skipping them.
203203
assert all(
204-
[x[1] >= y[1] for x, y in zip(event_list, TRAFFIC_CAMERA_EVENTS_TIME_POST_40)]
204+
[
205+
x[1] >= y[1]
206+
for x, y in zip(event_list, TRAFFIC_CAMERA_EVENTS_TIME_POST_40, strict=True)
207+
]
205208
), "Comparison failure when frame_skip = %d" % (frame_skip)
206209

207210

0 commit comments

Comments
 (0)