Skip to content

Commit 3df03a5

Browse files
committed
Made most of the requested changes
1 parent 843ff5d commit 3df03a5

Some content is hidden

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

48 files changed

+116
-110
lines changed

shared-bindings/_bleio/Adapter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: str = ...
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) {
@@ -350,7 +350,7 @@ const mp_obj_property_t bleio_adapter_connections_obj = {
350350
(mp_obj_t)&mp_const_none_obj },
351351
};
352352

353-
//| def connect(self, address: Address, *, timeout: float/int) -> Adapter.connect:
353+
//| def connect(self, address: Address, *, timeout: float/int) -> Connection:
354354
//| """Attempts a connection to the device with the given address.
355355
//|
356356
//| :param Address address: The address of the peripheral to connect to

shared-bindings/_bleio/Address.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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: bytes) -> Optional[bool]:
131+
//| def __eq__(self, other: Any) -> bool:
132132
//| """Two Address objects are equal if their addresses and address types are equal."""
133133
//| ...
134134
//|
@@ -154,7 +154,7 @@ STATIC mp_obj_t bleio_address_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_o
154154
}
155155
}
156156

157-
//| def __hash__(self) -> Optional[int]:
157+
//| def __hash__(self) -> int:
158158
//| """Returns a hash for the Address data."""
159159
//| ...
160160
//|
@@ -187,7 +187,7 @@ 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: bytes = ...
190+
//| PUBLIC: int = ...
191191
//| """A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits)."""
192192
//|
193193
//| RANDOM_STATIC: int = ...

shared-bindings/_bleio/Connection.c

Lines changed: 1 addition & 1 deletion
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 = None) -> Tuple(_bleio.Service, ...):
112+
//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> 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.

shared-bindings/_bleio/PacketBuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ STATIC mp_obj_t bleio_packet_buffer_readinto(mp_obj_t self_in, mp_obj_t buffer_o
117117
}
118118
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_buffer_readinto);
119119

120-
//| def write(self, data: bytes, *, header: bytes = None) -> int:
120+
//| def write(self, data: bytes, *, header: Optional[bytes] = None) -> int:
121121
//| """Writes all bytes from data into the same outgoing packet. The bytes from header are included
122122
//| before data when the pending packet is currently empty.
123123
//|

shared-bindings/_bleio/ScanEntry.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ STATIC mp_obj_t bleio_scanentry_matches(mp_uint_t n_args, const mp_obj_t *pos_ar
7070
}
7171
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_scanentry_matches_obj, 2, bleio_scanentry_matches);
7272

73-
//| address: _bleio.Address = ...
73+
//| address: Address = ...
7474
//| """The address of the device (read-only), of type `_bleio.Address`."""
7575
//|
7676
STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) {

shared-bindings/_bleio/ScanResults.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) {
5050
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
5151
//| ...
5252
//|
53-
//| def __iter__(self) -> __iter__:
53+
//| def __iter__(self) -> Iterator[ScanEntry]:
5454
//| """Returns itself since it is the iterator."""
5555
//| ...
5656
//|
57-
//| def __next__(self) -> _bleio.ScanEntry:
57+
//| def __next__(self) -> ScanEntry:
5858
//| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still
5959
//| active. Raises `StopIteration` if scanning is finished and no other results are available."""
6060
//| ...

shared-bindings/_bleio/Service.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args,
7373
return MP_OBJ_FROM_PTR(service);
7474
}
7575

76-
//| characteristics: Tuple(Characteristic, ...) = ...
76+
//| characteristics: Tuple[Characteristic, ...] = ...
7777
//| """A tuple of :py:class:`Characteristic` designating the characteristics that are offered by
7878
//| this service. (read-only)"""
7979
//|

shared-bindings/_bleio/UUID.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
//| class UUID:
3737
//| """A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more."""
3838
//|
39-
//| def __init__(self, value: Union[int, typing.ByteString]):
39+
//| def __init__(self, value: Union[int, ReadableBuffer, str]):
4040
//| """Create a new UUID or UUID object encapsulating the uuid value.
4141
//| The value can be one of:
4242
//|
@@ -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) -> Optional[bool]:
251+
//| def __eq__(self, other: Any) -> 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

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@
5959
//|
6060

6161

62-
//| class BluetoothError:
63-
//| def __init__(self, Exception: Exception):
64-
//| """Catch all exception for Bluetooth related errors."""
65-
//| ...
62+
//| class BluetoothError(Exception):
63+
//| """Catch all exception for Bluetooth related errors."""
64+
//| ...
6665
MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception)
6766

6867
NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...) {
@@ -72,10 +71,9 @@ NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...)
7271
va_end(argptr);
7372
nlr_raise(exception);
7473
}
75-
//| class ConnectionError:
76-
//| def __init__(self, BluetoothError: _bleio.BluetoothError):
77-
//| """Raised when a connection is unavailable."""
78-
//| ...
74+
//| class ConnectionError(BluetoothError):
75+
//| """Raised when a connection is unavailable."""
76+
//| ...
7977
//|
8078
MP_DEFINE_BLEIO_EXCEPTION(ConnectionError, bleio_BluetoothError)
8179
NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* fmt, ...) {
@@ -86,20 +84,18 @@ NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* fmt, ...
8684
nlr_raise(exception);
8785
}
8886

89-
//| class RoleError:
90-
//| def __init__(self, BluetoothError: _bleio.BluetoothError):
91-
//| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is
92-
//| attempted to be set but they can only be set when remote."""
93-
//| ...
87+
//| class RoleError(BluetoothError):
88+
//| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is
89+
//| attempted to be set but they can only be set when remote."""
90+
//| ...
9491
//|
9592
MP_DEFINE_BLEIO_EXCEPTION(RoleError, bleio_BluetoothError)
9693
NORETURN void mp_raise_bleio_RoleError(const compressed_string_t* msg) {
9794
mp_raise_msg(&mp_type_bleio_RoleError, msg);
9895
}
99-
//| class SecurityError:
100-
//| def __init__(self, BluetoothError: _bleio.BluetoothError):
101-
//| """Raised when a security related error occurs."""
102-
//| ...
96+
//| class SecurityError(BluetoothError):
97+
//| """Raised when a security related error occurs."""
98+
//| ...
10399
//|
104100
MP_DEFINE_BLEIO_EXCEPTION(SecurityError, bleio_BluetoothError)
105101
NORETURN void mp_raise_bleio_SecurityError(const compressed_string_t* fmt, ...) {

shared-bindings/_eve/__init__.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ STATIC mp_obj_t _register(mp_obj_t self, mp_obj_t o) {
5858
}
5959
STATIC MP_DEFINE_CONST_FUN_OBJ_2(register_obj, _register);
6060

61-
//| def flush(self) -> Any:
61+
//| def flush(self) -> None:
6262
//| """Send any queued drawing commands directly to the hardware.
6363
//|
6464
//| :param int width: The width of the grid in tiles, or 1 for sprites."""
@@ -559,9 +559,9 @@ STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) {
559559
}
560560
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colorrgb_obj, 4, 4, _colorrgb);
561561

562-
//| def Display(self) -> Any: ...
563-
//| """End the display list"""
564-
//|
562+
//| def Display(self) -> None:
563+
//| """End the display list"""
564+
//| ...
565565

566566
STATIC mp_obj_t _display(mp_obj_t self) {
567567

@@ -570,7 +570,7 @@ STATIC mp_obj_t _display(mp_obj_t self) {
570570
}
571571
STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display);
572572

573-
//| def End(self) -> Any:
573+
//| def End(self) -> None:
574574
//| """End drawing a graphics primitive
575575
//|
576576
//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`."""
@@ -628,7 +628,7 @@ STATIC mp_obj_t _macro(mp_obj_t self, mp_obj_t a0) {
628628
}
629629
STATIC MP_DEFINE_CONST_FUN_OBJ_2(macro_obj, _macro);
630630

631-
//| def Nop(self) -> Any:
631+
//| def Nop(self) -> None:
632632
//| """No operation"""
633633
//| ...
634634
//|
@@ -672,7 +672,7 @@ STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) {
672672
}
673673
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize);
674674

675-
//| def RestoreContext(self) -> Any:
675+
//| def RestoreContext(self) -> None:
676676
//| """Restore the current graphics context from the context stack"""
677677
//| ...
678678
//|
@@ -684,7 +684,7 @@ STATIC mp_obj_t _restorecontext(mp_obj_t self) {
684684
}
685685
STATIC MP_DEFINE_CONST_FUN_OBJ_1(restorecontext_obj, _restorecontext);
686686

687-
//| def Return(self) -> Any:
687+
//| def Return(self) -> None:
688688
//| """Return from a previous call command"""
689689
//| ...
690690
//|
@@ -696,7 +696,7 @@ STATIC mp_obj_t _return(mp_obj_t self) {
696696
}
697697
STATIC MP_DEFINE_CONST_FUN_OBJ_1(return_obj, _return);
698698

699-
//| def SaveContext(self) -> Any:
699+
//| def SaveContext(self) -> None:
700700
//| """Push the current graphics context on the context stack"""
701701
//| ...
702702
//|

0 commit comments

Comments
 (0)