Skip to content

Commit 03b937d

Browse files
committed
docs: wrong type hint for the image shape argument
Was specified as Tuple[int, int], can also be Tuple[int, int, int] for color images. Changed to Tuple[int, int] | Tuple[int, int, int]
1 parent be9ce7a commit 03b937d

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/crappy/blocks/camera.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def __init__(self,
6868
save_backend: Optional[str] = None,
6969
image_generator: Optional[Callable[[float, float],
7070
np.ndarray]] = None,
71-
img_shape: Optional[Tuple[int, int]] = None,
71+
img_shape: Optional[Union[Tuple[int, int],
72+
Tuple[int, int, int]]] = None,
7273
img_dtype: Optional[str] = None,
7374
**kwargs) -> None:
7475
"""Sets the arguments and initializes the parent class.

src/crappy/blocks/camera_processes/camera_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def set_shared(self,
8787
lock: RLock,
8888
barrier: Barrier,
8989
event: Event,
90-
shape: Tuple[int, int],
90+
shape: Union[Tuple[int, int], Tuple[int, int, int]],
9191
dtype,
9292
to_draw_conn: Optional[Connection],
9393
outputs: List[Link],

src/crappy/tool/camera_config/camera_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from platform import system
77
import numpy as np
88
from time import time, sleep
9-
from typing import Optional, Tuple
9+
from typing import Optional, Tuple, Union
1010
from pkg_resources import resource_string
1111
from io import BytesIO
1212
import logging
@@ -79,7 +79,7 @@ def __init__(self,
7979

8080
super().__init__()
8181
self._camera = camera
82-
self.shape = None
82+
self.shape: Optional[Union[Tuple[int, int], Tuple[int, int, int]]] = None
8383
self.dtype = None
8484
self._logger: Optional[logging.Logger] = None
8585

0 commit comments

Comments
 (0)