From 3f0564f253bc0102853978dce55e3c882162eb56 Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Tue, 10 Jun 2025 13:57:34 +0100 Subject: [PATCH] Turning on more lint checkers, warning for cameras that ignore resolution setting --- pyproject.toml | 4 ++-- src/openflexure_microscope_server/things/camera/opencv.py | 2 ++ src/openflexure_microscope_server/things/camera/simulation.py | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c422165c..bc44d831 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -111,8 +111,8 @@ select = [ # "RET", # Consistent clear return statments "RSE", # Raise parentheses # "SIM", # Simplifications detected -# "ARG", # unused arguments -# "C90", # McCabe complexity! + "ARG", # unused arguments + "C90", # McCabe complexity! "NPY", # Numpy linting "N", # PEP8 naming # "DOC", # Enforce argument, return, and raise to be mentioned in docstrings there is diff --git a/src/openflexure_microscope_server/things/camera/opencv.py b/src/openflexure_microscope_server/things/camera/opencv.py index 3b313485..abb50252 100644 --- a/src/openflexure_microscope_server/things/camera/opencv.py +++ b/src/openflexure_microscope_server/things/camera/opencv.py @@ -83,6 +83,7 @@ class OpenCVCamera(BaseCamera): It's likely to be highly inefficient - raw and/or uncompressed captures using binary image formats will be added in due course. """ + logging.warning(f"OpenCV camera doen't respect {resolution} setting") ret, frame = self.cap.read() if not ret: raise RuntimeError( @@ -100,6 +101,7 @@ class OpenCVCamera(BaseCamera): This function will produce a JPEG image. """ + logging.warning(f"OpenCV camera doen't respect {resolution} setting") frame = self.capture_array() jpeg = cv2.imencode(".jpg", frame)[1].tobytes() exif_dict = { diff --git a/src/openflexure_microscope_server/things/camera/simulation.py b/src/openflexure_microscope_server/things/camera/simulation.py index ecef1b39..ad0ad1c2 100644 --- a/src/openflexure_microscope_server/things/camera/simulation.py +++ b/src/openflexure_microscope_server/things/camera/simulation.py @@ -189,6 +189,7 @@ class SimulatedCamera(BaseCamera): It's likely to be highly inefficient - raw and/or uncompressed captures using binary image formats will be added in due course. """ + logging.warning(f"Simulation camera doen't respect {resolution} setting") return self.generate_frame() @thing_action @@ -201,6 +202,7 @@ class SimulatedCamera(BaseCamera): This function will produce a JPEG image. """ + logging.warning(f"Simulation camera doen't respect {resolution} setting") frame = self.capture_array() jpeg = cv2.imencode(".jpg", frame)[1].tobytes() exif_dict = {