Fix several type hints · csamuelson/circuitpython@d356581 · GitHub
Skip to content

Commit d356581

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

84 files changed

Lines changed: 292 additions & 274 deletions

Some content is hidden

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

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

Lines changed: 4 additions & 4 deletions

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

0 commit comments

Comments
 (0)