Skip to content

Commit 41f12a7

Browse files
committed
Added type hints to pixelbuf
1 parent e273b9a commit 41f12a7

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

shared-bindings/_pixelbuf/PixelBuf.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
152152
}
153153
}
154154

155-
//| bpp: Any = ...
155+
//| bpp: int = ...
156156
//| """The number of bytes per pixel in the buffer (read-only)"""
157157
//|
158158
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) {
@@ -168,7 +168,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_bpp_obj = {
168168
};
169169

170170

171-
//| brightness: Any = ...
171+
//| brightness: float = ...
172172
//| """Float value between 0 and 1. Output brightness.
173173
//|
174174
//| When brightness is less than 1.0, a second buffer will be used to store the color values
@@ -199,7 +199,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_brightness_obj = {
199199
(mp_obj_t)&mp_const_none_obj},
200200
};
201201

202-
//| auto_write: Any = ...
202+
//| auto_write: bool = ...
203203
//| """Whether to automatically write the pixels after each update."""
204204
//|
205205
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) {
@@ -221,7 +221,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_auto_write_obj = {
221221
(mp_obj_t)&mp_const_none_obj},
222222
};
223223

224-
//| byteorder: Any = ...
224+
//| byteorder: string = ...
225225
//| """byteorder string for the buffer (read-only)"""
226226
//|
227227
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
@@ -245,7 +245,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
245245
}
246246
}
247247

248-
//| def show(self) -> Any:
248+
//| def show(self) -> None:
249249
//| """Transmits the color data to the pixels so that they are shown. This is done automatically
250250
//| when `auto_write` is True."""
251251
//| ...
@@ -257,9 +257,9 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) {
257257
}
258258
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
259259

260-
//| def fill(color: Any) -> Any:
261-
//| """Fills the given pixelbuf with the given color."""
262-
//| ...
260+
//| def fill(color: tuple[int, int, int]) -> None:
261+
//| """Fills the given pixelbuf with the given color."""
262+
//| ...
263263
//|
264264

265265
STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
@@ -269,13 +269,13 @@ STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
269269
}
270270
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill);
271271

272-
//| def __getitem__(self, index: Any) -> Any:
272+
//| def __getitem__(self, index: int) -> Tuple[int, int, int, Union[int, float]]:
273273
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
274274
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
275275
//| intensity from 0-1.0."""
276276
//| ...
277277
//|
278-
//| def __setitem__(self, index: Any, value: Any) -> Any:
278+
//| def __setitem__(self, index: int, value: Union[int, Tuple[int, int, int, Union[int, float]]]) -> PixelBuf:
279279
//| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are
280280
//| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the
281281
//| red, green and blue values are packed into the lower three bytes (0xRRGGBB).

0 commit comments

Comments
 (0)