Skip to content

Commit 88c5eef

Browse files
committed
Avoid line-continuation
1 parent 83a35f3 commit 88c5eef

File tree

5 files changed

+340
-324
lines changed

5 files changed

+340
-324
lines changed

src/AutoSplit.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,10 @@ def __check_fps(self):
432432
self.fps_value_label.setText(str(fps))
433433

434434
def __is_current_split_out_of_range(self):
435-
return self.split_image_number < 0 \
435+
return (
436+
self.split_image_number < 0
436437
or self.split_image_number > len(self.split_images_and_loop_number) - 1
438+
)
437439

438440
def undo_split(self, navigate_image_only: bool = False):
439441
"""Undo Split" and "Prev. Img." buttons connect to here."""

src/capture_method/__init__.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,20 @@ async def get_camera_info(index: int, device_name: str):
188188
# backend = video_capture.getBackendName() # STS_ASSERT
189189
# video_capture.grab() # STS_ERROR
190190
# except cv2.error as error:
191-
# return CameraInfo(index, device_name, True, backend) \
192-
# if error.code in (cv2.Error.STS_ERROR, cv2.Error.STS_ASSERT) \
191+
# return (
192+
# CameraInfo(index, device_name, True, backend)
193+
# if error.code in (cv2.Error.STS_ERROR, cv2.Error.STS_ASSERT)
193194
# else None
195+
# )
194196
# finally:
195197
# video_capture.release()
196198

197199
resolution = get_input_device_resolution(index)
198-
return CameraInfo(index, device_name, False, backend, resolution) \
199-
if resolution is not None \
200+
return (
201+
CameraInfo(index, device_name, False, backend, resolution)
202+
if resolution is not None
200203
else None
204+
)
201205

202206
return [
203207
camera_info

src/compare.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ def compare_l2_norm(source: MatLike, capture: MatLike, mask: MatLike | None = No
4444
error = cv2.norm(source, capture, cv2.NORM_L2, mask)
4545

4646
# The L2 Error is summed across all pixels, so this normalizes
47-
max_error = sqrt(source.size) * MAXBYTE \
48-
if not is_valid_image(mask)\
47+
max_error = (
48+
sqrt(source.size) * MAXBYTE
49+
if not is_valid_image(mask)
4950
else sqrt(cv2.countNonZero(mask) * MASK_SIZE_MULTIPLIER)
51+
)
5052

5153
if not max_error:
5254
return 0.0
@@ -69,9 +71,11 @@ def compare_template(source: MatLike, capture: MatLike, mask: MatLike | None = N
6971

7072
# matchTemplate returns the sum of square differences, this is the max
7173
# that the value can be. Used for normalizing from 0 to 1.
72-
max_error = source.size * MAXBYTE * MAXBYTE \
73-
if not is_valid_image(mask) \
74+
max_error = (
75+
source.size * MAXBYTE * MAXBYTE
76+
if not is_valid_image(mask)
7477
else cv2.countNonZero(mask)
78+
)
7579

7680
return 1 - (min_val / max_error)
7781

0 commit comments

Comments
 (0)