Skip to content

Commit d356581

Browse files
committed
Fix several type hints
1 parent 54a342a commit d356581

Some content is hidden

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

84 files changed

+292
-274
lines changed

ports/atmel-samd/bindings/samd/Clock.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print
4343
mp_printf(print, "%q.%q.%q", MP_QSTR_samd, MP_QSTR_clock, self->name);
4444
}
4545

46-
//| enabled: bool = ...
46+
//| enabled: bool
4747
//| """Is the clock enabled? (read-only)"""
4848
//|
4949
STATIC mp_obj_t samd_clock_get_enabled(mp_obj_t self_in) {
@@ -61,7 +61,7 @@ const mp_obj_property_t samd_clock_enabled_obj = {
6161
},
6262
};
6363

64-
//| parent: Union[Clock, None] = ...
64+
//| parent: Union[Clock, None]
6565
//| """Clock parent. (read-only)"""
6666
//|
6767
STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) {
@@ -89,7 +89,7 @@ const mp_obj_property_t samd_clock_parent_obj = {
8989
},
9090
};
9191

92-
//| frequency: int = ...
92+
//| frequency: int
9393
//| """Clock frequency in Herz. (read-only)"""
9494
//|
9595
STATIC mp_obj_t samd_clock_get_frequency(mp_obj_t self_in) {
@@ -107,7 +107,7 @@ const mp_obj_property_t samd_clock_frequency_obj = {
107107
},
108108
};
109109

110-
//| calibration: int = ...
110+
//| calibration: int
111111
//| """Clock calibration. Not all clocks can be calibrated."""
112112
//|
113113
STATIC mp_obj_t samd_clock_get_calibration(mp_obj_t self_in) {

shared-bindings/_bleio/Adapter.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
//| ...
7272
//|
7373

74-
//| enabled: bool = ...
74+
//| enabled: bool
7575
//| """State of the BLE adapter."""
7676
//|
7777
STATIC mp_obj_t bleio_adapter_get_enabled(mp_obj_t self) {
@@ -95,7 +95,7 @@ const mp_obj_property_t bleio_adapter_enabled_obj = {
9595
(mp_obj_t)&mp_const_none_obj },
9696
};
9797

98-
//| address: Address = ...
98+
//| address: Address
9999
//| """MAC address of the BLE adapter. (read-only)"""
100100
//|
101101
STATIC mp_obj_t bleio_adapter_get_address(mp_obj_t self) {
@@ -111,7 +111,7 @@ const mp_obj_property_t bleio_adapter_address_obj = {
111111
(mp_obj_t)&mp_const_none_obj },
112112
};
113113

114-
//| name: str = ...
114+
//| name: str
115115
//| """name of the BLE adapter used once connected.
116116
//| The name is "CIRCUITPY" + the last four hex digits of ``adapter.address``,
117117
//| to make it easy to distinguish multiple CircuitPython boards."""
@@ -215,7 +215,7 @@ STATIC mp_obj_t bleio_adapter_stop_advertising(mp_obj_t self_in) {
215215
}
216216
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapter_stop_advertising);
217217

218-
//| def start_scan(self, prefixes: ReadableBuffer = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> Iterable[ScanEntry]:
218+
//| def start_scan(self, prefixes: ReadableBuffer = b"", *, buffer_size: int = 512, extended: bool = False, timeout: Optional[float] = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> Iterable[ScanEntry]:
219219
//| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are
220220
//| filtered and returned separately.
221221
//|
@@ -301,7 +301,7 @@ STATIC mp_obj_t bleio_adapter_stop_scan(mp_obj_t self_in) {
301301
}
302302
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_scan_obj, bleio_adapter_stop_scan);
303303

304-
//| advertising: bool = ...
304+
//| advertising: bool
305305
//| """True when the adapter is currently advertising. (read-only)"""
306306
//|
307307
STATIC mp_obj_t bleio_adapter_get_advertising(mp_obj_t self) {
@@ -317,7 +317,7 @@ const mp_obj_property_t bleio_adapter_advertising_obj = {
317317
(mp_obj_t)&mp_const_none_obj },
318318
};
319319

320-
//| connected: bool = ...
320+
//| connected: bool
321321
//| """True when the adapter is connected to another device regardless of who initiated the
322322
//| connection. (read-only)"""
323323
//|
@@ -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
338338
//| """Tuple of active connections including those initiated through
339339
//| :py:meth:`_bleio.Adapter.connect`. (read-only)"""
340340
//|

shared-bindings/_bleio/Address.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args,
7777
return MP_OBJ_FROM_PTR(self);
7878
}
7979

80-
//| address_bytes: bytes = ...
80+
//| address_bytes: bytes
8181
//| """The bytes that make up the device address (read-only).
8282
//|
8383
//| Note that the ``bytes`` object returned is in little-endian order:
@@ -108,7 +108,7 @@ const mp_obj_property_t bleio_address_address_bytes_obj = {
108108
(mp_obj_t)&mp_const_none_obj},
109109
};
110110

111-
//| type: int = ...
111+
//| type: int
112112
//| """The address type (read-only).
113113
//|
114114
//| One of the integer values: `PUBLIC`, `RANDOM_STATIC`, `RANDOM_PRIVATE_RESOLVABLE`,
@@ -187,17 +187,17 @@ STATIC void bleio_address_print(const mp_print_t *print, mp_obj_t self_in, mp_pr
187187
buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]);
188188
}
189189

190-
//| PUBLIC: int = ...
190+
//| PUBLIC: int
191191
//| """A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits)."""
192192
//|
193-
//| RANDOM_STATIC: int = ...
193+
//| RANDOM_STATIC: int
194194
//| """A randomly generated address that does not change often. It may never change or may change after
195195
//| a power cycle."""
196196
//|
197-
//| RANDOM_PRIVATE_RESOLVABLE: int = ...
197+
//| RANDOM_PRIVATE_RESOLVABLE: int
198198
//| """An address that is usable when the peer knows the other device's secret Identity Resolving Key (IRK)."""
199199
//|
200-
//| RANDOM_PRIVATE_NON_RESOLVABLE: int = ...
200+
//| RANDOM_PRIVATE_NON_RESOLVABLE: int
201201
//| """A randomly generated address that changes on every connection."""
202202
//|
203203
STATIC const mp_rom_map_elem_t bleio_address_locals_dict_table[] = {

shared-bindings/_bleio/Attribute.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,25 @@
4343

4444
STATIC const mp_rom_map_elem_t bleio_attribute_locals_dict_table[] = {
4545

46-
//| NO_ACCESS: int = ...
46+
//| NO_ACCESS: int
4747
//| """security mode: access not allowed"""
4848
//|
49-
//| OPEN: int = ...
49+
//| OPEN: int
5050
//| """security_mode: no security (link is not encrypted)"""
5151
//|
52-
//| ENCRYPT_NO_MITM: int = ...
52+
//| ENCRYPT_NO_MITM: int
5353
//| """security_mode: unauthenticated encryption, without man-in-the-middle protection"""
5454
//|
55-
//| ENCRYPT_WITH_MITM: int = ...
55+
//| ENCRYPT_WITH_MITM: int
5656
//| """security_mode: authenticated encryption, with man-in-the-middle protection"""
5757
//|
58-
//| LESC_ENCRYPT_WITH_MITM: int = ...
58+
//| LESC_ENCRYPT_WITH_MITM: int
5959
//| """security_mode: LESC encryption, with man-in-the-middle protection"""
6060
//|
61-
//| SIGNED_NO_MITM: int = ...
61+
//| SIGNED_NO_MITM: int
6262
//| """security_mode: unauthenticated data signing, without man-in-the-middle protection"""
6363
//|
64-
//| SIGNED_WITH_MITM: int = ...
64+
//| SIGNED_WITH_MITM: int
6565
//| """security_mode: authenticated data signing, without man-in-the-middle protection"""
6666
//|
6767
{ MP_ROM_QSTR(MP_QSTR_NO_ACCESS), MP_ROM_INT(SECURITY_MODE_NO_ACCESS) },

shared-bindings/_bleio/Characteristic.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_characteristic_add_to_service_obj,
141141

142142

143143

144-
//| properties: int = ...
144+
//| properties: int
145145
//| """An int bitmask representing which properties are set, specified as bitwise or'ing of
146146
//| of these possible values.
147147
//| `BROADCAST`, `INDICATE`, `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE`."""
@@ -160,7 +160,7 @@ const mp_obj_property_t bleio_characteristic_properties_obj = {
160160
(mp_obj_t)&mp_const_none_obj },
161161
};
162162

163-
//| uuid: Optional[UUID] = ...
163+
//| uuid: Optional[UUID]
164164
//| """The UUID of this characteristic. (read-only)
165165
//|
166166
//| Will be ``None`` if the 128-bit UUID for this characteristic is not known."""
@@ -180,7 +180,7 @@ const mp_obj_property_t bleio_characteristic_uuid_obj = {
180180
(mp_obj_t)&mp_const_none_obj },
181181
};
182182

183-
//| value: bytearray = ...
183+
//| value: bytearray
184184
//| """The value of this characteristic."""
185185
//|
186186
STATIC mp_obj_t bleio_characteristic_get_value(mp_obj_t self_in) {
@@ -211,7 +211,7 @@ const mp_obj_property_t bleio_characteristic_value_obj = {
211211
(mp_obj_t)&mp_const_none_obj },
212212
};
213213

214-
//| descriptors: Descriptor = ...
214+
//| descriptors: Descriptor
215215
//| """A tuple of :py:class:`Descriptor` that describe this characteristic. (read-only)"""
216216
//|
217217
STATIC mp_obj_t bleio_characteristic_get_descriptors(mp_obj_t self_in) {
@@ -241,7 +241,7 @@ const mp_obj_property_t bleio_characteristic_descriptors_obj = {
241241
(mp_obj_t)&mp_const_none_obj },
242242
};
243243

244-
//| service: Service = ...
244+
//| service: Service
245245
//| """The Service this Characteristic is a part of."""
246246
//|
247247
STATIC mp_obj_t bleio_characteristic_get_service(mp_obj_t self_in) {
@@ -258,7 +258,7 @@ const mp_obj_property_t bleio_characteristic_service_obj = {
258258
(mp_obj_t)&mp_const_none_obj },
259259
};
260260

261-
//| def set_cccd(self, *, notify: bool = False, indicate: float = False) -> None:
261+
//| def set_cccd(self, *, notify: bool = False, indicate: bool = False) -> None:
262262
//| """Set the remote characteristic's CCCD to enable or disable notification and indication.
263263
//|
264264
//| :param bool notify: True if Characteristic should receive notifications of remote writes
@@ -291,22 +291,22 @@ STATIC const mp_rom_map_elem_t bleio_characteristic_locals_dict_table[] = {
291291
{ MP_ROM_QSTR(MP_QSTR_set_cccd), MP_ROM_PTR(&bleio_characteristic_set_cccd_obj) },
292292

293293
// Bitmask constants to represent properties
294-
//| BROADCAST: int = ...
294+
//| BROADCAST: int
295295
//| """property: allowed in advertising packets"""
296296
//|
297-
//| INDICATE: int = ...
297+
//| INDICATE: int
298298
//| """property: server will indicate to the client when the value is set and wait for a response"""
299299
//|
300-
//| NOTIFY: int = ...
300+
//| NOTIFY: int
301301
//| """property: server will notify the client when the value is set"""
302302
//|
303-
//| READ: int = ...
303+
//| READ: int
304304
//| """property: clients may read this characteristic"""
305305
//|
306-
//| WRITE: int = ...
306+
//| WRITE: int
307307
//| """property: clients may write this characteristic; a response will be sent back"""
308308
//|
309-
//| WRITE_NO_RESPONSE: int = ...
309+
//| WRITE_NO_RESPONSE: int
310310
//| """property: clients may write this characteristic; no response will be sent back"""
311311
//|
312312
{ MP_ROM_QSTR(MP_QSTR_BROADCAST), MP_ROM_INT(CHAR_PROP_BROADCAST) },

shared-bindings/_bleio/CharacteristicBuffer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
100100

101101
// These are standard stream methods. Code is in py/stream.c.
102102
//
103-
//| def read(self, nbytes: int = None) -> Optional[bytes]:
103+
//| def read(self, nbytes: Optional[int] = None) -> Optional[bytes]:
104104
//| """Read characters. If ``nbytes`` is specified then read at most that many
105105
//| bytes. Otherwise, read everything that arrives until the connection
106106
//| times out. Providing the number of bytes expected is highly recommended
@@ -167,7 +167,7 @@ STATIC mp_uint_t bleio_characteristic_buffer_ioctl(mp_obj_t self_in, mp_uint_t r
167167
return ret;
168168
}
169169

170-
//| in_waiting: int = ...
170+
//| in_waiting: int
171171
//| """The number of bytes in the input buffer, available to be read"""
172172
//|
173173
STATIC mp_obj_t bleio_characteristic_buffer_obj_get_in_waiting(mp_obj_t self_in) {

shared-bindings/_bleio/Connection.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ STATIC mp_obj_t bleio_connection_pair(mp_uint_t n_args, const mp_obj_t *pos_args
109109
}
110110
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection_pair);
111111

112-
//| def discover_remote_services(self, service_uuids_whitelist: Iterable[UUID] = None) -> Tuple[Service, ...]:
112+
//| 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,
114114
//| to find their handles and characteristics, and return the discovered services.
115115
//| `Connection.connected` must be True.
@@ -152,7 +152,7 @@ STATIC mp_obj_t bleio_connection_discover_remote_services(mp_uint_t n_args, cons
152152
}
153153
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_discover_remote_services_obj, 1, bleio_connection_discover_remote_services);
154154

155-
//| connected: bool = ...
155+
//| connected: bool
156156
//| """True if connected to the remote peer."""
157157
//|
158158
STATIC mp_obj_t bleio_connection_get_connected(mp_obj_t self_in) {
@@ -170,7 +170,7 @@ const mp_obj_property_t bleio_connection_connected_obj = {
170170
};
171171

172172

173-
//| paired: bool = ...
173+
//| paired: bool
174174
//| """True if paired to the remote peer."""
175175
//|
176176
STATIC mp_obj_t bleio_connection_get_paired(mp_obj_t self_in) {
@@ -188,7 +188,7 @@ const mp_obj_property_t bleio_connection_paired_obj = {
188188
};
189189

190190

191-
//| connection_interval: float = ...
191+
//| connection_interval: float
192192
//| """Time between transmissions in milliseconds. Will be multiple of 1.25ms. Lower numbers
193193
//| increase speed and decrease latency but increase power consumption.
194194
//|
@@ -206,7 +206,7 @@ STATIC mp_obj_t bleio_connection_get_connection_interval(mp_obj_t self_in) {
206206
}
207207
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_get_connection_interval_obj, bleio_connection_get_connection_interval);
208208

209-
//| attribute: int = ...
209+
//| attribute: int
210210
//| """The maximum number of data bytes that can be sent in a single transmission,
211211
//| not including overhead bytes.
212212
//|

shared-bindings/_bleio/Descriptor.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,27 @@
4343
//| """There is no regular constructor for a Descriptor. A new local Descriptor can be created
4444
//| and attached to a Characteristic by calling `add_to_characteristic()`.
4545
//| Remote Descriptor objects are created by `Connection.discover_remote_services()`
46-
//| as part of remote Characteristics in the remote Services that are discovered.
46+
//| as part of remote Characteristics in the remote Services that are discovered."""
4747
//|
48-
//| .. classmethod:: add_to_characteristic(characteristic, uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=b'')
48+
//| @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:
50+
//| """Create a new Descriptor object, and add it to this Service.
4951
//|
50-
//| Create a new Descriptor object, and add it to this Service.
52+
//| :param Characteristic characteristic: The characteristic that will hold this descriptor
53+
//| :param UUID uuid: The uuid of the descriptor
54+
//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which
55+
//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`,
56+
//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`,
57+
//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`.
58+
//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which
59+
//| security mode is required. Values allowed are the same as ``read_perm``.
60+
//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is
61+
//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
62+
//| number of data bytes that fit in a single BLE 4.x ATT packet.
63+
//| :param bool fixed_length: True if the descriptor value is of fixed length.
64+
//| :param buf initial_value: The initial value for this descriptor.
5165
//|
52-
//| :param Characteristic characteristic: The characteristic that will hold this descriptor
53-
//| :param UUID uuid: The uuid of the descriptor
54-
//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which
55-
//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`,
56-
//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`,
57-
//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`.
58-
//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which
59-
//| security mode is required. Values allowed are the same as ``read_perm``.
60-
//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is
61-
//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
62-
//| number of data bytes that fit in a single BLE 4.x ATT packet.
63-
//| :param bool fixed_length: True if the descriptor value is of fixed length.
64-
//| :param buf initial_value: The initial value for this descriptor.
65-
//|
66-
//| :return: the new Descriptor."""
66+
//| :return: the new Descriptor."""
6767
//| ...
6868
//|
6969
STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@@ -132,7 +132,7 @@ STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_o
132132
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_descriptor_add_to_characteristic_fun_obj, 3, bleio_descriptor_add_to_characteristic);
133133
STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_descriptor_add_to_characteristic_obj, MP_ROM_PTR(&bleio_descriptor_add_to_characteristic_fun_obj));
134134

135-
//| uuid: UUID = ...
135+
//| uuid: UUID
136136
//| """The descriptor uuid. (read-only)"""
137137
//|
138138
STATIC mp_obj_t bleio_descriptor_get_uuid(mp_obj_t self_in) {
@@ -150,7 +150,7 @@ const mp_obj_property_t bleio_descriptor_uuid_obj = {
150150
(mp_obj_t)&mp_const_none_obj},
151151
};
152152

153-
//| characteristic: Characteristic = ...
153+
//| characteristic: Characteristic
154154
//| """The Characteristic this Descriptor is a part of."""
155155
//|
156156
STATIC mp_obj_t bleio_descriptor_get_characteristic(mp_obj_t self_in) {
@@ -167,7 +167,7 @@ const mp_obj_property_t bleio_descriptor_characteristic_obj = {
167167
(mp_obj_t)&mp_const_none_obj },
168168
};
169169

170-
//| value: WriteableBuffer = ...
170+
//| value: bytearray
171171
//| """The value of this descriptor."""
172172
//|
173173
STATIC mp_obj_t bleio_descriptor_get_value(mp_obj_t self_in) {

0 commit comments

Comments
 (0)