Skip to content

Commit

Permalink
Merge pull request #5760 from jepler/rename_under_typing
Browse files Browse the repository at this point in the history
circuitpython_stubs: Use `circuitpython_typing` for cp-specific typing
  • Loading branch information
tannewt authored Dec 22, 2021
2 parents bea0526 + 828b7d8 commit 674c845
Show file tree
Hide file tree
Showing 37 changed files with 59 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: "3.9"
python: "3"

submodules:
include:
Expand All @@ -22,4 +22,4 @@ formats:

python:
install:
- requirements: docs/requirements.txt
- requirements: requirements-doc.txt
8 changes: 0 additions & 8 deletions docs/requirements.txt

This file was deleted.

8 changes: 4 additions & 4 deletions ports/raspberrypi/bindings/rp2pio/StateMachine.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_stop_obj, rp2pio_statemachine_stop
//| def write(self, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None) -> None:
//| """Write the data contained in ``buffer`` to the state machine. If the buffer is empty, nothing happens.
//|
//| :param ~_typing.ReadableBuffer buffer: Write out the data in this buffer
//| :param ~circuitpython_typing.ReadableBuffer buffer: Write out the data in this buffer
//| :param int start: Start of the slice of ``buffer`` to write out: ``buffer[start:end]``
//| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``"""
//| ...
Expand Down Expand Up @@ -402,7 +402,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_write_obj, 2, rp2pio_statemachine
//| """Read into ``buffer``. If the number of bytes to read is 0, nothing happens. The buffer
//| include any data added to the fifo even if it was added before this was called.
//|
//| :param ~_typing.WriteableBuffer buffer: Read data into this buffer
//| :param ~circuitpython_typing.WriteableBuffer buffer: Read data into this buffer
//| :param int start: Start of the slice of ``buffer`` to read into: ``buffer[start:end]``
//| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)``"""
//| ...
Expand Down Expand Up @@ -450,8 +450,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemach
//| may be different. The function will return once both are filled.
//| If buffer slice lengths are both 0, nothing happens.
//|
//| :param ~_typing.ReadableBuffer buffer_out: Write out the data in this buffer
//| :param ~_typing.WriteableBuffer buffer_in: Read data into this buffer
//| :param ~circuitpython_typing.ReadableBuffer buffer_out: Write out the data in this buffer
//| :param ~circuitpython_typing.WriteableBuffer buffer_in: Read data into this buffer
//| :param int out_start: Start of the slice of buffer_out to write out: ``buffer_out[out_start:out_end]``
//| :param int out_end: End of the slice; this index is not included. Defaults to ``len(buffer_out)``
//| :param int in_start: Start of the slice of ``buffer_in`` to read into: ``buffer_in[in_start:in_end]``
Expand Down
2 changes: 1 addition & 1 deletion requirements-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ astroid
setuptools

# For sphinx
Sphinx<4
sphinx>=4.0.0
sphinx-autoapi
sphinx-rtd-theme
sphinxcontrib-svg2pdfconverter
Expand Down
6 changes: 3 additions & 3 deletions shared-bindings/_bleio/Adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ const mp_obj_property_t bleio_adapter_name_obj = {
//| .. note:: If you set ``anonymous=True``, then a timeout must be specified. If no timeout is
//| specified, then the maximum allowed timeout will be selected automatically.
//|
//| :param ~_typing.ReadableBuffer data: advertising data packet bytes
//| :param ~_typing.ReadableBuffer scan_response: scan response data packet bytes. ``None`` if no scan response is needed.
//| :param ~circuitpython_typing.ReadableBuffer data: advertising data packet bytes
//| :param ~circuitpython_typing.ReadableBuffer scan_response: scan response data packet bytes. ``None`` if no scan response is needed.
//| :param bool connectable: If `True` then other devices are allowed to connect to this peripheral.
//| :param bool anonymous: If `True` then this device's MAC address is randomized before advertising.
//| :param int timeout: If set, we will only advertise for this many seconds. Zero means no timeout.
Expand Down Expand Up @@ -282,7 +282,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapt
//| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are
//| filtered and returned separately.
//|
//| :param ~_typing.ReadableBuffer prefixes: Sequence of byte string prefixes to filter advertising packets
//| :param ~circuitpython_typing.ReadableBuffer prefixes: Sequence of byte string prefixes to filter advertising packets
//| with. A packet without an advertising structure that matches one of the prefixes is
//| ignored. Format is one byte for length (n) and n bytes of prefix and can be repeated.
//| :param int buffer_size: the maximum number of advertising bytes to buffer.
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/_bleio/Address.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
//| """Create a new Address object encapsulating the address value.
//| The value itself can be one of:
//|
//| :param ~_typing.ReadableBuffer address: The address value to encapsulate. A buffer object (bytearray, bytes) of 6 bytes.
//| :param ~circuitpython_typing.ReadableBuffer address: The address value to encapsulate. A buffer object (bytearray, bytes) of 6 bytes.
//| :param int address_type: one of the integer values: `PUBLIC`, `RANDOM_STATIC`,
//| `RANDOM_PRIVATE_RESOLVABLE`, or `RANDOM_PRIVATE_NON_RESOLVABLE`."""
//| ...
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/_bleio/Characteristic.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
//| number of data bytes that fit in a single BLE 4.x ATT packet.
//| :param bool fixed_length: True if the characteristic value is of fixed length.
//| :param ~_typing.ReadableBuffer initial_value: The initial value for this characteristic. If not given, will be
//| :param ~circuitpython_typing.ReadableBuffer initial_value: The initial value for this characteristic. If not given, will be
//| filled with zeros.
//| :param str user_description: User friendly description of the characteristic
//|
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/_bleio/Descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
//| number of data bytes that fit in a single BLE 4.x ATT packet.
//| :param bool fixed_length: True if the descriptor value is of fixed length.
//| :param ~_typing.ReadableBuffer initial_value: The initial value for this descriptor.
//| :param ~circuitpython_typing.ReadableBuffer initial_value: The initial value for this descriptor.
//|
//| :return: the new Descriptor."""
//| ...
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/_bleio/UUID.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
//| temporary 16-bit UUID that can be used in place of the full 128-bit UUID.
//|
//| :param value: The uuid value to encapsulate
//| :type value: int, ~_typing.ReadableBuffer or str"""
//| :type value: int, ~circuitpython_typing.ReadableBuffer or str"""
//| ...
//|
STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/_eve/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush);
//| def cc(self, b: ReadableBuffer) -> None:
//| """Append bytes to the command FIFO.
//|
//| :param ~_typing.ReadableBuffer b: The bytes to add"""
//| :param ~circuitpython_typing.ReadableBuffer b: The bytes to add"""
//| ...
//|
STATIC mp_obj_t _cc(mp_obj_t self, mp_obj_t b) {
Expand Down
6 changes: 3 additions & 3 deletions shared-bindings/_stage/Layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
//|
//| :param int width: The width of the grid in tiles, or 1 for sprites.
//| :param int height: The height of the grid in tiles, or 1 for sprites.
//| :param ~_typing.ReadableBuffer graphic: The graphic data of the tiles.
//| :param ~_typing.ReadableBuffer palette: The color palette to be used.
//| :param ~_typing.ReadableBuffer grid: The contents of the grid map.
//| :param ~circuitpython_typing.ReadableBuffer graphic: The graphic data of the tiles.
//| :param ~circuitpython_typing.ReadableBuffer palette: The color palette to be used.
//| :param ~circuitpython_typing.ReadableBuffer grid: The contents of the grid map.
//|
//| This class is intended for internal use in the ``stage`` library and
//| it shouldn't be used on its own."""
Expand Down
6 changes: 3 additions & 3 deletions shared-bindings/_stage/Text.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
//|
//| :param int width: The width of the grid in tiles, or 1 for sprites.
//| :param int height: The height of the grid in tiles, or 1 for sprites.
//| :param ~_typing.ReadableBuffer font: The font data of the characters.
//| :param ~_typing.ReadableBuffer palette: The color palette to be used.
//| :param ~_typing.ReadableBuffer chars: The contents of the character grid.
//| :param ~circuitpython_typing.ReadableBuffer font: The font data of the characters.
//| :param ~circuitpython_typing.ReadableBuffer palette: The color palette to be used.
//| :param ~circuitpython_typing.ReadableBuffer chars: The contents of the character grid.
//|
//| This class is intended for internal use in the ``stage`` library and
//| it shouldn't be used on its own."""
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/_stage/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
//| :param int y1: Bottom edge of the fragment.
//| :param layers: A list of the :py:class:`~_stage.Layer` objects.
//| :type layers: list[Layer]
//| :param ~_typing.WriteableBuffer buffer: A buffer to use for rendering.
//| :param ~circuitpython_typing.WriteableBuffer buffer: A buffer to use for rendering.
//| :param ~displayio.Display display: The display to use.
//| :param int scale: How many times should the image be scaled up.
//| :param int background: What color to display when nothing is there.
Expand Down
4 changes: 2 additions & 2 deletions shared-bindings/adafruit_pixelbuf/PixelBuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
//| :param str byteorder: Byte order string (such as "RGB", "RGBW" or "PBGR")
//| :param float brightness: Brightness (0 to 1.0, default 1.0)
//| :param bool auto_write: Whether to automatically write pixels (Default False)
//| :param ~_typing.ReadableBuffer header: Sequence of bytes to always send before pixel values.
//| :param ~_typing.ReadableBuffer trailer: Sequence of bytes to always send after pixel values."""
//| :param ~circuitpython_typing.ReadableBuffer header: Sequence of bytes to always send before pixel values.
//| :param ~circuitpython_typing.ReadableBuffer trailer: Sequence of bytes to always send after pixel values."""
//| ...
//|
STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
Expand Down
4 changes: 2 additions & 2 deletions shared-bindings/aesio/aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
//| def __init__(self, key: ReadableBuffer, mode: int = 0, iv: Optional[ReadableBuffer] = None, segment_size: int = 8) -> None:
//| """Create a new AES state with the given key.
//|
//| :param ~_typing.ReadableBuffer key: A 16-, 24-, or 32-byte key
//| :param ~circuitpython_typing.ReadableBuffer key: A 16-, 24-, or 32-byte key
//| :param int mode: AES mode to use. One of: `MODE_ECB`, `MODE_CBC`, or
//| `MODE_CTR`
//| :param ~_typing.ReadableBuffer iv: Initialization vector to use for CBC or CTR mode
//| :param ~circuitpython_typing.ReadableBuffer iv: Initialization vector to use for CBC or CTR mode
//|
//| Additional arguments are supported for legacy reasons.
//|
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/audiobusio/I2SOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *ar
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, audiobusio_i2sout_obj___exit__);


//| def play(self, sample: _typing.AudioSample, *, loop: bool = False) -> None:
//| def play(self, sample: circuitpython_typing.AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/audiocore/RawSample.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
//| first sample will be for channel 1, the second sample will be for channel two, the third for
//| channel 1 and so on.
//|
//| :param ~_typing.ReadableBuffer buffer: A buffer with samples
//| :param ~circuitpython_typing.ReadableBuffer buffer: A buffer with samples
//| :param int channel_count: The number of channels in the buffer
//| :param int sample_rate: The desired playback sample rate
//|
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/audiocore/WaveFile.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
//| """Load a .wav file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
//|
//| :param typing.BinaryIO file: Already opened wave file
//| :param ~_typing.WriteableBuffer buffer: Optional pre-allocated buffer,
//| :param ~circuitpython_typing.WriteableBuffer buffer: Optional pre-allocated buffer,
//| that will be split in half and used for double-buffering of the data.
//| The buffer must be 8 to 1024 bytes long.
//| If not provided, two 256 byte buffers are initially allocated internally.
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/audioio/AudioOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ STATIC mp_obj_t audioio_audioout_obj___exit__(size_t n_args, const mp_obj_t *arg
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_audioout___exit___obj, 4, 4, audioio_audioout_obj___exit__);


//| def play(self, sample: _typing.AudioSample, *, loop: bool = False) -> None:
//| def play(self, sample: circuitpython_typing.AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/audiomixer/Mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const mp_obj_property_t audiomixer_mixer_voice_obj = {
MP_ROM_NONE},
};

//| def play(self, sample: _typing.AudioSample, *, voice: int = 0, loop: bool = False) -> None:
//| def play(self, sample: circuitpython_typing.AudioSample, *, voice: int = 0, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/audiomixer/MixerVoice.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t
return MP_OBJ_FROM_PTR(self);
}

//| def play(self, sample: _typing.AudioSample, *, loop: bool = False) -> None:
//| def play(self, sample: circuitpython_typing.AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when ``loop=False``, and continuously when ``loop=True``.
//| Does not block. Use `playing` to block.
//|
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/audiomp3/MP3Decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
//| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
//|
//| :param typing.BinaryIO file: Already opened mp3 file
//| :param ~_typing.WriteableBuffer buffer: Optional pre-allocated buffer, that will be split in half and used for double-buffering of the data. If not provided, two buffers are allocated internally. The specific buffer size required depends on the mp3 file.
//| :param ~circuitpython_typing.WriteableBuffer buffer: Optional pre-allocated buffer, that will be split in half and used for double-buffering of the data. If not provided, two buffers are allocated internally. The specific buffer size required depends on the mp3 file.
//|
//|
//| Playing a mp3 file from flash::
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/audiopwmio/PWMAudioOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj___exit__(size_t n_args, const mp_obj_
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiopwmio_pwmaudioout___exit___obj, 4, 4, audiopwmio_pwmaudioout_obj___exit__);


//| def play(self, sample: _typing.AudioSample, *, loop: bool = False) -> None:
//| def play(self, sample: circuitpython_typing.AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
Expand Down
4 changes: 2 additions & 2 deletions shared-bindings/bitbangio/I2C.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_wr
//| The number of bytes read will be the length of ``out_buffer[in_start:in_end]``.

//| :param int address: 7-bit device address
//| :param ~_typing.ReadableBuffer out_buffer: buffer containing the bytes to write
//| :param ~_typing.WriteableBuffer in_buffer: buffer to write into
//| :param ~circuitpython_typing.ReadableBuffer out_buffer: buffer containing the bytes to write
//| :param ~circuitpython_typing.WriteableBuffer in_buffer: buffer to write into
//| :param int out_start: beginning of ``out_buffer`` slice
//| :param int out_end: end of ``out_buffer`` slice; if not specified, use ``len(out_buffer)``
//| :param int in_start: beginning of ``in_buffer`` slice
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/bitmaptools/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom
// requires at least 2 arguments (destination bitmap and source bitmap)

//|
//| def alphablend(dest_bitmap, source_bitmap_1, source_bitmap_2, colorspace: displayio.Colorspace, factor1: float=.5, factor2: float=None):
//| def alphablend(dest_bitmap: displayio.Bitmap , source_bitmap_1: displayio.Bitmap, source_bitmap_2: displayio.Bitmap, colorspace: displayio.Colorspace, factor1: float=.5, factor2: float=None) -> None:
//| """Alpha blend the two source bitmaps into the destination.
//|
//| It is permitted for the destination bitmap to be one of the two
Expand Down
4 changes: 2 additions & 2 deletions shared-bindings/busio/I2C.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto);
//| The number of bytes read will be the length of ``out_buffer[in_start:in_end]``.

//| :param int address: 7-bit device address
//| :param ~_typing.ReadableBuffer out_buffer: buffer containing the bytes to write
//| :param ~_typing.WriteableBuffer in_buffer: buffer to write into
//| :param ~circuitpython_typing.ReadableBuffer out_buffer: buffer containing the bytes to write
//| :param ~circuitpython_typing.WriteableBuffer in_buffer: buffer to write into
//| :param int out_start: beginning of ``out_buffer`` slice
//| :param int out_end: end of ``out_buffer`` slice; if not specified, use ``len(out_buffer)``
//| :param int in_start: beginning of ``in_buffer`` slice
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions shared-bindings/displayio/Display.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
//|
//| :param display_bus: The bus that the display is connected to
//| :type _DisplayBus: FourWire, ParallelBus or I2CDisplay
//| :param ~_typing.ReadableBuffer init_sequence: Byte-packed initialization sequence.
//| :param ~circuitpython_typing.ReadableBuffer init_sequence: Byte-packed initialization sequence.
//| :param int width: Width in pixels
//| :param int height: Height in pixels
//| :param int colstart: The index if the first visible column
Expand Down Expand Up @@ -449,7 +449,7 @@ const mp_obj_property_t displayio_display_bus_obj = {
//| """Extract the pixels from a single row
//|
//| :param int y: The top edge of the area
//| :param ~_typing.WriteableBuffer buffer: The buffer in which to place the pixel data"""
//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data"""
//| ...
//|
STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
Expand Down
4 changes: 2 additions & 2 deletions shared-bindings/displayio/EPaperDisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
//|
//| :param display_bus: The bus that the display is connected to
//| :type _DisplayBus: displayio.FourWire or paralleldisplay.ParallelBus
//| :param ~_typing.ReadableBuffer start_sequence: Byte-packed initialization sequence.
//| :param ~_typing.ReadableBuffer stop_sequence: Byte-packed initialization sequence.
//| :param ~circuitpython_typing.ReadableBuffer start_sequence: Byte-packed initialization sequence.
//| :param ~circuitpython_typing.ReadableBuffer stop_sequence: Byte-packed initialization sequence.
//| :param int width: Width in pixels
//| :param int height: Height in pixels
//| :param int ram_width: RAM width in pixels
Expand Down
Loading

0 comments on commit 674c845

Please sign in to comment.