Made every init return None

This commit is contained in:
dherrada 2020-07-03 14:23:34 -04:00
parent d358c915c3
commit d0d949cd24
85 changed files with 86 additions and 86 deletions

View File

@ -65,7 +65,7 @@
//| connections and also initiate connections."""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """You cannot create an instance of `_bleio.Adapter`.
//| Use `_bleio.adapter` to access the sole instance available."""
//| ...

View File

@ -38,7 +38,7 @@
//| """Encapsulates the address of a BLE device."""
//|
//| def __init__(self, address: ReadableBuffer, address_type: int):
//| def __init__(self, address: ReadableBuffer, address_type: int) -> None:
//| """Create a new Address object encapsulating the address value.
//| The value itself can be one of:
//|

View File

@ -36,7 +36,7 @@
//| :py:class:`~Characteristic` and :py:class:`~Descriptor`,
//| but is not defined as a Python superclass of those classes."""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """You cannot create an instance of :py:class:`~_bleio.Attribute`."""
//| ...
//|

View File

@ -37,7 +37,7 @@
//| """Stores information about a BLE service characteristic and allows reading
//| and writing of the characteristic's value."""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """There is no regular constructor for a Characteristic. A new local Characteristic can be created
//| and attached to a Service by calling `add_to_service()`.
//| Remote Characteristic objects are created by `Connection.discover_remote_services()`

View File

@ -44,7 +44,7 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self
//| class CharacteristicBuffer:
//| """Accumulates a Characteristic's incoming values in a FIFO buffer."""
//|
//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64):
//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64) -> None:
//|
//| """Monitor the given Characteristic. Each time a new value is written to the Characteristic
//| add the newly-written bytes to a FIFO buffer.

View File

@ -68,7 +68,7 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) {
}
}
//| def __init__(self):
//| def __init__(self) -> None:
//| """Connections cannot be made directly. Instead, to initiate a connection use `Adapter.connect`.
//| Connections may also be made when another device initiates a connection. To use a Connection
//| created by a peer, read the `Adapter.connections` property.

View File

@ -39,7 +39,7 @@
//| Descriptors are attached to BLE characteristics and provide contextual
//| information about the characteristic."""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """There is no regular constructor for a Descriptor. A new local Descriptor can be created
//| and attached to a Characteristic by calling `add_to_characteristic()`.
//| Remote Descriptor objects are created by `Connection.discover_remote_services()`

View File

@ -44,7 +44,7 @@
//| When we're the server, we ignore all connections besides the first to subscribe to
//| notifications."""
//|
//| def __init__(self, characteristic: Characteristic, *, buffer_size: int):
//| def __init__(self, characteristic: Characteristic, *, buffer_size: int) -> None:
//| """Monitor the given Characteristic. Each time a new value is written to the Characteristic
//| add the newly-written bytes to a FIFO buffer.
//|

View File

@ -41,7 +41,7 @@
//| it has no user-visible constructor."""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
//| ...
//|

View File

@ -46,7 +46,7 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) {
return MP_OBJ_STOP_ITERATION;
}
//| def __init__(self):
//| def __init__(self) -> None:
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
//| ...
//|

View File

@ -35,7 +35,7 @@
//| class Service:
//| """Stores information about a BLE service and its characteristics."""
//|
//| def __init__(self, uuid: UUID, *, secondary: bool = False):
//| def __init__(self, uuid: UUID, *, secondary: bool = False) -> None:
//| """Create a new Service identified by the specified UUID. It can be accessed by all
//| connections. This is known as a Service server. Client Service objects are created via
//| `Connection.discover_remote_services`.

View File

@ -36,7 +36,7 @@
//| class UUID:
//| """A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more."""
//|
//| def __init__(self, value: Union[int, ReadableBuffer, str]):
//| def __init__(self, value: Union[int, ReadableBuffer, str]) -> None:
//| """Create a new UUID or UUID object encapsulating the uuid value.
//| The value can be one of:
//|

View File

@ -46,7 +46,7 @@
//| that library."""
//|
//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], cols: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], buttons: DigitalInOut):
//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], cols: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], buttons: DigitalInOut) -> None:
//| """Initializes matrix scanning routines.
//|
//| The ``buffer`` is a 64 byte long ``bytearray`` that stores what should

View File

@ -47,7 +47,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
//| class PixelBuf:
//| """A fast RGB[W] pixel buffer for LED and similar devices."""
//|
//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: bytes = b"", trailer: bytes = b""):
//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: bytes = b"", trailer: bytes = b"") -> None:
//| """Create a PixelBuf object of the specified size, byteorder, and bits per pixel.
//|
//| When brightness is less than 1.0, a second buffer will be used to store the color values

View File

@ -33,7 +33,7 @@
//| class Layer:
//| """Keep information about a single layer of graphics"""
//|
//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray):
//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray) -> None:
//| """Keep internal information about a layer of graphics (either a
//| ``Grid`` or a ``Sprite``) in a format suitable for fast rendering
//| with the ``render()`` function.

View File

@ -33,7 +33,7 @@
//| class Text:
//| """Keep information about a single grid of text"""
//|
//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray):
//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray) -> None:
//| """Keep internal information about a grid of text
//| in a format suitable for fast rendering
//| with the ``render()`` function.

View File

@ -48,7 +48,7 @@
//| val = adc.value"""
//|
//| def __init__(self, pin: microcontroller.Pin):
//| def __init__(self, pin: microcontroller.Pin) -> None:
//| """Use the AnalogIn on the given pin. The reference voltage varies by
//| platform so use ``reference_voltage`` to read the configured setting.
//|

View File

@ -47,7 +47,7 @@
//| dac = analogio.AnalogOut(pin.PA02) # output on pin PA02
//| dac.value = 32768 # makes PA02 1.65V"""
//|
//| def __init__(self, pin: microcontroller.Pin):
//| def __init__(self, pin: microcontroller.Pin) -> None:
//| """Use the AnalogOut on the given pin.
//|
//| :param ~microcontroller.Pin pin: the pin to output to"""

View File

@ -38,7 +38,7 @@
//| class I2SOut:
//| """Output an I2S audio signal"""
//|
//| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool):
//| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool) -> None:
//| """Create a I2SOut object associated with the given pins.
//|
//| :param ~microcontroller.Pin bit_clock: The bit clock (or serial clock) pin

View File

@ -39,7 +39,7 @@
//| class PDMIn:
//| """Record an input PDM audio stream"""
//|
//| def __init__(self, clock_pin: microcontroller.Pin, data_pin: microcontroller.Pin, *, sample_rate: int = 16000, bit_depth: int = 8, mono: bool = True, oversample: int = 64, startup_delay: float = 0.11):
//| def __init__(self, clock_pin: microcontroller.Pin, data_pin: microcontroller.Pin, *, sample_rate: int = 16000, bit_depth: int = 8, mono: bool = True, oversample: int = 64, startup_delay: float = 0.11) -> None:
//| """Create a PDMIn object associated with the given pins. This allows you to
//| record audio signals from the given pins. Individual ports may put further
//| restrictions on the recording parameters. The overall sample rate is

View File

@ -38,7 +38,7 @@
//| class RawSample:
//| """A raw audio sample buffer in memory"""
//|
//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000):
//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000) -> None:
//| """Create a RawSample based on the given buffer of signed values. If channel_count is more than
//| 1 then each channel's samples should alternate. In other words, for a two channel buffer, the
//| first sample will be for channel 1, the second sample will be for channel two, the third for

View File

@ -40,7 +40,7 @@
//| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating
//| an internal buffer."""
//|
//| def __init__(self, file: typing.BinaryIO, buffer: ReadableBuffer):
//| def __init__(self, file: typing.BinaryIO, buffer: ReadableBuffer) -> None:
//| """Load a .wav file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
//|
//| :param typing.BinaryIO file: Already opened wave file

View File

@ -39,7 +39,7 @@
//| class AudioOut:
//| """Output an analog audio signal"""
//|
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000):
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None:
//| """Create a AudioOut object associated with the given pin(s). This allows you to
//| play audio signals out on the given pin(s).
//|

View File

@ -41,7 +41,7 @@
//| class Mixer:
//| """Mixes one or more audio samples together into one sample."""
//|
//| def __init__(self, voice_count: int = 2, buffer_size: int = 1024, channel_count: int = 2, bits_per_sample: int = 16, samples_signed: bool = True, sample_rate: int = 8000):
//| def __init__(self, voice_count: int = 2, buffer_size: int = 1024, channel_count: int = 2, bits_per_sample: int = 16, samples_signed: bool = True, sample_rate: int = 8000) -> None:
//| """Create a Mixer object that can mix multiple channels with the same sample rate.
//| Samples are accessed and controlled with the mixer's `audiomixer.MixerVoice` objects.
//|

View File

@ -42,7 +42,7 @@
//|
//| Used to access and control samples with `audiomixer.Mixer`."""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """MixerVoice instance object(s) created by `audiomixer.Mixer`."""
//| ...
//|

View File

@ -37,7 +37,7 @@
//| class MP3:
//| """Load a mp3 file for audio playback"""
//|
//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer):
//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer) -> None:
//|
//| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
//|

View File

@ -39,7 +39,7 @@
//| class PWMAudioOut:
//| """Output an analog audio signal by varying the PWM duty cycle."""
//|
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000):
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None:
//| """Create a PWMAudioOut object associated with the given pin(s). This allows you to
//| play audio signals out on the given pin(s). In contrast to mod:`audioio`,
//| the pin(s) specified are digital pins, and are driven with a device-dependent PWM

View File

@ -40,7 +40,7 @@
//| class I2C:
//| """Two wire serial protocol"""
//|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int):
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int) -> None:
//| """I2C is a two-wire protocol for communicating between devices. At the
//| physical level it consists of 2 wires: SCL and SDA, the clock and data
//| lines respectively.

View File

@ -42,7 +42,7 @@
//|
//| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126"""
//|
//| def __init__(self, pin: microcontroller.Pin):
//| def __init__(self, pin: microcontroller.Pin) -> None:
//|
//| """Create a OneWire object associated with the given pin. The object
//| implements the lowest level timing-sensitive bits of the protocol.

View File

@ -51,7 +51,7 @@
//| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines
//| and therefore the hardware.)"""
//|
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None):
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None:
//| """Construct an SPI object on the given pins.
//|
//| .. seealso:: Using this class directly requires careful lock management.

View File

@ -39,7 +39,7 @@
//| class I2C:
//| """Two wire serial protocol"""
//|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255):
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255) -> None:
//|
//| """I2C is a two-wire protocol for communicating between devices. At the
//| physical level it consists of 2 wires: SCL and SDA, the clock and data

View File

@ -37,7 +37,7 @@
//| class OneWire:
//| """Lowest-level of the Maxim OneWire protocol"""
//|
//| def __init__(self, pin: microcontroller.Pin):
//| def __init__(self, pin: microcontroller.Pin) -> None:
//| """(formerly Dallas Semi) OneWire protocol.
//|
//| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126

View File

@ -53,7 +53,7 @@
//| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines
//| and therefore the hardware.)"""
//|
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None):
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None:
//|
//| """Construct an SPI object on the given pins.
//|

View File

@ -44,7 +44,7 @@
//| class UART:
//| """A bidirectional serial protocol"""
//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Parity = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64):
//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Parity = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64) -> None:
//| """A common bidirectional serial protocol that uses an an agreed upon speed
//| rather than a shared clock line.
//|

View File

@ -13,7 +13,7 @@
//| """Counter will keep track of the number of falling edge transistions (pulses) on a
//| given pin"""
//|
//| def __init__(self, pin_a: microcontroller.Pin):
//| def __init__(self, pin_a: microcontroller.Pin) -> None:
//| """Create a Counter object associated with the given pin. It tracks the number of
//| falling pulses relative when the object is constructed.
//|

View File

@ -50,7 +50,7 @@
//| a pin, see the :py:class:`analogio.AnalogIn` and
//| :py:class:`analogio.AnalogOut` classes."""
//|
//| def __init__(self, pin: microcontroller.Pin):
//| def __init__(self, pin: microcontroller.Pin) -> None:
//| """Create a new DigitalInOut object associated with the pin. Defaults to input
//| with no pull. Use :py:meth:`switch_to_input` and
//| :py:meth:`switch_to_output` to change the direction.

View File

@ -41,7 +41,7 @@
//| class Direction:
//| """Defines the direction of a digital pin"""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Enum-like class to define which direction the digital values are
//| going."""
//| ...

View File

@ -29,7 +29,7 @@
//| class DriveMode:
//| """Defines the drive mode of a digital pin"""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Enum-like class to define the drive mode used when outputting
//| digital values."""
//| ...

View File

@ -29,7 +29,7 @@
//| class Pull:
//| """Defines the pull of a digital input pin"""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Enum-like class to define the pull value, if any, used while reading
//| digital values in."""
//| ...

View File

@ -39,7 +39,7 @@
//| class Bitmap:
//| """Stores values of a certain size in a 2D array"""
//|
//| def __init__(self, width: int, height: int, value_count: int):
//| def __init__(self, width: int, height: int, value_count: int) -> None:
//| """Create a Bitmap object with the given fixed size. Each pixel stores a value that is used to
//| index into a corresponding palette. This enables differently colored sprites to share the
//| underlying Bitmap. value_count is used to minimize the memory used to store the Bitmap.

View File

@ -39,7 +39,7 @@
//| class ColorConverter:
//| """Converts one color format to another."""
//|
//| def __init__(self, *, dither: bool = False):
//| def __init__(self, *, dither: bool = False) -> None:
//| """Create a ColorConverter object to convert color formats. Only supports RGB888 to RGB565
//| currently.
//| :param bool dither: Adds random noise to dither the output image"""

View File

@ -49,7 +49,7 @@
//| Most people should not use this class directly. Use a specific display driver instead that will
//| contain the initialization sequence at minimum."""
//|
//| def __init__(self, display_bus: displayio, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60):
//| def __init__(self, display_bus: displayio, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60) -> None:
//| r"""Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
//|
//| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a

View File

@ -49,7 +49,7 @@
//| Most people should not use this class directly. Use a specific display driver instead that will
//| contain the startup and shutdown sequences at minimum."""
//|
//| def __init__(self, display_bus: displayio, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False):
//| def __init__(self, display_bus: displayio, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None:
//| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
//|
//| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every

View File

@ -42,7 +42,7 @@
//| """Manage updating a display over SPI four wire protocol in the background while Python code runs.
//| It doesn't handle display initialization."""
//|
//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: microcontroller.Pin = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0):
//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: microcontroller.Pin = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0) -> None:
//| """Create a FourWire object associated with the given pins.
//|
//| The SPI bus and pins are then in use by the display until `displayio.release_displays()` is

View File

@ -38,7 +38,7 @@
//| class Group:
//| """Manage a group of sprites and groups and how they are inter-related."""
//|
//| def __init__(self, *, max_size: int = 4, scale: int = 1, x: int = 0, y: int = 0):
//| def __init__(self, *, max_size: int = 4, scale: int = 1, x: int = 0, y: int = 0) -> None:
//| """Create a Group of a given size and scale. Scale is in one dimension. For example, scale=2
//| leads to a layer's pixel being 2x2 pixels when in the group.
//|

View File

@ -42,7 +42,7 @@
//| """Manage updating a display over I2C in the background while Python code runs.
//| It doesn't handle display initialization."""
//|
//| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: microcontroller.Pin = None):
//| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: microcontroller.Pin = None) -> None:
//| """Create a I2CDisplay object associated with the given I2C bus and reset pin.
//|
//| The I2C bus and pins are then in use by the display until `displayio.release_displays()` is

View File

@ -69,7 +69,7 @@
//| while True:
//| pass"""
//|
//| def __init__(self, file: file):
//| def __init__(self, file: file) -> None:
//| """Create an OnDiskBitmap object with the given file.
//|
//| :param file file: The open bitmap file"""

View File

@ -46,7 +46,7 @@
//| """Map a pixel palette_index to a full color. Colors are transformed to the display's format internally to
//| save memory."""
//|
//| def __init__(self, color_count: int):
//| def __init__(self, color_count: int) -> None:
//| """Create a Palette object to store a set number of colors.
//|
//| :param int color_count: The number of colors in the Palette"""

View File

@ -42,7 +42,7 @@
//| protocol may be refered to as 8080-I Series Parallel Interface in datasheets. It doesn't handle
//| display initialization."""
//|
//| def __init__(self, *, data0: microcontroller.Pin, command: microcontroller.Pin, chip_select: microcontroller.Pin, write: microcontroller.Pin, read: microcontroller.Pin, reset: microcontroller.Pin):
//| def __init__(self, *, data0: microcontroller.Pin, command: microcontroller.Pin, chip_select: microcontroller.Pin, write: microcontroller.Pin, read: microcontroller.Pin, reset: microcontroller.Pin) -> None:
//| """Create a ParallelBus object associated with the given pins. The bus is inferred from data0
//| by implying the next 7 additional pins on a given GPIO port.
//|

View File

@ -37,7 +37,7 @@
//| class Shape:
//| """Represents a shape made by defining boundaries that may be mirrored."""
//|
//| def __init__(self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False):
//| def __init__(self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False) -> None:
//| """Create a Shape object with the given fixed size. Each pixel is one bit and is stored by the
//| column boundaries of the shape on each row. Each row's boundary defaults to the full row.
//|

View File

@ -48,7 +48,7 @@
//|
//| A single tile grid is also known as a Sprite."""
//|
//| def __init__(self, bitmap: displayio.Bitmap, *, pixel_shader: displayio.Palette, width: int = 1, height: int = 1, tile_width: int = None, tile_height: int = None, default_tile: int = 0, x: int = 0, y: int = 0):
//| def __init__(self, bitmap: displayio.Bitmap, *, pixel_shader: displayio.Palette, width: int = 1, height: int = 1, tile_width: int = None, tile_height: int = None, default_tile: int = 0, x: int = 0, y: int = 0) -> None:
//| """Create a TileGrid object. The bitmap is source for 2d pixels. The pixel_shader is used to
//| convert the value and its location to a display native pixel color. This may be a simple color
//| palette lookup, a gradient, a pattern or a color transformer.

View File

@ -39,7 +39,7 @@
//| class BuiltinFont:
//| """A font built into CircuitPython"""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Creation not supported. Available fonts are defined when CircuitPython is built. See the
//| `Adafruit_CircuitPython_Bitmap_Font <https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font>`_
//| library for dynamically loaded fonts."""

View File

@ -47,7 +47,7 @@
//| objects in CircuitPython, Display objects live until `displayio.release_displays()`
//| is called. This is done so that CircuitPython can use the display itself."""
//|
//| def __init__(self, framebuffer: framebuffer, *, rotation: int = 0, auto_refresh: bool = True):
//| def __init__(self, framebuffer: framebuffer, *, rotation: int = 0, auto_refresh: bool = True) -> None:
//| """Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc)
//|
//| :param framebuffer: The framebuffer that the display is connected to

View File

@ -46,7 +46,7 @@
//|
//| FrequencyIn will not determine pulse width (use ``PulseIn``)."""
//|
//| def __init__(self, pin: microcontroller.Pin, capture_period: int = 10):
//| def __init__(self, pin: microcontroller.Pin, capture_period: int = 10) -> None:
//| """Create a FrequencyIn object associated with the given pin.
//|
//| :param ~microcontroller.Pin pin: Pin to read frequency from.

View File

@ -70,7 +70,7 @@
//| time.sleep(0.1)"""
//|
//| def __init__(self, b1: DigitalInOut, b2: DigitalInOut, b3: DigitalInOut, b4: DigitalInOut, b5: DigitalInOut, b6: DigitalInOut, b7: DigitalInOut, b8: DigitalInOut):
//| def __init__(self, b1: DigitalInOut, b2: DigitalInOut, b3: DigitalInOut, b4: DigitalInOut, b5: DigitalInOut, b6: DigitalInOut, b7: DigitalInOut, b8: DigitalInOut) -> None:
//| """Initializes button scanning routines.
//|
//| The ``b1``-``b8`` parameters are ``DigitalInOut`` objects, which

View File

@ -36,7 +36,7 @@
//| class GamePadShift:
//| """Scan buttons for presses through a shift register"""
//|
//| def __init__(self, clock: DigitalInOut, data: DigitalInOut, latch: DigitalInOut):
//| def __init__(self, clock: DigitalInOut, data: DigitalInOut, latch: DigitalInOut) -> None:
//| """Initializes button scanning routines.
//|
//| The ``clock``, ``data`` and ``latch`` parameters are ``DigitalInOut``

View File

@ -53,7 +53,7 @@
//| print("Longitude: {0:.6f} degrees".format(nav.longitude))"""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Turn on the GNSS.
//|
//| :param gnss.SatelliteSystem system: satellite system to use"""

View File

@ -29,7 +29,7 @@
//| class PositionFix:
//| """Position fix mode"""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Enum-like class to define the position fix mode."""
//|
//| INVALID: PositionFix = ...

View File

@ -29,7 +29,7 @@
//| class SatelliteSystem:
//| """Satellite system type"""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Enum-like class to define the satellite system type."""
//|
//| GPS: SatelliteSystem = ...

View File

@ -52,7 +52,7 @@ STATIC mp_obj_t mp_obj_new_i2cperipheral_i2c_peripheral_request(i2cperipheral_i2
//| class I2CPeripheral:
//| """Two wire serial protocol peripheral"""
//|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, addresses: tuple, smbus: bool = False):
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, addresses: tuple, smbus: bool = False) -> None:
//| """I2C is a two-wire protocol for communicating between devices.
//| This implements the peripheral (sensor, secondary) side.
//|
@ -227,7 +227,7 @@ const mp_obj_type_t i2cperipheral_i2c_peripheral_type = {
//| class I2CPeripheralRequest:
//|
//| def __init__(self, peripheral: i2cperipheral.I2CPeripheral, address: int, is_read: bool, is_restart: bool):
//| def __init__(self, peripheral: i2cperipheral.I2CPeripheral, address: int, is_read: bool, is_restart: bool) -> None:
//| """Information about an I2C transfer request
//| This cannot be instantiated directly, but is returned by :py:meth:`I2CPeripheral.request`.
//|

View File

@ -36,7 +36,7 @@
//| class Pin:
//| """Identifies an IO pin on the microcontroller."""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Identifies an IO pin on the microcontroller. They are fixed by the
//| hardware so they cannot be constructed on demand. Instead, use
//| `board` or `microcontroller.pin` to reference the desired pin."""

View File

@ -44,7 +44,7 @@
//| print(microcontroller.cpu.temperature)"""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """You cannot create an instance of `microcontroller.Processor`.
//| Use `microcontroller.cpu` to access the sole instance available."""
//| ...

View File

@ -29,7 +29,7 @@
//| class RunMode:
//| """run state of the microcontroller"""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Enum-like class to define the run mode of the microcontroller and
//| CircuitPython."""
//|

View File

@ -44,7 +44,7 @@
//| microcontroller.nvm[0:3] = b\"\xcc\x10\x00\""""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`."""
//| ...
//|

View File

@ -45,7 +45,7 @@
//| level converters must be used to connect the I/O lines to pins
//| of 3.3V boards."""
//|
//| def __init__(self, data_pin: microcontroller.Pin, clock_pin: microcontroller.Pin):
//| def __init__(self, data_pin: microcontroller.Pin, clock_pin: microcontroller.Pin) -> None:
//| """Create a Ps2 object associated with the given pins.
//|
//| :param ~microcontroller.Pin data_pin: Pin tied to data wire.

View File

@ -38,7 +38,7 @@
//| class PWMOut:
//| """Output a Pulse Width Modulated signal on a given pin."""
//|
//| def __init__(self, pin: microcontroller.Pin, *, duty_cycle: int = 0, frequency: int = 500, variable_frequency: bool = False):
//| def __init__(self, pin: microcontroller.Pin, *, duty_cycle: int = 0, frequency: int = 500, variable_frequency: bool = False) -> None:
//| """Create a PWM object associated with the given pin. This allows you to
//| write PWM signals out on the given pin. Frequency is fixed after init
//| unless ``variable_frequency`` is True.

View File

@ -40,7 +40,7 @@
//| and low cost temperature sensors (DHT). The pulsed signal consists of timed active and
//| idle periods. Unlike PWM, there is no set duration for active and idle pairs."""
//|
//| def __init__(self, pin: microcontroller.Pin, maxlen: int = 2, *, idle_state: bool = False):
//| def __init__(self, pin: microcontroller.Pin, maxlen: int = 2, *, idle_state: bool = False) -> None:
//| """Create a PulseIn object associated with the given pin. The object acts as
//| a read-only sequence of pulse lengths with a given max length. When it is
//| active, new pulse lengths are added to the end of the list. When there is

View File

@ -41,7 +41,7 @@
//| pulsed signal consists of timed on and off periods. Unlike PWM, there is no set duration
//| for on and off pairs."""
//|
//| def __init__(self, carrier: pulseio.PWMOut):
//| def __init__(self, carrier: pulseio.PWMOut) -> None:
//| """Create a PulseOut object associated with the given PWMout object.
//|
//| :param ~pulseio.PWMOut carrier: PWMOut that is set to output on the desired pin.

View File

@ -128,7 +128,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_
}
}
//| def __init__(self, *, width: int, bit_depth: List[digitalio.DigitalInOut], rgb_pins: List[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0):
//| def __init__(self, *, width: int, bit_depth: List[digitalio.DigitalInOut], rgb_pins: List[digitalio.DigitalInOut], addr_pins: List[digitalio.DigitalInOut], clock_pin: digitalio.DigitalInOut, latch_pin: digitalio.DigitalInOut, output_enable_pin: digitalio.DigitalInOut, doublebuffer: bool = True, framebuffer: Optional[WriteableBuffer] = None, height: int = 0) -> None:
//| """Create a RGBMatrix object with the given attributes. The height of
//| the display is determined by the number of rgb and address pins:
//| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4

View File

@ -37,7 +37,7 @@
//| class IncrementalEncoder:
//| """IncrementalEncoder determines the relative rotational position based on two series of pulses."""
//|
//| def __init__(self, pin_a: microcontroller.Pin, pin_b: microcontroller.Pin):
//| def __init__(self, pin_a: microcontroller.Pin, pin_b: microcontroller.Pin) -> None:
//| """Create an IncrementalEncoder object associated with the given pins. It tracks the positional
//| state of an incremental rotary encoder (also known as a quadrature encoder.) Position is
//| relative to the position when the object is contructed.

View File

@ -41,7 +41,7 @@ const rtc_rtc_obj_t rtc_rtc_obj = {{&rtc_rtc_type}};
//| class RTC:
//| """Real Time Clock"""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """This class represents the onboard Real Time Clock. It is a singleton and will always return the same instance."""
//| ...
//|

View File

@ -44,7 +44,7 @@
//| `busio.SPI`, not `bitbangio.SPI`. Usually an SDCard object is used
//| with ``storage.VfsFat`` to allow file I/O to an SD card."""
//|
//| def __init__(bus:busio.SPI, cs: digitalio.DigitalInOut=digitalio.DigitalInOut, baudrate: int=8000000):
//| def __init__(bus:busio.SPI, cs: digitalio.DigitalInOut=digitalio.DigitalInOut, baudrate: int=8000000) -> None:
//| """Construct an SPI SD Card object with the given properties
//|
//| :param busio.SPI spi: The SPI bus

View File

@ -49,7 +49,7 @@
//| 25MHz. Usually an SDCard object is used with ``storage.VfsFat``
//| to allow file I/O to an SD card."""
//|
//| def __init__(*, clock: digitalio.DigitalInOut, command: digitalio.DigitalInOut, data: List[digitalio.DigitalInOut], frequency: int):
//| def __init__(*, clock: digitalio.DigitalInOut, command: digitalio.DigitalInOut, data: List[digitalio.DigitalInOut], frequency: int) -> None:
//| """Construct an SDIO SD Card object with the given properties
//|
//| :param ~microcontroller.Pin clock: the pin to use for the clock.

View File

@ -46,7 +46,7 @@ STATIC const mp_obj_type_t socket_type;
//| class socket:
//|
//| def __init__(self, family: int, type: int, proto: int):
//| def __init__(self, family: int, type: int, proto: int) -> None:
//| """Create a new socket
//|
//| :param ~int family: AF_INET or AF_INET6

View File

@ -168,7 +168,7 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_erase_filesystem), MP_ROM_PTR(&storage_erase_filesystem_obj) },
//| class VfsFat:
//| def __init__(self, block_device: Any):
//| def __init__(self, block_device: Any) -> None:
//| """Create a new VfsFat filesystem around the given block device.
//|
//| :param block_device: Block device the the filesystem lives on"""

View File

@ -40,7 +40,7 @@
//| class Terminal:
//| """Display a character stream with a TileGrid"""
//|
//| def __init__(self, tilegrid: bitmap, font: fontio.BuiltinFont):
//| def __init__(self, tilegrid: bitmap, font: fontio.BuiltinFont) -> None:
//| """Terminal manages tile indices and cursor position based on VT100 commands. The font should be
//| a `fontio.BuiltinFont` and the TileGrid's bitmap should match the font's bitmap."""
//| ...

View File

@ -93,7 +93,7 @@ mp_obj_t struct_time_make_new(const mp_obj_type_t *type, size_t n_args, const mp
}
//| class struct_time:
//| def __init__(self, time_tuple: Any):
//| def __init__(self, time_tuple: Any) -> None:
//| """Structure used to capture a date and time. Note that it takes a tuple!
//|
//| :param tuple time_tuple: Tuple of time info: ``(tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday, tm_yday, tm_isdst)``

View File

@ -52,7 +52,7 @@
//| print("touched!")"""
//|
//| def __init__(self, pin: microcontroller.Pin):
//| def __init__(self, pin: microcontroller.Pin) -> None:
//| """Use the TouchIn on the given pin.
//|
//| :param ~microcontroller.Pin pin: the pin to read from"""

View File

@ -17,7 +17,7 @@ https://docs.scipy.org/doc/numpy/index.html"""
class array:
"""1- and 2- dimensional array"""
def __init__(self, values, *, dtype=float):
def __init__(self, values, *, dtype=float) -> None:
""":param sequence values: Sequence giving the initial content of the array.
:param dtype: The type of array values, ``int8``, ``uint8``, ``int16``, ``uint16``, or ``float``

View File

@ -38,7 +38,7 @@
//| class PortIn:
//| """Receives midi commands over USB"""
//|
//| def __init__(self):
//| def __init__(self) -> None:
//| """You cannot create an instance of `usb_midi.PortIn`.
//|
//| PortIn objects are constructed for every corresponding entry in the USB

View File

@ -11,7 +11,7 @@
//| class Circle:
//|
//| def __init__(self, radius: int):
//| def __init__(self, radius: int) -> None:
//| """Circle is positioned on screen by its center point.
//|
//| :param radius: The radius of the circle in pixels"""

View File

@ -18,7 +18,7 @@
//| from typing import List, Tuple
//|
//| class Polygon:
//| def __init__(self, points: List[ Tuple[ x, y ], ... ] ):
//| def __init__(self, points: List[ Tuple[ x, y ], ... ] ) -> None:
//| """Represents a closed shape by ordered vertices
//|
//| :param points: Vertices for the polygon"""

View File

@ -8,7 +8,7 @@
#include "supervisor/shared/translate.h"
//| class Rectangle:
//| def __init__(self, width: int, height: int):
//| def __init__(self, width: int, height: int) -> None:
//| """Represents a rectangle by defining its bounds
//|
//| :param width: The number of pixels wide

View File

@ -20,7 +20,7 @@
//| class VectorShape:
//| def __init__(self, shape: vectorio.Polygon, pixel_shader: displayio.Palette, x: int=0, y: int=0):
//| def __init__(self, shape: vectorio.Polygon, pixel_shader: displayio.Palette, x: int=0, y: int=0) -> None:
//| """Binds a vector shape to a location and pixel color
//|
//| :param shape: The shape to draw.

View File

@ -49,7 +49,7 @@
//| class WIZNET5K:
//| """Wrapper for Wiznet 5500 Ethernet interface"""
//|
//| def __init__(self, spi: busio.SPI, cs: microcontroller.Pin, rst: microcontroller.Pin, dhcp: bool = True):
//| def __init__(self, spi: busio.SPI, cs: microcontroller.Pin, rst: microcontroller.Pin, dhcp: bool = True) -> None:
//| """Create a new WIZNET5500 interface using the specified pins
//|
//| :param ~busio.SPI spi: spi bus to use