Skip to content

Commit ba82d87

Browse files
committed
doc: update docstrings
1 parent 3c2961b commit ba82d87

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

src/arduino/app_peripherals/camera/base_camera.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,20 @@ class BaseCamera(ABC):
2424
"""
2525

2626
def __init__(self, resolution: Optional[Tuple[int, int]] = (640, 480), fps: int = 10,
27-
adjuster: Optional[Callable[[np.ndarray], np.ndarray]] = None, **kwargs):
27+
adjustments: Optional[Callable[[np.ndarray], np.ndarray]] = None, **kwargs):
2828
"""
2929
Initialize the camera base.
3030
3131
Args:
3232
resolution (tuple, optional): Resolution as (width, height). None uses default resolution.
3333
fps (int): Frames per second for the camera.
34-
adjuster (callable, optional): Function pipeline to adjust frames that takes a numpy array and returns a numpy array. Default: None
34+
adjustments (callable, optional): Function or function pipeline to adjust frames that takes
35+
a numpy array and returns a numpy array. Default: None
3536
**kwargs: Additional camera-specific parameters.
3637
"""
3738
self.resolution = resolution
3839
self.fps = fps
39-
self.adjuster = adjuster
40+
self.adjustments = adjustments
4041
self._is_started = False
4142
self._cap_lock = threading.Lock()
4243
self._last_capture_time = time.monotonic()
@@ -100,11 +101,11 @@ def _extract_frame(self) -> Optional[np.ndarray]:
100101

101102
self._last_capture_time = time.monotonic()
102103

103-
if self.adjuster is not None:
104+
if self.adjustments is not None:
104105
try:
105-
frame = self.adjuster(frame)
106+
frame = self.adjustments(frame)
106107
except Exception as e:
107-
raise CameraTransformError(f"Frame transformation failed ({self.adjuster}): {e}")
108+
raise CameraTransformError(f"Frame transformation failed ({self.adjustments}): {e}")
108109

109110
return frame
110111

src/arduino/app_peripherals/camera/camera.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __new__(cls, source: Union[str, int] = 0, **kwargs) -> BaseCamera:
3232
resolution (tuple, optional): Frame resolution as (width, height).
3333
Default: None (auto)
3434
fps (int, optional): Target frames per second. Default: 10
35-
adjuster (callable, optional): Function pipeline to adjust frames that takes a
35+
adjustments (callable, optional): Function pipeline to adjust frames that takes a
3636
numpy array and returns a numpy array. Default: None
3737
V4L Camera Parameters:
3838
device_index (int, optional): V4L device index override

src/arduino/app_peripherals/camera/ip_camera.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self, url: str, username: Optional[str] = None,
3434
username: Optional authentication username
3535
password: Optional authentication password
3636
timeout: Connection timeout in seconds
37-
**kwargs: Additional camera parameters
37+
**kwargs: Additional camera parameters propagated to BaseCamera
3838
"""
3939
super().__init__(**kwargs)
4040
self.url = url

src/arduino/app_peripherals/camera/v4l_camera.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, camera: Union[str, int] = 0, **kwargs):
3232
camera: Camera identifier - can be:
3333
- int: Camera index (e.g., 0, 1)
3434
- str: Camera index as string or device path
35-
**kwargs: Additional camera parameters
35+
**kwargs: Additional camera parameters propagated to BaseCamera
3636
"""
3737
super().__init__(**kwargs)
3838
self.camera_id = self._resolve_camera_id(camera)

src/arduino/app_peripherals/camera/websocket_camera.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(self, host: str = "0.0.0.0", port: int = 8080, timeout: int = 10,
4242
port: Port to bind the server to (default: 8080)
4343
timeout: Connection timeout in seconds (default: 10)
4444
frame_format: Expected frame format from clients ("base64", "json", "binary") (default: "base64")
45-
**kwargs: Additional camera parameters
45+
**kwargs: Additional camera parameters propagated to BaseCamera
4646
"""
4747
super().__init__(**kwargs)
4848

src/arduino/app_utils/image/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: Copyright (C) 2025 ARDUINO SA <http://www.arduino.cc>
2+
#
3+
# SPDX-License-Identifier: MPL-2.0
4+
15
from .image import *
26
from .image_editor import ImageEditor
37
from .pipeable import PipeableFunction

0 commit comments

Comments
 (0)