Skip to content

Commit 68e0dfc

Browse files
projectgusdpgeorge
authored andcommitted
all: Apply Ruff 0.11.6 reformatting changes.
Signed-off-by: Angus Gratton <[email protected]>
1 parent d887a02 commit 68e0dfc

File tree

24 files changed

+22
-37
lines changed

24 files changed

+22
-37
lines changed

micropython/aiorepl/aiorepl.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ async def task(g=None, prompt="--> "):
132132
continue
133133
if curs:
134134
# move cursor to end of the line
135-
sys.stdout.write("\x1B[{}C".format(curs))
135+
sys.stdout.write("\x1b[{}C".format(curs))
136136
curs = 0
137137
sys.stdout.write("\n")
138138
if cmd:
@@ -153,10 +153,10 @@ async def task(g=None, prompt="--> "):
153153
if curs:
154154
cmd = "".join((cmd[: -curs - 1], cmd[-curs:]))
155155
sys.stdout.write(
156-
"\x08\x1B[K"
156+
"\x08\x1b[K"
157157
) # move cursor back, erase to end of line
158158
sys.stdout.write(cmd[-curs:]) # redraw line
159-
sys.stdout.write("\x1B[{}D".format(curs)) # reset cursor location
159+
sys.stdout.write("\x1b[{}D".format(curs)) # reset cursor location
160160
else:
161161
cmd = cmd[:-1]
162162
sys.stdout.write("\x08 \x08")
@@ -207,21 +207,21 @@ async def task(g=None, prompt="--> "):
207207
elif key == "[D": # left
208208
if curs < len(cmd) - 1:
209209
curs += 1
210-
sys.stdout.write("\x1B")
210+
sys.stdout.write("\x1b")
211211
sys.stdout.write(key)
212212
elif key == "[C": # right
213213
if curs:
214214
curs -= 1
215-
sys.stdout.write("\x1B")
215+
sys.stdout.write("\x1b")
216216
sys.stdout.write(key)
217217
elif key == "[H": # home
218218
pcurs = curs
219219
curs = len(cmd)
220-
sys.stdout.write("\x1B[{}D".format(curs - pcurs)) # move cursor left
220+
sys.stdout.write("\x1b[{}D".format(curs - pcurs)) # move cursor left
221221
elif key == "[F": # end
222222
pcurs = curs
223223
curs = 0
224-
sys.stdout.write("\x1B[{}C".format(pcurs)) # move cursor right
224+
sys.stdout.write("\x1b[{}C".format(pcurs)) # move cursor right
225225
else:
226226
# sys.stdout.write("\\x")
227227
# sys.stdout.write(hex(c))
@@ -231,7 +231,7 @@ async def task(g=None, prompt="--> "):
231231
# inserting into middle of line
232232
cmd = "".join((cmd[:-curs], b, cmd[-curs:]))
233233
sys.stdout.write(cmd[-curs - 1 :]) # redraw line to end
234-
sys.stdout.write("\x1B[{}D".format(curs)) # reset cursor location
234+
sys.stdout.write("\x1b[{}D".format(curs)) # reset cursor location
235235
else:
236236
sys.stdout.write(b)
237237
cmd += b

micropython/drivers/imu/lsm9ds1/lsm9ds1.py

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
print("")
4444
time.sleep_ms(100)
4545
"""
46+
4647
import array
4748
from micropython import const
4849

micropython/drivers/radio/nrf24l01/nrf24l01.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""NRF24L01 driver for MicroPython
2-
"""
1+
"""NRF24L01 driver for MicroPython"""
32

43
from micropython import const
54
import utime

micropython/drivers/sensor/hts221/hts221.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(self, i2c, data_rate=1, address=0x5F):
5252

5353
# Set configuration register
5454
# Humidity and temperature average configuration
55-
self.bus.writeto_mem(self.slv_addr, 0x10, b"\x1B")
55+
self.bus.writeto_mem(self.slv_addr, 0x10, b"\x1b")
5656

5757
# Set control register
5858
# PD | BDU | ODR

micropython/drivers/sensor/lps22h/lps22h.py

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
print("Pressure: %.2f hPa Temperature: %.2f C"%(lps.pressure(), lps.temperature()))
3838
time.sleep_ms(10)
3939
"""
40+
4041
import machine
4142
from micropython import const
4243

micropython/espflash/espflash.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,22 @@ def _poll_reg(self, addr, flag, retry=10, delay=0.050):
113113
raise Exception(f"Register poll timeout. Addr: 0x{addr:02X} Flag: 0x{flag:02X}.")
114114

115115
def _write_slip(self, pkt):
116-
pkt = pkt.replace(b"\xDB", b"\xdb\xdd").replace(b"\xc0", b"\xdb\xdc")
117-
self.uart.write(b"\xC0" + pkt + b"\xC0")
116+
pkt = pkt.replace(b"\xdb", b"\xdb\xdd").replace(b"\xc0", b"\xdb\xdc")
117+
self.uart.write(b"\xc0" + pkt + b"\xc0")
118118
self._log(pkt)
119119

120120
def _read_slip(self):
121121
pkt = None
122122
# Find the packet start.
123-
if self.uart.read(1) == b"\xC0":
123+
if self.uart.read(1) == b"\xc0":
124124
pkt = bytearray()
125125
while True:
126126
b = self.uart.read(1)
127-
if b is None or b == b"\xC0":
127+
if b is None or b == b"\xc0":
128128
break
129129
pkt += b
130-
pkt = pkt.replace(b"\xDB\xDD", b"\xDB").replace(b"\xDB\xDC", b"\xC0")
131-
self._log(b"\xC0" + pkt + b"\xC0", False)
130+
pkt = pkt.replace(b"\xdb\xdd", b"\xdb").replace(b"\xdb\xdc", b"\xc0")
131+
self._log(b"\xc0" + pkt + b"\xc0", False)
132132
return pkt
133133

134134
def _strerror(self, err):
@@ -230,7 +230,7 @@ def flash_read_size(self):
230230
raise Exception(f"Unexpected flash size bits: 0x{flash_bits:02X}.")
231231

232232
flash_size = 2**flash_bits
233-
print(f"Flash size {flash_size/1024/1024} MBytes")
233+
print(f"Flash size {flash_size / 1024 / 1024} MBytes")
234234
return flash_size
235235

236236
def flash_attach(self):
@@ -265,7 +265,7 @@ def flash_write_file(self, path, blksize=0x1000):
265265
self.md5sum.update(buf)
266266
# The last data block should be padded to the block size with 0xFF bytes.
267267
if len(buf) < blksize:
268-
buf += b"\xFF" * (blksize - len(buf))
268+
buf += b"\xff" * (blksize - len(buf))
269269
checksum = self._checksum(buf)
270270
if seq % erase_blocks == 0:
271271
# print(f"Erasing {seq} -> {seq+erase_blocks}...")

micropython/lora/examples/reliable_delivery/sender.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def send(self, sensor_data, adjust_output_power=True):
149149
delta = time.ticks_diff(maybe_ack.ticks_ms, sent_at)
150150
print(
151151
f"ACKed with RSSI {rssi}, {delta}ms after sent "
152-
+ f"(skew {delta-ACK_DELAY_MS-ack_packet_ms}ms)"
152+
+ f"(skew {delta - ACK_DELAY_MS - ack_packet_ms}ms)"
153153
)
154154

155155
if adjust_output_power:

micropython/lora/examples/reliable_delivery/sender_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ async def send(self, sensor_data, adjust_output_power=True):
141141
delta = time.ticks_diff(maybe_ack.ticks_ms, sent_at)
142142
print(
143143
f"ACKed with RSSI {rssi}, {delta}ms after sent "
144-
+ f"(skew {delta-ACK_DELAY_MS-ack_packet_ms}ms)"
144+
+ f"(skew {delta - ACK_DELAY_MS - ack_packet_ms}ms)"
145145
)
146146

147147
if adjust_output_power:

micropython/senml/examples/actuator.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from senml import *
2827

2928

micropython/senml/examples/base.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from senml import *
2827
import time
2928

micropython/senml/examples/basic.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from senml import *
2827
import time
2928

micropython/senml/examples/basic2.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from senml import *
2827
import time
2928

micropython/senml/examples/basic_cbor.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from senml import *
2827
import time
2928
import cbor2

micropython/senml/examples/custom_record.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from senml import *
2827

2928
import time

micropython/senml/examples/gateway.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from senml import *
2827
import time
2928

micropython/senml/examples/gateway_actuators.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from senml import *
2827

2928

micropython/senml/examples/supported_data_types.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from senml import *
2827
import time
2928

micropython/senml/senml/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from .senml_base import SenmlBase
2827
from .senml_pack import SenmlPack
2928
from .senml_record import SenmlRecord

micropython/senml/senml/senml_pack.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from senml.senml_record import SenmlRecord
2827
from senml.senml_base import SenmlBase
2928
import json

micropython/senml/senml/senml_record.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
import binascii
2827
from senml.senml_base import SenmlBase
2928

python-ecosys/cbor2/cbor2/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
from ._decoder import CBORDecoder
2827
from ._decoder import load
2928
from ._decoder import loads

python-ecosys/cbor2/cbor2/_decoder.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
import io
2827
import struct
2928

python-ecosys/cbor2/cbor2/_encoder.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
import io
2827
import struct
2928

python-ecosys/cbor2/examples/cbor_test.py

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
THE SOFTWARE.
2424
"""
2525

26-
2726
import cbor2
2827

2928
input = [

0 commit comments

Comments
 (0)