Skip to content

Commit 961fc45

Browse files
committed
fix some typehints
1 parent 8d3dc3b commit 961fc45

6 files changed

Lines changed: 20 additions & 16 deletions

File tree

py5-docs/Reference/api_en/Sketch_convert_cached_image.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ category = image
55
subcategory = loading_displaying
66

77
@@ signatures
8-
convert_cached_image(obj: Any, force_conversion: bool = False, **kwargs: dict[str, Any]) -> Py5Image
8+
convert_cached_image(obj: Any, force_conversion: bool = False, **kwargs: Any) -> Py5Image
99

1010
@@ variables
1111
force_conversion: bool = False - force conversion of object if it is already in the cache
12-
kwargs: dict[str, Any] - keyword arguments for conversion function
12+
kwargs: Any - keyword arguments for conversion function
1313
obj: Any - object to convert into a Py5Image object
1414

1515
@@ description

py5-docs/Reference/api_en/Sketch_convert_cached_shape.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ category = shape
55
subcategory = None
66

77
@@ signatures
8-
convert_cached_shape(obj: Any, force_conversion: bool = False, **kwargs: dict[str, Any]) -> Py5Shape
8+
convert_cached_shape(obj: Any, force_conversion: bool = False, **kwargs: Any) -> Py5Shape
99

1010
@@ variables
1111
force_conversion: bool = False - force conversion of object if it is already in the cache
12-
kwargs: dict[str, Any] - keyword arguments for conversion function
12+
kwargs: Any - keyword arguments for conversion function
1313
obj: Any - object to convert into a Py5Shape object
1414

1515
@@ description

py5-docs/Reference/api_en/Sketch_convert_image.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ category = image
55
subcategory = loading_displaying
66

77
@@ signatures
8-
convert_image(obj: Any, *, dst: Py5Image = None, **kwargs: dict[str, Any]) -> Py5Image
8+
convert_image(obj: Any, *, dst: Py5Image | None = None, **kwargs: Any) -> Py5Image
99

1010
@@ variables
11-
dst: Py5Image = None - existing Py5Image object to put the converted image into
12-
kwargs: dict[str, Any] - keyword arguments for conversion function
11+
dst: Py5Image | None = None - existing Py5Image object to put the converted image into
12+
kwargs: Any - keyword arguments for conversion function
1313
obj: Any - object to convert into a Py5Image object
1414

1515
@@ description

py5-docs/Reference/api_en/Sketch_convert_shape.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ category = shape
55
subcategory = None
66

77
@@ signatures
8-
convert_shape(obj: Any, **kwargs: dict[str, Any]) -> Py5Shape
8+
convert_shape(obj: Any, **kwargs: Any) -> Py5Shape
99

1010
@@ variables
11-
kwargs: dict[str, Any] - keyword arguments for conversion function
11+
kwargs: Any - keyword arguments for conversion function
1212
obj: Any - object to convert into a Py5Shape object
1313

1414
@@ description

py5-docs/Reference/api_en/Sketch_create_image_from_numpy.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ category = image
55
subcategory = loading_displaying
66

77
@@ signatures
8-
create_image_from_numpy(array: npt.NDArray[np.uint8], bands: str = "ARGB", *, dst: Py5Image = None) -> Py5Image
8+
create_image_from_numpy(array: npt.NDArray[np.uint8], bands: str = "ARGB", *, dst: Py5Image | None = None, ) -> Py5Image
99

1010
@@ variables
1111
array: npt.NDArray[np.uint8] - numpy image array
1212
bands: str = "ARGB" - color channels in array
13-
dst: Py5Image = None - existing Py5Image object to put the image data into
13+
dst: Py5Image | None = None - existing Py5Image object to put the image data into
1414

1515
@@ description
1616
Convert a numpy array into a Py5Image object. The numpy array must have 3 dimensions and the array's `dtype` must be `np.uint8`. The size of `array`'s first and second dimensions will be the image's height and width, respectively. The third dimension is for the array's color channels.

py5-resources/py5-module/src/py5/sketch.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,11 @@ def _get_sync_draw(self):
822822
# *** Py5Image methods ***
823823

824824
def create_image_from_numpy(
825-
self, array: npt.NDArray[np.uint8], bands: str = "ARGB", *, dst: Py5Image = None
825+
self,
826+
array: npt.NDArray[np.uint8],
827+
bands: str = "ARGB",
828+
*,
829+
dst: Py5Image | None = None,
826830
) -> Py5Image:
827831
"""$class_Sketch_create_image_from_numpy"""
828832
height, width = array.shape[:2]
@@ -839,7 +843,7 @@ def create_image_from_numpy(
839843
return py5_img
840844

841845
def convert_image(
842-
self, obj: Any, *, dst: Py5Image = None, **kwargs: dict[str, Any]
846+
self, obj: Any, *, dst: Py5Image | None = None, **kwargs: Any
843847
) -> Py5Image:
844848
"""$class_Sketch_convert_image"""
845849
if isinstance(obj, (Py5Image, Py5Graphics)):
@@ -854,7 +858,7 @@ def convert_image(
854858
return result
855859

856860
def convert_cached_image(
857-
self, obj: Any, force_conversion: bool = False, **kwargs: dict[str, Any]
861+
self, obj: Any, force_conversion: bool = False, **kwargs: Any
858862
) -> Py5Image:
859863
"""$class_Sketch_convert_cached_image"""
860864
try:
@@ -881,14 +885,14 @@ def convert_cached_image(
881885

882886
return converted_obj
883887

884-
def convert_shape(self, obj: Any, **kwargs: dict[str, Any]) -> Py5Shape:
888+
def convert_shape(self, obj: Any, **kwargs: Any) -> Py5Shape:
885889
"""$class_Sketch_convert_shape"""
886890
if isinstance(obj, Py5Shape):
887891
return obj
888892
return shape_conversion._convert(self, obj, **kwargs)
889893

890894
def convert_cached_shape(
891-
self, obj: Any, force_conversion: bool = False, **kwargs: dict[str, Any]
895+
self, obj: Any, force_conversion: bool = False, **kwargs: Any
892896
) -> Py5Shape:
893897
"""$class_Sketch_convert_cached_shape"""
894898
try:

0 commit comments

Comments
 (0)