mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-25 16:22:05 +08:00
ruff: check shadowed variables (#32851)
* check shadowed variables
* fix
old-commit-hash: 69d4b0fdf0
This commit is contained in:
@@ -33,7 +33,7 @@ repos:
|
||||
- -L bu,ro,te,ue,alo,hda,ois,nam,nams,ned,som,parm,setts,inout,warmup,bumb,nd,sie,preints,whit,indexIn
|
||||
- --builtins clear,rare,informal,usage,code,names,en-GB_to_en-US
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.4.10
|
||||
rev: v0.5.0
|
||||
hooks:
|
||||
- id: ruff
|
||||
exclude: '^(third_party/)|(msgq/)|(panda/)|(rednose/)|(rednose_repo/)|(tinygrad/)|(tinygrad_repo/)|(teleoprtc/)|(teleoprtc_repo/)'
|
||||
|
||||
+2
-1
@@ -209,7 +209,8 @@ lint.select = [
|
||||
"UP", # pyupgrade
|
||||
"TRY302", "TRY400", "TRY401", # try/excepts
|
||||
"RUF008", "RUF100",
|
||||
"TID251"
|
||||
"TID251",
|
||||
"PLR1704",
|
||||
]
|
||||
lint.ignore = [
|
||||
"E741",
|
||||
|
||||
@@ -23,12 +23,12 @@ def can_printer(bus, max_msg, addr, ascii_decode):
|
||||
if time.monotonic() - lp > 0.1:
|
||||
dd = chr(27) + "[2J"
|
||||
dd += f"{time.monotonic() - start:5.2f}\n"
|
||||
for addr in sorted(msgs.keys()):
|
||||
a = f"\"{msgs[addr][-1].decode('ascii', 'backslashreplace')}\"" if ascii_decode else ""
|
||||
x = binascii.hexlify(msgs[addr][-1]).decode('ascii')
|
||||
freq = len(msgs[addr]) / (time.monotonic() - start)
|
||||
if max_msg is None or addr < max_msg:
|
||||
dd += "%04X(%4d)(%6d)(%3dHz) %s %s\n" % (addr, addr, len(msgs[addr]), freq, x.ljust(20), a)
|
||||
for _addr in sorted(msgs.keys()):
|
||||
a = f"\"{msgs[_addr][-1].decode('ascii', 'backslashreplace')}\"" if ascii_decode else ""
|
||||
x = binascii.hexlify(msgs[_addr][-1]).decode('ascii')
|
||||
freq = len(msgs[_addr]) / (time.monotonic() - start)
|
||||
if max_msg is None or _addr < max_msg:
|
||||
dd += "%04X(%4d)(%6d)(%3dHz) %s %s\n" % (_addr, _addr, len(msgs[_addr]), freq, x.ljust(20), a)
|
||||
print(dd)
|
||||
lp = time.monotonic()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user