mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 06:50:05 +01:00
pre-commit: bump to latest ruff-format
And update our python files according to latest ruff format output. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1259>
This commit is contained in:
parent
e5e41ce7f5
commit
b347cc8691
4 changed files with 12 additions and 13 deletions
|
|
@ -7,7 +7,7 @@ repos:
|
||||||
- id: no-commit-to-branch
|
- id: no-commit-to-branch
|
||||||
args: ['--branch', 'main']
|
args: ['--branch', 'main']
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.8.1
|
rev: v0.12.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: ['--ignore=E741,E501', '--extend-exclude=subprojects', '.']
|
args: ['--ignore=E741,E501', '--extend-exclude=subprojects', '.']
|
||||||
|
|
|
||||||
|
|
@ -57,15 +57,15 @@ def test_matches_are_valid(quirksfile):
|
||||||
|
|
||||||
vid = section.get("MatchVendor")
|
vid = section.get("MatchVendor")
|
||||||
if vid is not None:
|
if vid is not None:
|
||||||
assert re.match(
|
assert re.match("0x[0-9A-F]{4}", vid), (
|
||||||
"0x[0-9A-F]{4}", vid
|
f"{quirksfile}: {name}: {vid} must be uppercase hex (0xAB12)"
|
||||||
), f"{quirksfile}: {name}: {vid} must be uppercase hex (0xAB12)"
|
)
|
||||||
|
|
||||||
pid = section.get("MatchProduct")
|
pid = section.get("MatchProduct")
|
||||||
if pid is not None:
|
if pid is not None:
|
||||||
assert re.match(
|
assert re.match("0x[0-9A-F]{4}", pid), (
|
||||||
"0x[0-9A-F]{4}", pid
|
f"{quirksfile}: {name}: {pid} must be uppercase hex (0xAB12)"
|
||||||
), f"{quirksfile}: {name}: {pid} must be uppercase hex (0xAB12)"
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_match_product_is_not_a_logitech_receiver(quirksfile):
|
def test_match_product_is_not_a_logitech_receiver(quirksfile):
|
||||||
|
|
@ -78,9 +78,9 @@ def test_match_product_is_not_a_logitech_receiver(quirksfile):
|
||||||
vid = int(section.get("MatchVendor", "0x0"), 16)
|
vid = int(section.get("MatchVendor", "0x0"), 16)
|
||||||
if vid == 0x046D:
|
if vid == 0x046D:
|
||||||
pid = int(section.get("MatchProduct", "0x0"), 16)
|
pid = int(section.get("MatchProduct", "0x0"), 16)
|
||||||
assert (
|
assert pid not in logitech_receivers, (
|
||||||
pid not in logitech_receivers
|
f"{quirksfile}: {name}: applies to a Logitech Receiver"
|
||||||
), f"{quirksfile}: {name}: applies to a Logitech Receiver"
|
)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ def main(argv):
|
||||||
print("")
|
print("")
|
||||||
continuation_count = 0
|
continuation_count = 0
|
||||||
|
|
||||||
fields.insert(0, f"{e.sec: 3d}.{e.usec//1000:03d}")
|
fields.insert(0, f"{e.sec: 3d}.{e.usec // 1000:03d}")
|
||||||
keys_down = [k.name for k, v in keystate.items() if v]
|
keys_down = [k.name for k, v in keystate.items() if v]
|
||||||
fields.append(", ".join(keys_down))
|
fields.append(", ".join(keys_down))
|
||||||
print(" | ".join(fields))
|
print(" | ".join(fields))
|
||||||
|
|
|
||||||
|
|
@ -145,8 +145,7 @@ class Device(libevdev.Device):
|
||||||
if not self.warned:
|
if not self.warned:
|
||||||
self.warned = True
|
self.warned = True
|
||||||
error(
|
error(
|
||||||
"\rThis tool cannot handle multiple fingers, "
|
"\rThis tool cannot handle multiple fingers, output will be invalid"
|
||||||
"output will be invalid"
|
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue