Get codespell passing and add it as a CI job.

This commit is contained in:
Julian Stirling 2025-07-10 17:57:43 +01:00
parent e33fecaef0
commit 7e6017f648
25 changed files with 113 additions and 85 deletions

View file

@ -1,7 +1,7 @@
"""OpenFlexure Microscope Camera.
This module defines the interface for cameras. Any compatible lt.Thing
should enabe the server to work.
should enable the server to work.
See repository root for licensing information.
"""

View file

@ -86,7 +86,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")
logging.warning(f"OpenCV camera doesn't respect {resolution} setting")
ret, frame = self.cap.read()
if not ret:
raise RuntimeError(
@ -104,7 +104,7 @@ class OpenCVCamera(BaseCamera):
This function will produce a JPEG image.
"""
logging.warning(f"OpenCV camera doen't respect {resolution} setting")
logging.warning(f"OpenCV camera doesn't respect {resolution} setting")
frame = self.capture_array()
jpeg = cv2.imencode(".jpg", frame)[1].tobytes()
exif_dict = {

View file

@ -79,7 +79,7 @@ class SensorMode(BaseModel):
class SensorModeSelector(BaseModel):
"""A Pydantic model holding the two values needed to select a PiCamera Sensor mode.
Theses values are the output size and the bit depth.
These values are the output size and the bit depth.
This is a Pydantic model so that it can be saved to disk.
"""
@ -95,7 +95,7 @@ class LensShading(BaseModel):
(12, 16) in size. The arrays are luminance, red-difference chroma (Cr), and
blue-difference chroma (Cb).
This is a Pydantic modell so that it can be saved to the disk.
This is a Pydantic model so that it can be saved to the disk.
"""
luminance: list[list[float]]
@ -162,7 +162,7 @@ class StreamingPiCamera2(BaseCamera):
This method is run by any Thing when a ThingSetting is saved. However, the
method reads the thing_setting. As reading the thing setting talks to the
camera and calls save_settings if the value is not as expected, this could
cause recursion. Aslo this means that saving one setting causes all others
cause recursion. Also this means that saving one setting causes all others
to be read each time.
"""
try:
@ -197,7 +197,7 @@ class StreamingPiCamera2(BaseCamera):
@lt.thing_setting
def colour_gains(self) -> tuple[float, float]:
"""The red and blue colour gains, must be betwen 0.0 and 32.0."""
"""The red and blue colour gains, must be between 0.0 and 32.0."""
if not self._setting_save_in_progress and self.streaming:
with self._streaming_picamera() as cam:
cam_value = cam.capture_metadata()["ColourGains"]
@ -759,7 +759,7 @@ class StreamingPiCamera2(BaseCamera):
same as the default behaviour, which is to use an adaptive lens shading
table.
This flat table is used to take an image wth no lens shading so that the
This flat table is used to take an image with no lens shading so that the
correct lens shading table can be calibrated.
"""
with self._streaming_picamera(pause_stream=True):

View file

@ -84,7 +84,7 @@ def set_minimum_exposure(camera: Picamera2) -> None:
Note ISO is left at auto, because this is needed for the gains
to be set correctly.
"""
# Disable Automatic exposure and gain algoritm (AeEnable), and set analogue
# Disable Automatic exposure and gain algorithm (AeEnable), and set analogue
# gain and exposure time.
# Setting the shutter speed to 1us will result in it being set
# to the minimum possible, which is ~8us for PiCamera v2
@ -427,7 +427,7 @@ def set_static_lst(
cr: np.ndarray,
cb: np.ndarray,
) -> None:
"""Update the ``rpi.alsc`` section of a camera tuning dict to use a static correcton.
"""Update the ``rpi.alsc`` section of a camera tuning dict to use a static correction.
``tuning`` will be updated in-place to set its shading to static, and disable any
adaptive tweaking by the algorithm.
@ -452,7 +452,7 @@ def set_static_ccm(
float, float, float, float, float, float, float, float, float
],
) -> None:
"""Update the ``rpi.alsc`` section of a camera tuning dict to use a static correcton.
"""Update the ``rpi.alsc`` section of a camera tuning dict to use a static correction.
``tuning`` will be updated in-place to set its shading to static, and disable any
adaptive tweaking by the algorithm.
@ -480,7 +480,7 @@ def set_static_geq(
"""Update the ``rpi.geq`` section of a camera tuning dict.
:param tuning: the raspberry pi tuning file. This will be updated in-place to
set the geq offest to the given value.
set the geq offset to the given value.
:param offset: The desired green equalisation offset. Default 65535. The default is
the maximum allowed value. This means the brightness will always be below the
threshold where averaging is used. This is default as we always need the green

View file

@ -42,7 +42,7 @@ class SimulatedCamera(BaseCamera):
canvas_shape: tuple[int, int, int] = (3000, 4000, 3),
frame_interval: float = 0.1,
):
"""Initalise the simulated with settings for how images are generated.
"""Initialise the simulated with settings for how images are generated.
:param shape: The shape (size) of the generated image.
:param glyph_shape: The size randomly positioned glyphs.
@ -128,7 +128,7 @@ class SimulatedCamera(BaseCamera):
"""Wrap the attach_to_server method so the server instance can be stored.
Direct access to the server instance is needed to get the stage position while
maintianing the same public API as a real camera that doesn't need this access.
maintaining the same public API as a real camera that doesn't need this access.
"""
self._server = server
return super().attach_to_server(server, path, setting_storage_path)
@ -198,7 +198,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")
logging.warning(f"Simulation camera doesn't respect {resolution} setting")
return self.generate_frame()
@lt.thing_action
@ -211,7 +211,7 @@ class SimulatedCamera(BaseCamera):
This function will produce a JPEG image.
"""
logging.warning(f"Simulation camera doen't respect {resolution} setting")
logging.warning(f"Simulation camera doesn't respect {resolution} setting")
frame = self.capture_array()
jpeg = cv2.imencode(".jpg", frame)[1].tobytes()
exif_dict = {