Skip to content

Commit

Permalink
Correctly annotate return types as Image.Image class and not the `I…
Browse files Browse the repository at this point in the history
…mage` module

Signed-off-by: Asadullah Shaikh <[email protected]>
  • Loading branch information
pantheraleo-7 authored and davidplowman committed Dec 17, 2024
1 parent 081692e commit 31e381f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions picamera2/picamera2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ def capture_arrays_and_switch_back_(self, preview_config, names):
partial(capture_arrays_and_switch_back_, self, preview_config, names)]
return self.dispatch_functions(functions, wait, signal_function, immediate=True)

def capture_image_(self, name: str) -> Image:
def capture_image_(self, name: str) -> Image.Image:
"""Capture image
:param name: Stream name
Expand All @@ -1679,7 +1679,7 @@ def capture_image_(self, name: str) -> Image:
request.release()
return (True, result)

def capture_image(self, name: str = "main", wait: bool = None, signal_function=None) -> Image:
def capture_image(self, name: str = "main", wait: bool = None, signal_function=None) -> Image.Image:
"""Make a PIL image from the next frame in the named stream.
:param name: Stream name, defaults to "main"
Expand All @@ -1689,19 +1689,19 @@ def capture_image(self, name: str = "main", wait: bool = None, signal_function=N
:param signal_function: Callback, defaults to None
:type signal_function: function, optional
:return: PIL Image
:rtype: Image
:rtype: Image.Image
"""
return self.dispatch_functions([partial(self.capture_image_, name)], wait, signal_function)

def switch_mode_and_capture_image(self, camera_config, name: str = "main", wait: bool = None,
signal_function=None, delay=0) -> Image:
signal_function=None, delay=0) -> Image.Image:
"""Switch the camera into a new (capture) mode, capture the image.
Then return back to the initial camera mode.
"""
preview_config = self.camera_config

def capture_image_and_switch_back_(self, preview_config, name) -> Image:
def capture_image_and_switch_back_(self, preview_config, name) -> Image.Image:
done, result = self.capture_image_(name)
if not done:
return (False, None)
Expand Down

0 comments on commit 31e381f

Please sign in to comment.