kopia lustrzana https://github.com/micropython/micropython-lib
top: Bump the Ruff version to 0.11.6.
With small code fixes to match. Signed-off-by: Angus Gratton <angus@redyak.com.au>pull/1001/head
rodzic
f8c8875e25
commit
d887a021e8
|
@ -6,6 +6,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: pip install --user ruff==0.1.2
|
# Version should be kept in sync with .pre-commit_config.yaml & also micropython
|
||||||
|
- run: pip install --user ruff==0.11.6
|
||||||
- run: ruff check --output-format=github .
|
- run: ruff check --output-format=github .
|
||||||
- run: ruff format --diff .
|
- run: ruff format --diff .
|
||||||
|
|
|
@ -8,7 +8,8 @@ repos:
|
||||||
verbose: true
|
verbose: true
|
||||||
stages: [commit-msg]
|
stages: [commit-msg]
|
||||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||||
rev: v0.1.2
|
# Version should be kept in sync with .github/workflows/ruff.yml & also micropython
|
||||||
|
rev: v0.11.6
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
id: ruff-format
|
id: ruff-format
|
||||||
|
|
|
@ -88,7 +88,7 @@ class FileClient:
|
||||||
|
|
||||||
await self._command(_COMMAND_SEND, path.encode())
|
await self._command(_COMMAND_SEND, path.encode())
|
||||||
|
|
||||||
with open(dest, "wb") as f: # noqa: ASYNC101
|
with open(dest, "wb") as f: # noqa: ASYNC230
|
||||||
total = 0
|
total = 0
|
||||||
buf = bytearray(self._channel.our_mtu)
|
buf = bytearray(self._channel.our_mtu)
|
||||||
mv = memoryview(buf)
|
mv = memoryview(buf)
|
||||||
|
|
|
@ -83,7 +83,7 @@ async def l2cap_task(connection):
|
||||||
|
|
||||||
if send_file:
|
if send_file:
|
||||||
print("Sending:", send_file)
|
print("Sending:", send_file)
|
||||||
with open(send_file, "rb") as f: # noqa: ASYNC101
|
with open(send_file, "rb") as f: # noqa: ASYNC230
|
||||||
buf = bytearray(channel.peer_mtu)
|
buf = bytearray(channel.peer_mtu)
|
||||||
mv = memoryview(buf)
|
mv = memoryview(buf)
|
||||||
while n := f.readinto(buf):
|
while n := f.readinto(buf):
|
||||||
|
|
|
@ -331,8 +331,7 @@ class WM8960:
|
||||||
sysclk = 11289600
|
sysclk = 11289600
|
||||||
else:
|
else:
|
||||||
sysclk = 12288000
|
sysclk = 12288000
|
||||||
if sysclk < sample_rate * 256:
|
sysclk = max(sysclk, sample_rate * 256)
|
||||||
sysclk = sample_rate * 256
|
|
||||||
if mclk_freq is None:
|
if mclk_freq is None:
|
||||||
mclk_freq = sysclk
|
mclk_freq = sysclk
|
||||||
else: # sysclk_source == SYSCLK_MCLK
|
else: # sysclk_source == SYSCLK_MCLK
|
||||||
|
@ -691,10 +690,8 @@ class WM8960:
|
||||||
def alc_gain(self, target=-12, max_gain=30, min_gain=-17.25, noise_gate=-78):
|
def alc_gain(self, target=-12, max_gain=30, min_gain=-17.25, noise_gate=-78):
|
||||||
def limit(value, minval, maxval):
|
def limit(value, minval, maxval):
|
||||||
value = int(value)
|
value = int(value)
|
||||||
if value < minval:
|
value = max(value, minval)
|
||||||
value = minval
|
value = min(value, maxval)
|
||||||
if value > maxval:
|
|
||||||
value = maxval
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
target = limit((16 + (target * 2) // 3), 0, 15)
|
target = limit((16 + (target * 2) // 3), 0, 15)
|
||||||
|
@ -718,8 +715,7 @@ class WM8960:
|
||||||
while value > 1:
|
while value > 1:
|
||||||
value >>= 1
|
value >>= 1
|
||||||
lb += 1
|
lb += 1
|
||||||
if lb > limit:
|
lb = min(lb, limit)
|
||||||
lb = limit
|
|
||||||
return lb
|
return lb
|
||||||
|
|
||||||
attack = logb(attack / 6, 7)
|
attack = logb(attack / 6, 7)
|
||||||
|
|
|
@ -189,10 +189,8 @@ class LCD160CR:
|
||||||
c[3] = h - 1
|
c[3] = h - 1
|
||||||
else:
|
else:
|
||||||
if c[0] == c[2]:
|
if c[0] == c[2]:
|
||||||
if c[1] < 0:
|
c[1] = max(c[1], 0)
|
||||||
c[1] = 0
|
c[3] = max(c[3], 0)
|
||||||
if c[3] < 0:
|
|
||||||
c[3] = 0
|
|
||||||
else:
|
else:
|
||||||
if c[3] < c[1]:
|
if c[3] < c[1]:
|
||||||
c[0], c[2] = c[2], c[0]
|
c[0], c[2] = c[2], c[0]
|
||||||
|
|
|
@ -64,7 +64,7 @@ ignore = [
|
||||||
"ISC003", # micropython does not support implicit concatenation of f-strings
|
"ISC003", # micropython does not support implicit concatenation of f-strings
|
||||||
"PIE810", # micropython does not support passing tuples to .startswith or .endswith
|
"PIE810", # micropython does not support passing tuples to .startswith or .endswith
|
||||||
"PLC1901",
|
"PLC1901",
|
||||||
"PLR1701",
|
"PLR1704", # sometimes desirable to redefine an argument to save code size
|
||||||
"PLR1714",
|
"PLR1714",
|
||||||
"PLR5501",
|
"PLR5501",
|
||||||
"PLW0602",
|
"PLW0602",
|
||||||
|
@ -72,6 +72,7 @@ ignore = [
|
||||||
"PLW2901",
|
"PLW2901",
|
||||||
"RUF012",
|
"RUF012",
|
||||||
"RUF100",
|
"RUF100",
|
||||||
|
"SIM101",
|
||||||
"W191", # tab-indent, redundant when using formatter
|
"W191", # tab-indent, redundant when using formatter
|
||||||
]
|
]
|
||||||
line-length = 99
|
line-length = 99
|
||||||
|
|
Ładowanie…
Reference in New Issue