Enable the printf-string-formatting ruff rule and fix warnings (#2967)
This commit is contained in:
parent
b0222111f5
commit
1e6492d34a
|
|
@ -71,7 +71,7 @@ def get_hw_addr(ifname: str) -> str:
|
|||
import fcntl
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
ret = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', bytes(ifname, 'utf-8')[:15]))
|
||||
return ':'.join('%02x' % b for b in ret[18:24])
|
||||
return ':'.join(f'{b:02x}' for b in ret[18:24])
|
||||
|
||||
|
||||
def list_interfaces(skip_loopback: bool = True) -> dict[str, str]:
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ def _stylize_output(
|
|||
code_list = []
|
||||
|
||||
if text == '' and reset:
|
||||
return '\x1b[%sm' % '0'
|
||||
return '\x1b[0m'
|
||||
|
||||
code_list.append(foreground[str(fg)])
|
||||
|
||||
|
|
|
|||
|
|
@ -219,7 +219,6 @@ ignore = [
|
|||
"RUF015", # unnecessary-iterable-allocation-for-first-element
|
||||
"RUF039", # unraw-re-pattern
|
||||
"UP028", # yield-in-for-loop
|
||||
"UP031", # printf-string-formatting
|
||||
"UP037", # quoted-annotation
|
||||
"W191", # tab-indentation
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in New Issue