Skip to content

Commit f5bc38f

Browse files
committed
Fixed mypy error, and updated docs to match
1 parent adef83c commit f5bc38f

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

buildconfig/stubs/pygame/camera.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from abc import ABC, abstractmethod
2-
from typing import List, Optional, Tuple, Union
2+
from typing import List, Optional, Tuple, Union, Literal
33

44
from ._common import IntCoordinate
55

@@ -9,6 +9,9 @@ def get_backends() -> List[str]: ...
99
def init(backend: Optional[str] = None) -> None: ...
1010
def quit() -> None: ...
1111
def list_cameras() -> List[str]: ...
12+
def colorspace(
13+
surface: Surface, color: Literal["YUV", "HSV"], dest_surface: Surface = ..., /
14+
) -> Surface: ...
1215

1316
class AbstractCamera(ABC):
1417
@abstractmethod

docs/reST/ref/camera.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ The Bayer to ``RGB`` function is based on:
8989
The other big difference is "camera enumeration." Some backends don't have
9090
a way to list out camera names, or even the number of cameras on the
9191
system. In these cases, :func:`list_cameras()` will return
92-
something like ``[0]``. If you know you have multiple cameras on the
93-
system, these backend ports will pass through a "camera index number"
92+
something like ``[0]``. If you know you have multiple cameras on the
93+
system, these backend ports will pass through a "camera index number"
9494
through if you use that as the ``device`` parameter.
9595

9696
.. versionaddedold:: 2.0.3
@@ -100,7 +100,7 @@ The Bayer to ``RGB`` function is based on:
100100
.. function:: colorspace
101101

102102
| :sl:`Surface colorspace conversion`
103-
| :sg:`colorspace(Surface, format, DestSurface = None, /) -> Surface`
103+
| :sg:`colorspace(surface, format, dest_surface = None, /) -> Surface`
104104
105105
Allows for conversion from "RGB" to a destination colorspace of "HSV" or
106106
"YUV". The source and destination surfaces must be the same size and pixel
@@ -132,7 +132,7 @@ The Bayer to ``RGB`` function is based on:
132132
133133
Loads a camera. On Linux, the device is typically something like
134134
"/dev/video0". Default width and height are 640 by 480.
135-
Format is the desired colorspace of the output.
135+
Format is the desired colorspace of the output.
136136
This is useful for computer vision purposes. The default is
137137
``RGB``. The following are supported:
138138

@@ -214,7 +214,7 @@ The Bayer to ``RGB`` function is based on:
214214
frame when called with a blocking function like :func:`get_image()`.
215215
On Windows (MSMF), and the OpenCV backends, :func:`query_image()`
216216
should be reliable, though. This is useful to separate the framerate of
217-
the game from that of the camera without having to use threading.
217+
the game from that of the camera without having to use threading.
218218

219219
.. ## Camera.query_image ##
220220

src_c/doc/camera_doc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define DOC_CAMERA "pygame module for camera use"
33
#define DOC_CAMERA_INIT "init(backend = None) -> None\nModule init"
44
#define DOC_CAMERA_GETBACKENDS "get_backends() -> [str]\nGet the backends supported on this system"
5-
#define DOC_CAMERA_COLORSPACE "colorspace(Surface, format, DestSurface = None, /) -> Surface\nSurface colorspace conversion"
5+
#define DOC_CAMERA_COLORSPACE "colorspace(surface, format, dest_surface = None, /) -> Surface\nSurface colorspace conversion"
66
#define DOC_CAMERA_LISTCAMERAS "list_cameras() -> [cameras]\nreturns a list of available cameras"
77
#define DOC_CAMERA_CAMERA "Camera(device, (width, height), format) -> Camera\nload a camera"
88
#define DOC_CAMERA_CAMERA_START "start() -> None\nopens, initializes, and starts capturing"

0 commit comments

Comments
 (0)