8000 add manually the pre-commit formatting that could not be automaticall… · WaveyD/circuitpython@62c2107 · GitHub
[go: up one dir, main page]

Skip to content

Commit 62c2107

Browse files
add manually the pre-commit formatting that could not be automatically applied
1 parent 137c2c5 commit 62c2107

File tree

26 files changed

+85
-37
lines changed

26 files changed

+85
-37
lines changed

ports/espressif/bindings/espnow/ESPNow.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ static const mp_stream_p_t espnow_stream_p = {
320320
//| This is an easy way to check if the buffer is empty.
321321
//| """
322322
//| ...
323+
//|
323324
//| def __len__(self) -> int:
324325
//| """Return the number of `bytes` available to read. Used to implement ``len()``."""
325326
//| ...

ports/espressif/tools/update_sdkconfig.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ def update(debug, board, update_all):
195195
ble_enabled = not (value == "0")
196196

197197
os.environ["IDF_TARGET"] = target
198-
os.environ[
199-
"COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE"
200-
] = f"build-{board}/esp-idf/kconfigs_projbuild.in"
198+
os.environ["COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE"] = (
199+
f"build-{board}/esp-idf/kconfigs_projbuild.in"
200+
)
201201
os.environ["COMPONENT_KCONFIGS_SOURCE_FILE"] = f"build-{board}/esp-idf/kconfigs.in"
202202

203203
kconfig_path = pathlib.Path(f"build-{board}/esp-idf/kconfigs.in")

shared-bindings/_bleio/CharacteristicBuffer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ static void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
7979
//| :return: Data read
8080
//| :rtype: bytes or None"""
8181
//| ...
82+
//|
8283
//| def readinto(self, buf: WriteableBuffer, nbytes: Optional[int] = None) -> Optional[int]:
8384
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
8485
//|
@@ -87,6 +88,7 @@ static void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
8788
//| :return: number of bytes read and stored into ``buf``
8889
//| :rtype: int or None (on a non-blocking error)"""
8990
//| ...
91+
//|
9092
//| def readline(self) -> bytes:
9193
//| """Read a line, ending in a newline character.
9294
//|

shared-bindings/_bleio/Connection.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) {
5252
//| Connections may also be made when another device initiates a connection. To use a Connection
5353
//| created by a peer, read the `Adapter.connections` property."""
5454
//| ...
55+
//|
5556
//| def disconnect(self) -> None:
5657
//| """Disconnects from the remote peripheral. Does nothing if already disconnected."""
5758
//| ...

shared-bindings/_bleio/Descriptor.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
//| and attached to a Characteristic by calling `add_to_characteristic()`.
2525
//| Remote Descriptor objects are created by `Connection.discover_remote_services()`
2626
//| as part of remote Characteristics in the remote Services that are discovered."""
27+
//|
2728
//| @classmethod
2829
//| def add_to_characteristic(
2930
//| cls,

shared-bindings/_bleio/ScanEntry.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
//| def __init__(self) -> None:
2525
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
2626
//| ...
27+
//|
2728
//| def matches(self, prefixes: ReadableBuffer, *, match_all: bool = True) -> bool:
2829
//| """Returns True if the ScanEntry matches all prefixes when ``match_all`` is True. This is stricter
2930
//| than the scan filtering which accepts any advertisements that match any of the prefixes

shared-bindings/_bleio/ScanResults.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ static mp_obj_t scanresults_iternext(mp_obj_t self_in) {
2929
//| def __init__(self) -> None:
3030
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
3131
//| ...
32+
//|
3233
//| def __iter__(self) -> Iterator[ScanEntry]:
3334
//| """Returns itself since it is the iterator."""
3435
//| ...
36+
//|
3537
//| def __next__(self) -> ScanEntry:
3638
//| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still
3739
//| active. Raises `StopIteration` if scanning is finished and no other results are available.

shared-bindings/_pixelmap/PixelMap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,15 @@ MP_DEFINE_CONST_FUN_OBJ_2(pixelmap_pixelmap_indices_obj, pixelmap_pixelmap_indic
140140
//| def __getitem__(self, index: slice) -> PixelReturnSequence:
141141
//| """Retrieve the value of the underlying pixels."""
142142
//| ...
143+
//|
143144
//| @overload
144145
//| def __getitem__(self, index: int) -> PixelReturnType:
145146
//| """Retrieve the value of one of the underlying pixels at 'index'."""
146147
//| ...
148+
//|
147149
//| @overload
148150
//| def __setitem__(self, index: slice, value: PixelSequence) -> None: ...
151+
//|
149152
//| @overload
150153
//| def __setitem__(self, index: int, value: PixelType) -> None:
151154
//| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are

shared-bindings/adafruit_pixelbuf/PixelBuf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,17 @@ static MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_f
248248
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
249249
//| intensity from 0-1.0."""
250250
//| ...
251+
//|
251252
//| @overload
252253
//| def __getitem__(self, index: int) -> PixelReturnType:
253254
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
254255
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
255256
//| intensity from 0-1.0."""
256257
//| ...
258+
//|
257259
//| @overload
258260
//| def __setitem__(self, index: slice, value: PixelSequence) -> None: ...
261+
//|
259262
//| @overload
260263
//| def __setitem__(self, index: int, value: PixelType) -> None:
261264
//| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are

shared-bindings/alarm/SleepMemory.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@
3333
//| def __init__(self) -> None:
3434
//| """Not used. Access the sole instance through `alarm.sleep_memory`."""
3535
//| ...
36+
//|
3637
//| def __bool__(self) -> bool:
3738
//| """``sleep_memory`` is ``True`` if its length is greater than zero.
3839
//| This is an easy way to check for its existence.
3940
//| """
41+
//|
4042
//| ...
4143
//| def __len__(self) -> int:
4244
//| """Return the length. This is used by (`len`)"""
@@ -65,6 +67,7 @@ static MP_DEFINE_CONST_DICT(alarm_sleep_memory_locals_dict, alarm_sleep_memory_l
6567
//| def __getitem__(self, index: int) -> int:
6668
//| """Returns the value at the given index."""
6769
//| ...
70+
//|
6871
//| @overload
6972
//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ...
7073
//| @overload

shared-bindings/canio/Listener.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(canio_listener_in_waiting_obj, canio_listener_i
6060
//| This method exists so that `Listener` can be used as an
6161
//| iterable"""
6262
//| ...
63+
//|
6364
//| def __next__(self) -> Union[RemoteTransmissionRequest, Message]:
6465
//| """Reads a message, after waiting up to self.timeout seconds
6566
//|

shared-bindings/displayio/Bitmap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ MP_PROPERTY_GETTER(displayio_bitmap_bits_per_value_obj,
117117
//|
118118
//| print(bitmap[0,1])"""
119119
//| ...
120+
//|
120121
//| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None:
121122
//| """Sets the value at the given index. The index can either be an x,y tuple or an int equal
122123
//| to ``y * width + x``.

shared-bindings/displayio/Group.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ static mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
261261
//|
262262
//| print(group[0])"""
263263
//| ...
264+
//|
264265
//| def __setitem__(
265266
//| self,
266267
//| index: int,
@@ -272,6 +273,7 @@ static mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
272273
//|
273274
//| group[0] = sprite"""
274275
//| ...
276+
//|
275277
//| def __delitem__(self, index: int) -> None:
276278
//| """Deletes the value at the given index.
277279
//|

shared-bindings/displayio/Palette.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ static mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
8484
//| def __getitem__(self, index: int) -> Optional[int]:
8585
//| r"""Return the pixel color at the given index as an integer."""
8686
//| ...
87+
//|
8788
//| def __setitem__(
8889
//| self, index: int, value: Union[int, ReadableBuffer, Tuple[int, int, int]]
8990
//| ) -> None:

shared-bindings/displayio/TileGrid.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ MP_PROPERTY_GETSET(displayio_tilegrid_bitmap_obj,
389389
//|
390390
//| print(grid[0])"""
391391
//| ...
392+
//|
392393
//| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None:
393394
//| """Sets the tile index at the given index. The index can either be an x,y tuple or an int equal
394395
//| to ``y * width + x``.

shared-bindings/fontio/BuiltinFont.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
//| The two element version is ``(width, height)``, in which
2828
//| ``x_offset`` and ``y_offset`` are assumed to be zero."""
2929
//| pass
30+
//|
3031
//| def get_glyph(self, codepoint: int) -> Optional[Glyph]:
3132
//| """Retrieve the Glyph for a given code point
3233
//|

shared-bindings/keypad/EventQueue.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_eventqueue_clear_obj, keypad_eventqueue_clear);
8080
//| This is an easy way to check if the queue is empty.
8181
//| """
8282
//| ...
83+
//|
8384
//| def __len__(self) -> int:
8485
//| """Return the number of events currently in the queue. Used to implement ``len()``."""
8586
//| ...

shared-bindings/memorymap/AddressRange.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,10 @@ static MP_DEFINE_CONST_DICT(memorymap_addressrange_locals_dict, memorymap_addres
129129
//| when possible.
130130
//| All others may use multiple transactions."""
131131
//| ...
132+
//|
132133
//| @overload
133134
//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ...
135+
//|
134136
//| @overload
135137
//| def __setitem__(self, index: int, value: int) -> None:
136138
//| """Set the value(s) at the given index.

shared-bindings/nvm/ByteArray.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static MP_DEFINE_CONST_DICT(nvm_bytearray_locals_dict, nvm_bytearray_locals_dict
5555
//| def __getitem__(self, index: int) -> int:
5656
//| """Returns the value at the given index."""
5757
//| ...
58+
//|
5859
//| @overload
5960
//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ...
6061
//| @overload

shared-bindings/spitarget/SPITarget.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
//| :param ~microcontroller.Pin miso: The pin transferring data from the secondary to the main
3232
//| :param ~microcontroller.Pin ss: The secondary selection pin"""
3333
//| ...
34-
STATIC mp_obj_t spitarget_spi_target_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
34+
static mp_obj_t spitarget_spi_target_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
3535
spitarget_spi_target_obj_t *self = mp_obj_malloc(spitarget_spi_target_obj_t, &spitarget_spi_target_type);
3636
enum { ARG_sck, ARG_mosi, ARG_miso, ARG_ss };
3737
static const mp_arg_t allowed_args[] = {
@@ -55,7 +55,8 @@ STATIC mp_obj_t spitarget_spi_target_make_new(const mp_obj_type_t *type, size_t
5555
//| def deinit(self) -> None:
5656
//| """Releases control of the underlying hardware so other classes can use it."""
5757
//| ...
58-
STATIC mp_obj_t spitarget_spi_target_obj_deinit(mp_obj_t self_in) {
58+
//|
59+
static mp_obj_t spitarget_spi_target_obj_deinit(mp_obj_t self_in) {
5960
mp_check_self(mp_obj_is_type(self_in, &spitarget_spi_target_type));
6061
spitarget_spi_target_obj_t *self = MP_OBJ_TO_PTR(self_in);
6162
common_hal_spitarget_spi_target_deinit(self);
@@ -66,19 +67,21 @@ MP_DEFINE_CONST_FUN_OBJ_1(spitarget_spi_target_deinit_obj, spitarget_spi_target_
6667
//| def __enter__(self) -> SPITarget:
6768
//| """No-op used in Context Managers."""
6869
//| ...
70+
//|
6971
// Provided by context manager helper.
7072

7173
//| def __exit__(self) -> None:
7274
//| """Automatically deinitializes the hardware on context exit. See
7375
//| :ref:`lifetime-and-contextmanagers` for more info."""
7476
//| ...
75-
STATIC mp_obj_t spitarget_spi_target_obj___exit__(size_t n_args, const mp_obj_t *args) {
77+
//|
78+
static mp_obj_t spitarget_spi_target_obj___exit__(size_t n_args, const mp_obj_t *args) {
7679
mp_check_self(mp_obj_is_type(args[0], &spitarget_spi_target_target_type));
7780
spitarget_spi_target_obj_t *self = MP_OBJ_TO_PTR(args[0]);
7881
common_hal_spitarget_spi_target_deinit(self);
7982
return mp_const_none;
8083
}
81-
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(spitarget_spi_target___exit___obj, 4, 4, spitarget_spi_target_obj___exit__);
84+
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(spitarget_spi_target___exit___obj, 4, 4, spitarget_spi_target_obj___exit__);
8285

8386
//| def load_packet(self, mosi_packet: bytearray, miso_packet: bytearray) -> None:
8487
//| """Queue data for the next SPI transfer from the main device.
@@ -87,7 +90,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(spitarget_spi_target___exit___obj, 4,
8790
//| :param bytearray miso_packet: Packet data to be sent from secondary to main on next request.
8891
//| :param bytearray mosi_packet: Packet to be filled with data from main on next request.
8992
//| """
90-
STATIC mp_obj_t spitarget_spi_target_load_packet(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
93+
static mp_obj_t spitarget_spi_target_load_packet(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
9194
mp_check_self(mp_obj_is_type(pos_args[0], &spitarget_spi_target_type));
9295
spitarget_spi_target_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
9396
if (common_hal_spitarget_spi_target_deinited(self)) {
@@ -114,16 +117,16 @@ STATIC mp_obj_t spitarget_spi_target_load_packet(size_t n_args, const mp_obj_t *
114117
common_hal_spitarget_spi_target_transfer_start(self, ((uint8_t *)mosi_bufinfo.buf), ((uint8_t *)miso_bufinfo.buf), mosi_bufinfo.len);
115118
return mp_const_none;
116119
}
117-
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(spitarget_spi_target_load_packet_obj, 1, spitarget_spi_target_load_packet);
120+
static MP_DEFINE_CONST_FUN_OBJ_KW(spitarget_spi_target_load_packet_obj, 1, spitarget_spi_target_load_packet);
118121

119122
//| def wait_transfer(self, *, timeout: float = -1) -> bool:
120123
//| """Wait for an SPI transfer from the main device.
121124
//|
122125
//| :param float timeout: Timeout in seconds. Zero means wait forever, a negative value means check once
123126
//| :return: True if the transfer is complete, or False if no response received before the timeout
124-
//| :rtype: ~bool"""
127+
//| """
125128
//|
126-
STATIC mp_obj_t spitarget_spi_target_wait_transfer(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
129+
static mp_obj_t spitarget_spi_target_wait_transfer(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
127130
mp_check_self(mp_obj_is_type(pos_args[0], &spitarget_spi_target_type));
128131
spitarget_spi_target_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
129132
if (common_hal_spitarget_spi_target_deinited(self)) {
@@ -161,9 +164,9 @@ STATIC mp_obj_t spitarget_spi_target_wait_transfer(size_t n_args, const mp_obj_t
161164

162165
return mp_const_false;
163166
}
164-
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(spitarget_spi_target_wait_transfer_obj, 1, spitarget_spi_target_wait_transfer);
167+
static MP_DEFINE_CONST_FUN_OBJ_KW(spitarget_spi_target_wait_transfer_obj, 1, spitarget_spi_target_wait_transfer);
165168

166-
STATIC const mp_rom_map_elem_t spitarget_spi_target_locals_dict_table[] = {
169+
static const mp_rom_map_elem_t spitarget_spi_target_locals_dict_table[] = {
167170
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&spitarget_spi_target_deinit_obj) },
168171
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
169172
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&spitarget_spi_target___exit___obj) },
@@ -172,7 +175,7 @@ STATIC const mp_rom_map_elem_t spitarget_spi_target_locals_dict_table[] = {
172175

173176
};
174177

175-
STATIC MP_DEFINE_CONST_DICT(spitarget_spi_target_locals_dict, spitarget_spi_target_locals_dict_table);
178+
static MP_DEFINE_CONST_DICT(spitarget_spi_target_locals_dict, spitarget_spi_target_locals_dict_table);
176179

177180
MP_DEFINE_CONST_OBJ_TYPE(
178181
spitarget_spi_target_type,

shared-bindings/spitarget/__init__.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@
4848
//| >>> spi.write(bytearray([0, 0])) # ADC command: read from A0
4949
//| >>> adc_result = bytearray(2)
5050
//| >>> spi.readinto(adc_result)
51-
//| >>> adc_result
52-
//| bytearray(b'\xc4\x16')
51+
//| >>> list(adc_result) # show output from ADC
52+
//| [196, 22]
5353
//| >>> spi.unlock()
5454
//|
5555
//| """
5656

5757

5858

59-
STATIC const mp_rom_map_elem_t spitarget_module_globals_table[] = {
59+
static const mp_rom_map_elem_t spitarget_module_globals_table[] = {
6060
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_spitarget) },
6161
{ MP_ROM_QSTR(MP_QSTR_SPITarget), MP_ROM_PTR(&spitarget_spi_target_type) },
6262
};
6363

64-
STATIC MP_DEFINE_CONST_DICT(spitarget_module_globals, spitarget_module_globals_table);
64+
static MP_DEFINE_CONST_DICT(spitarget_module_globals, spitarget_module_globals_table);
6565

6666
const mp_obj_module_t spitarget_module = {
6767
.base = { &mp_type_module },

shared-bindings/storage/__init__.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,30 +255,38 @@ static const mp_rom_map_elem_t storage_module_globals_table[] = {
255255
//| larger filesystems, but you will need to format the filesystem on another device.
256256
//| """
257257
//| ...
258+
//|
258259
//| def open(self, path: str, mode: str) -> None:
259260
//| """Like builtin ``open()``"""
260261
//| ...
262+
//|
261263
//| def ilistdir(
262264
//| self, path: str
263265
//| ) -> Iterator[Union[Tuple[AnyStr, int, int, int], Tuple[AnyStr, int, int]]]:
264266
//| """Return an iterator whose values describe files and folders within
265267
//| ``path``"""
266268
//| ...
269+
//|
267270
//| def mkdir(self, path: str) -> None:
268271
//| """Like `os.mkdir`"""
269272
//| ...
273+
//|
270274
//| def rmdir(self, path: str) -> None:
271275
//| """Like `os.rmdir`"""
272276
//| ...
277+
//|
273278
//| def stat(self, path: str) -> Tuple[int, int, int, int, int, int, int, int, int, int]:
274279
//| """Like `os.stat`"""
275280
//| ...
281+
//|
276282
//| def statvfs(self, path: int) -> Tuple[int, int, int, int, int, int, int, int, int, int]:
277283
//| """Like `os.statvfs`"""
278284
//| ...
285+
//|
279286
//| def mount(self, readonly: bool, mkfs: VfsFat) -> None:
280287
//| """Don't call this directly, call `storage.mount`."""
281288
//| ...
289+
//|
282290
//| def umount(self) -> None:
283291
//| """Don't call this directly, call `storage.umount`."""
284292
//| ...

0 commit comments

Comments
 (0)
0