Skip to content

Commit e8515c1

Browse files
authored
Merge pull request #9548 from elpekenin/fix/_bleio-stubs
Typing improvements
2 parents 14c86ef + 4b10b91 commit e8515c1

File tree

15 files changed

+61
-23
lines changed

15 files changed

+61
-23
lines changed

ports/espressif/bindings/espulp/ULP.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "py/objproperty.h"
1414

1515
//| class ULP:
16-
//| def __init__(self, arch: Architecture = Architecture.FSM):
16+
//| def __init__(self, arch: Architecture = Architecture.FSM) -> None:
1717
//| """The ultra-low-power processor.
1818
//|
1919
//| Raises an exception if another ULP has been instantiated. This

shared-bindings/_bleio/CharacteristicBuffer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ static void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
8080
//| :rtype: bytes or None"""
8181
//| ...
8282
//|
83-
//| def readinto(self, buf: WriteableBuffer) -> Optional[int]:
83+
//| def readinto(self, buf: WriteableBuffer, nbytes: Optional[int] = None) -> Optional[int]:
8484
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
8585
//|
86+
//| You may reduce this maximum read using the ``nbytes`` argument.
87+
//|
8688
//| :return: number of bytes read and stored into ``buf``
8789
//| :rtype: int or None (on a non-blocking error)"""
8890
//| ...

shared-bindings/_bleio/ScanEntry.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
2626
//| ...
2727
//|
28-
//| def matches(self, prefixes: ScanEntry, *, match_all: bool = True) -> bool:
28+
//| def matches(self, prefixes: ReadableBuffer, *, match_all: bool = True) -> bool:
2929
//| """Returns True if the ScanEntry matches all prefixes when ``match_all`` is True. This is stricter
3030
//| than the scan filtering which accepts any advertisements that match any of the prefixes
3131
//| where ``match_all`` is False."""

shared-bindings/bitmapfilter/__init__.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//| mul: float | None = None,
2020
//| add: float = 0,
2121
//| mask: displayio.Bitmap | None = None,
22-
//| threshold=False,
22+
//| threshold: bool = False,
2323
//| offset: int = 0,
2424
//| invert: bool = False,
2525
//| ) -> displayio.Bitmap:
@@ -406,7 +406,11 @@ static mp_obj_t bitmapfilter_mix(size_t n_args, const mp_obj_t *pos_args, mp_map
406406
}
407407
MP_DEFINE_CONST_FUN_OBJ_KW(bitmapfilter_mix_obj, 0, bitmapfilter_mix);
408408

409-
//| def solarize(bitmap, threshold: float = 0.5, mask: displayio.Bitmap | None = None):
409+
//| def solarize(
410+
//| bitmap: displayio.Bitmap,
411+
//| threshold: float = 0.5,
412+
//| mask: displayio.Bitmap | None = None,
413+
//| ) -> displayio.Bitmap:
410414
//| """Create a "solarization" effect on an image
411415
//|
412416
//| This filter inverts pixels with brightness values above ``threshold``, while leaving

shared-bindings/codeop/__init__.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ static const char *get_arg_str(mp_obj_t arg, qstr name) {
1616

1717
//| """Utilities to compile possibly incomplete Python source code."""
1818
//|
19+
//| from types import CodeType
20+
//|
1921

20-
//| def compile_command(source: str, filename: str = "<input>", symbol: str = "single"):
22+
//| def compile_command(
23+
//| source: str, filename: str = "<input>", symbol: str = "single"
24+
//| ) -> CodeType:
2125
//| """Compile a command and determine whether it is incomplete
2226
//|
2327
//| The 'completeness' determination is slightly different than in standard Python

shared-bindings/dotclockframebuffer/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//| mosi_bit: int,
3131
//| clk_bit: int,
3232
//| reset_bit: Optional[int],
33-
//| ):
33+
//| ) -> None:
3434
//| """Send a displayio-style initialization sequence over an I2C I/O expander
3535
//|
3636
//| This function is highly generic in order to support various I/O expanders.

shared-bindings/floppyio/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//| buffer: WriteableBuffer,
2424
//| data: digitalio.DigitalInOut,
2525
//| index: digitalio.DigitalInOut,
26-
//| index_wait=0.220,
26+
//| index_wait: float = 0.220,
2727
//| ) -> int:
2828
//| """Read flux transition information into the buffer.
2929
//|

shared-bindings/memorymap/AddressRange.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
//| """
5555
//|
5656

57-
//| def __init__(self, *, start, length) -> None:
57+
//| def __init__(self, *, start: int, length: int) -> None:
5858
//| """Constructs an address range starting at ``start`` and ending at
5959
//| ``start + length``. An exception will be raised if any of the
6060
//| addresses are invalid or protected."""

shared-bindings/rotaryio/IncrementalEncoder.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
//| class IncrementalEncoder:
1818
//| """IncrementalEncoder determines the relative rotational position based on two series of pulses.
19-
//| It assumes that the encoder's common pin(s) are connected to ground,and enables pull-ups on
20-
//| pin_a and pin_b."""
19+
//| It assumes that the encoder's common pin(s) are connected to ground,and enables pull-ups on
20+
//| pin_a and pin_b."""
2121
//|
2222
//| def __init__(
2323
//| self, pin_a: microcontroller.Pin, pin_b: microcontroller.Pin, divisor: int = 4

shared-bindings/synthio/LFO.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ static const uint16_t triangle[] = {0, 32767, 0, -32767};
7474
//| scale: BlockInput = 1.0,
7575
//| offset: BlockInput = 0.0,
7676
//| phase_offset: BlockInput = 0.0,
77-
//| once=False,
78-
//| interpolate=True
79-
//| ):
77+
//| once: bool = False,
78+
//| interpolate: bool = True,
79+
//| ) -> None:
8080
//| pass
8181
static const mp_arg_t lfo_properties[] = {
8282
{ MP_QSTR_waveform, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE } },
@@ -268,7 +268,7 @@ MP_PROPERTY_GETTER(synthio_lfo_value_obj,
268268

269269

270270
//|
271-
//| def retrigger(self):
271+
//| def retrigger(self) -> None:
272272
//| """Reset the LFO's internal index to the start of the waveform. Most useful when it its `once` property is `True`."""
273273
//|
274274
static mp_obj_t synthio_lfo_retrigger(mp_obj_t self_in) {

0 commit comments

Comments
 (0)