Skip to content

Commit 56c898d

Browse files
committed
Modify some Python stubs
1 parent 887eb3b commit 56c898d

File tree

56 files changed

+645
-536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+645
-536
lines changed

docs/autoapi/templates/python/module.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
{% set visible_subpackages = obj.subpackages|selectattr("display")|list %}
1919
{% if visible_subpackages %}
2020
.. toctree::
21-
:titlesonly:
22-
:maxdepth: 3
21+
:maxdepth: 2
2322

2423
{% for subpackage in visible_subpackages %}
2524
{{ subpackage.short_name }}/index.rst

shared-bindings/_bleio/Adapter.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ const mp_obj_property_t bleio_adapter_name_obj = {
145145
//| .. note: If you set ``anonymous=True``, then a timeout must be specified. If no timeout is
146146
//| specified, then the maximum allowed timeout will be selected automatically.
147147
//|
148-
//| :param buf data: advertising data packet bytes
149-
//| :param buf scan_response: scan response data packet bytes. ``None`` if no scan response is needed.
148+
//| :param ~_typing.ReadableBuffer data: advertising data packet bytes
149+
//| :param ~_typing.ReadableBuffer scan_response: scan response data packet bytes. ``None`` if no scan response is needed.
150150
//| :param bool connectable: If `True` then other devices are allowed to connect to this peripheral.
151151
//| :param bool anonymous: If `True` then this device's MAC address is randomized before advertising.
152152
//| :param int timeout: If set, we will only advertise for this many seconds.
@@ -219,7 +219,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapt
219219
//| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are
220220
//| filtered and returned separately.
221221
//|
222-
//| :param sequence prefixes: Sequence of byte string prefixes to filter advertising packets
222+
//| :param ~_typing.ReadableBuffer prefixes: Sequence of byte string prefixes to filter advertising packets
223223
//| with. A packet without an advertising structure that matches one of the prefixes is
224224
//| ignored. Format is one byte for length (n) and n bytes of prefix and can be repeated.
225225
//| :param int buffer_size: the maximum number of advertising bytes to buffer.
@@ -334,7 +334,7 @@ const mp_obj_property_t bleio_adapter_connected_obj = {
334334
(mp_obj_t)&mp_const_none_obj },
335335
};
336336

337-
//| connections: tuple
337+
//| connections: Tuple[Connection]
338338
//| """Tuple of active connections including those initiated through
339339
//| :py:meth:`_bleio.Adapter.connect`. (read-only)"""
340340
//|

shared-bindings/_bleio/Address.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
//| """Create a new Address object encapsulating the address value.
4343
//| The value itself can be one of:
4444
//|
45-
//| :param buf address: The address value to encapsulate. A buffer object (bytearray, bytes) of 6 bytes.
45+
//| :param ~_typing.ReadableBuffer address: The address value to encapsulate. A buffer object (bytearray, bytes) of 6 bytes.
4646
//| :param int address_type: one of the integer values: `PUBLIC`, `RANDOM_STATIC`,
4747
//| `RANDOM_PRIVATE_RESOLVABLE`, or `RANDOM_PRIVATE_NON_RESOLVABLE`."""
4848
//| ...
@@ -128,7 +128,7 @@ const mp_obj_property_t bleio_address_type_obj = {
128128
(mp_obj_t)&mp_const_none_obj},
129129
};
130130

131-
//| def __eq__(self, other: Address) -> bool:
131+
//| def __eq__(self, other: object) -> bool:
132132
//| """Two Address objects are equal if their addresses and address types are equal."""
133133
//| ...
134134
//|

shared-bindings/_bleio/Characteristic.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
6464
//| number of data bytes that fit in a single BLE 4.x ATT packet.
6565
//| :param bool fixed_length: True if the characteristic value is of fixed length.
66-
//| :param buf initial_value: The initial value for this characteristic. If not given, will be
66+
//| :param ~_typing.ReadableBuffer initial_value: The initial value for this characteristic. If not given, will be
6767
//| filled with zeros.
6868
//|
6969
//| :return: the new Characteristic."""

shared-bindings/_bleio/Connection.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection
111111

112112
//| def discover_remote_services(self, service_uuids_whitelist: Optional[Iterable[UUID]] = None) -> Tuple[Service, ...]:
113113
//| """Do BLE discovery for all services or for the given service UUIDS,
114-
//| to find their handles and characteristics, and return the discovered services.
115-
//| `Connection.connected` must be True.
114+
//| to find their handles and characteristics, and return the discovered services.
115+
//| `Connection.connected` must be True.
116116
//|
117117
//| :param iterable service_uuids_whitelist:
118118
//|
119-
//| an iterable of :py:class:~`UUID` objects for the services provided by the peripheral
119+
//| an iterable of :py:class:`UUID` objects for the services provided by the peripheral
120120
//| that you want to use.
121121
//|
122122
//| The peripheral may provide more services, but services not listed are ignored
@@ -126,7 +126,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection
126126
//| slow.
127127
//|
128128
//| If the service UUID is 128-bit, or its characteristic UUID's are 128-bit, you
129-
//| you must have already created a :py:class:~`UUID` object for that UUID in order for the
129+
//| you must have already created a :py:class:`UUID` object for that UUID in order for the
130130
//| service or characteristic to be discovered. Creating the UUID causes the UUID to be
131131
//| registered for use. (This restriction may be lifted in the future.)
132132
//|

shared-bindings/_bleio/Descriptor.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
//| as part of remote Characteristics in the remote Services that are discovered."""
4747
//|
4848
//| @classmethod
49-
//| def add_to_characteristic(characteristic: Characteristic, uuid: UUID, *, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length = 20, fixed_length: bool = False, initial_value: ReadableBuffer = b'') -> Descriptor:
49+
//| def add_to_characteristic(cls, characteristic: Characteristic, uuid: UUID, *, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: ReadableBuffer = b'') -> Descriptor:
5050
//| """Create a new Descriptor object, and add it to this Service.
5151
//|
5252
//| :param Characteristic characteristic: The characteristic that will hold this descriptor
@@ -61,7 +61,7 @@
6161
//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
6262
//| number of data bytes that fit in a single BLE 4.x ATT packet.
6363
//| :param bool fixed_length: True if the descriptor value is of fixed length.
64-
//| :param buf initial_value: The initial value for this descriptor.
64+
//| :param ~_typing.ReadableBuffer initial_value: The initial value for this descriptor.
6565
//|
6666
//| :return: the new Descriptor."""
6767
//| ...

shared-bindings/_bleio/UUID.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
//| temporary 16-bit UUID that can be used in place of the full 128-bit UUID.
4949
//|
5050
//| :param value: The uuid value to encapsulate
51-
//| :type value: int or typing.ByteString"""
51+
//| :type value: int, ~_typing.ReadableBuffer or str"""
5252
//| ...
5353
//|
5454
STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@@ -248,7 +248,7 @@ STATIC mp_obj_t bleio_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
248248
}
249249
}
250250

251-
//| def __eq__(self, other: UUID) -> bool:
251+
//| def __eq__(self, other: object) -> bool:
252252
//| """Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit."""
253253
//| ...
254254
//|

shared-bindings/_bleio/__init__.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
#include "shared-bindings/_bleio/Service.h"
4242
#include "shared-bindings/_bleio/UUID.h"
4343

44-
//| """
44+
//| """Bluetooth Low Energy (BLE) communication
45+
//|
4546
//| The `_bleio` module provides necessary low-level functionality for communicating
4647
//| using Bluetooth Low Energy (BLE). The '_' prefix indicates this module is meant
4748
//| for internal use by libraries but not by the end user. Its API may change incompatibly
@@ -50,12 +51,12 @@
5051
//| `adafruit_ble <https://circuitpython.readthedocs.io/projects/ble/en/latest/>`_
5152
//| CircuitPython library instead, which builds on `_bleio`, and
5253
//| provides higher-level convenience functionality, including predefined beacons, clients,
53-
//| servers.
54-
//|
55-
//| .. attribute:: adapter
54+
//| servers."""
5655
//|
57-
//| BLE Adapter used to manage device discovery and connections.
58-
//| This object is the sole instance of `_bleio.Adapter`."""
56+
57+
//| adapter: Adapter
58+
//| """BLE Adapter used to manage device discovery and connections.
59+
//| This object is the sole instance of `_bleio.Adapter`."""
5960
//|
6061

6162
//| class BluetoothError(Exception):

0 commit comments

Comments
 (0)