Skip to content

Commit 8b27482

Browse files
committed
top: Update Python formatting to black "2023 stable style".
See https://black.readthedocs.io/en/stable/the_black_code_style/index.html Signed-off-by: Jim Mussared <[email protected]>
1 parent fe2a833 commit 8b27482

File tree

75 files changed

+207
-122
lines changed

Some content is hidden

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

75 files changed

+207
-122
lines changed

examples/SDdatalogger/datalogger.py

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
# loop
1212
while True:
13-
1413
# wait for interrupt
1514
# this reduces power consumption while waiting for switch press
1615
pyb.wfi()

examples/asmsum.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@micropython.asm_thumb
22
def asm_sum_words(r0, r1):
3-
43
# r0 = len
54
# r1 = ptr
65
# r2 = sum
@@ -25,7 +24,6 @@ def asm_sum_words(r0, r1):
2524

2625
@micropython.asm_thumb
2726
def asm_sum_bytes(r0, r1):
28-
2927
# r0 = len
3028
# r1 = ptr
3129
# r2 = sum

examples/bluetooth/ble_uart_repl.py

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
else:
2121
_timer = None
2222

23+
2324
# Batch writes into 50ms intervals.
2425
def schedule_in(handler, delay_ms):
2526
def _wrap(_arg):

examples/conwaylife.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
lcd = pyb.LCD("x")
55
lcd.light(1)
66

7+
78
# do 1 iteration of Conway's Game of Life
89
def conway_step():
910
for x in range(128): # loop over x coordinates

examples/rp2/pio_exec.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from machine import Pin
99
import rp2
1010

11+
1112
# Define an empty program that uses a single set pin.
1213
@rp2.asm_pio(set_init=rp2.PIO.OUT_LOW)
1314
def prog():

examples/rp2/pio_uart_tx.py

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def uart_tx():
3333
sm.active(1)
3434
uarts.append(sm)
3535

36+
3637
# We can print characters from each UART by pushing them to the TX FIFO
3738
def pio_uart_print(sm, s):
3839
for c in s:

extmod/uasyncio/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"StreamWriter": "stream",
1919
}
2020

21+
2122
# Lazy loader, effectively does:
2223
# global attr
2324
# from .mod import attr

extmod/uasyncio/core.py

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class TimeoutError(Exception):
3030
################################################################################
3131
# Sleep functions
3232

33+
3334
# "Yield" once, then raise StopIteration
3435
class SingletonGenerator:
3536
def __init__(self):
@@ -132,6 +133,7 @@ def wait_io_event(self, dt):
132133
################################################################################
133134
# Main run loop
134135

136+
135137
# Ensure the awaitable is a task
136138
def _promote_to_task(aw):
137139
return aw if isinstance(aw, Task) else create_task(aw)

extmod/uasyncio/event.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from . import core
55

6+
67
# Event class for primitive events that can be waited on, set, and cleared
78
class Event:
89
def __init__(self):

extmod/uasyncio/lock.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from . import core
55

6+
67
# Lock class for primitive mutex capability
78
class Lock:
89
def __init__(self):

ports/esp32/boards/UM_FEATHERS2/modules/feathers2.py

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
# Helper functions
4141

42+
4243
# LED & Ambient Light Sensor control
4344
def set_led(state):
4445
l = Pin(LED, Pin.OUT)

ports/esp32/boards/UM_FEATHERS2NEO/modules/feathers2neo.py

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
DAC1 = const(17)
3939
DAC2 = const(18)
4040

41+
4142
# Helper functions
4243
def set_pixel_power(state):
4344
"""Enable or Disable power to the onboard NeoPixel to either show colour, or to reduce power for deep sleep."""

ports/esp32/boards/UM_FEATHERS3/modules/feathers3.py

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
# Helper functions
3434

35+
3536
# LED & Ambient Light Sensor control
3637
def led_set(state):
3738
"""Set the state of the BLUE LED on IO13"""

ports/esp32/boards/UM_PROS3/modules/pros3.py

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
I2C_SDA = const(8)
2929
I2C_SCL = const(9)
3030

31+
3132
# Helper functions
3233
def set_ldo2_power(state):
3334
"""Enable or Disable power to the second LDO"""

ports/esp32/boards/UM_TINYPICO/modules/tinypico.py

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
# Helper functions
4141

42+
4243
# Get a *rough* estimate of the current battery voltage
4344
# If the battery is not present, the charge IC will still report it's trying to charge at X voltage
4445
# so it will still show a voltage.

ports/esp32/boards/UM_TINYS3/modules/tinys3.py

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
I2C_SDA = const(8)
2929
I2C_SCL = const(9)
3030

31+
3132
# Helper functions
3233
def set_pixel_power(state):
3334
"""Enable or Disable power to the onboard NeoPixel to either show colour, or to reduce power for deep sleep."""

ports/esp8266/makeimg.py

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
md5 = hashlib.md5()
1515

1616
with open(sys.argv[3], "wb") as fout:
17-
1817
with open(sys.argv[1], "rb") as f:
1918
data_flash = f.read()
2019
fout.write(data_flash)

ports/esp8266/modules/port_diag.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
def main():
8-
98
ROM = uctypes.bytearray_at(0x40200000, 16)
109
fid = esp.flash_id()
1110

ports/mimxrt/boards/make-flexram-config.py

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"""
5454
ocram_min_size = 0x00010000 # 64 KB
5555

56+
5657
# Value parser
5758
def mimxrt_default_parser(defines_file, features_file, ld_script):
5859
with open(ld_script, "r") as input_file:

ports/nrf/examples/powerup.py

-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ def loop(self):
187187
self.old_speed = 0
188188

189189
while True:
190-
191190
time.sleep_ms(100)
192191

193192
# read out new angle

ports/stm32/boards/NUCLEO_WB55/rfcore_makefirmware.py

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def get_details(release_notes, filename):
6565

6666

6767
def main(src_path, dest_path):
68-
6968
# Load the release note to parse for important details
7069
with open(os.path.join(src_path, _RELEASE_NOTES), "rb") as f:
7170
release_notes = f.read()

ports/stm32/boards/make-pins.py

-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ def print_af_hdr(self, af_const_filename):
506506

507507
def print_af_defs(self, af_defs_filename, cmp_strings):
508508
with open(af_defs_filename, "wt") as af_defs_file:
509-
510509
STATIC_AF_TOKENS = {}
511510
for named_pin in self.cpu_pins:
512511
for af in named_pin.pin().alt_fn:

ports/stm32/make-stmconst.py

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def convert_bytes_to_str(b):
2929

3030
# end compatibility code
3131

32+
3233
# given a list of (name,regex) pairs, find the first one that matches the given line
3334
def re_match_first(regexs, line):
3435
for name, regex in regexs:

py/makeqstrdata.py

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@
222222
"zip",
223223
]
224224

225+
225226
# this must match the equivalent function in qstr.c
226227
def compute_hash(qstr, bytes_hash):
227228
hash = 5381

tests/esp32/esp32_idf_heap_info.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
print("SKIP")
66
raise SystemExit
77

8+
89
# region tuple is: (size, free, largest free, min free)
910
# we check that each region's size is > 0 and that the free amounts are smaller than the size
1011
def chk_heap(kind, regions):

tests/extmod/framebuf_subclass.py

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def foo(self):
3434
fb2.blit(fb, 0, 0)
3535
print(bytes(fb2))
3636

37+
3738
# Test that blitting something that isn't a subclass fails with TypeError.
3839
class NotAFrameBuf:
3940
pass

tests/extmod/uasyncio_exception.py

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
print("SKIP")
1010
raise SystemExit
1111

12+
1213
# main task raising an exception
1314
async def main():
1415
print("main start")
@@ -21,6 +22,7 @@ async def main():
2122
except ValueError as er:
2223
print("ValueError", er.args[0])
2324

25+
2426
# sub-task raising an exception
2527
async def task():
2628
print("task start")
@@ -40,6 +42,7 @@ async def main():
4042
except ValueError as er:
4143
print("ValueError", er.args[0])
4244

45+
4346
# main task raising an exception with sub-task not yet scheduled
4447
# TODO not currently working, task is never scheduled
4548
async def task():

tests/extmod/vfs_fat_fileio1.py

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414

1515
class RAMFS:
16-
1716
SEC_SIZE = 512
1817

1918
def __init__(self, blocks):

tests/extmod/vfs_fat_fileio2.py

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414

1515
class RAMFS:
16-
1716
SEC_SIZE = 512
1817

1918
def __init__(self, blocks):

tests/extmod/vfs_fat_more.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313

1414
class RAMFS:
15-
1615
SEC_SIZE = 512
1716

1817
def __init__(self, blocks):

tests/extmod/vfs_fat_oldproto.py

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414

1515
class RAMFS_OLD:
16-
1716
SEC_SIZE = 512
1817

1918
def __init__(self, blocks):

tests/extmod/vfs_fat_ramdisk.py

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414

1515
class RAMFS:
16-
1716
SEC_SIZE = 512
1817

1918
def __init__(self, blocks):

tests/extmod/vfs_fat_ramdisklarge.py

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515

1616
class RAMBDevSparse:
17-
1817
SEC_SIZE = 512
1918

2019
def __init__(self, blocks):

tests/extmod/websocket_basic.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
print("SKIP")
77
raise SystemExit
88

9+
910
# put raw data in the stream and do a websocket read
1011
def ws_read(msg, sz):
1112
ws = uwebsocket.websocket(uio.BytesIO(msg))

tests/import/module_getattr.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
except AttributeError:
99
pass
1010

11+
1112
# define __getattr__
1213
def __getattr__(attr):
1314
if attr == "does_not_exist":

tests/inlineasm/asmsum.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@micropython.asm_thumb
22
def asm_sum_words(r0, r1):
3-
43
# r0 = len
54
# r1 = ptr
65
# r2 = sum
@@ -25,7 +24,6 @@ def asm_sum_words(r0, r1):
2524

2625
@micropython.asm_thumb
2726
def asm_sum_bytes(r0, r1):
28-
2927
# r0 = len
3028
# r1 = ptr
3129
# r2 = sum

tests/micropython/const2.py

+4
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,23 @@
1111

1212
print(globals()["X"])
1313

14+
1415
# function name that matches a constant
1516
def X():
1617
print("function X", X)
1718

1819

1920
globals()["X"]()
2021

22+
2123
# arguments that match a constant
2224
def f(X, *Y, **Z):
2325
pass
2426

2527

2628
f(1)
2729

30+
2831
# class name that matches a constant
2932
class X:
3033
def f(self):
@@ -33,6 +36,7 @@ def f(self):
3336

3437
globals()["X"]().f()
3538

39+
3640
# constant within a class
3741
class A:
3842
C1 = const(4)

tests/micropython/heapalloc_yield_from.py

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import micropython
44

5+
56
# Yielding from a function generator
67
def sub_gen(a):
78
for i in range(a):
@@ -18,6 +19,7 @@ def gen(g):
1819
print(next(g))
1920
micropython.heap_unlock()
2021

22+
2123
# Yielding from a user iterator
2224
class G:
2325
def __init__(self):

tests/micropython/native_closure.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# test native emitter can handle closures correctly
22

3+
34
# basic closure
45
@micropython.native
56
def f():
@@ -15,6 +16,7 @@ def g():
1516

1617
print(f()())
1718

19+
1820
# closing over an argument
1921
@micropython.native
2022
def f(x):
@@ -28,6 +30,7 @@ def g():
2830

2931
print(f(2)())
3032

33+
3134
# closing over an argument and a normal local
3235
@micropython.native
3336
def f(x):

0 commit comments

Comments
 (0)