diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index de3e1c2b..66709abd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,3 +11,4 @@ repos: hooks: - id: ruff args: ['--ignore=E741,E501'] + - id: ruff-format diff --git a/test/test_libwacom.py b/test/test_libwacom.py index e123985b..5d344a0f 100644 --- a/test/test_libwacom.py +++ b/test/test_libwacom.py @@ -39,7 +39,9 @@ def add_to_config(self, config: ConfigParser): @classmethod def generic_pen(cls) -> "StylusEntry": - return cls(id="0x0:0xfffff", name="General Pen", paired_stylus_ids=["0x0:0xffffe"]) + return cls( + id="0x0:0xfffff", name="General Pen", paired_stylus_ids=["0x0:0xffffe"] + ) @classmethod def generic_eraser(cls) -> "StylusEntry": diff --git a/tools/clean_svg.py b/tools/clean_svg.py index 612bdfc1..02e70297 100755 --- a/tools/clean_svg.py +++ b/tools/clean_svg.py @@ -304,11 +304,12 @@ def clean_svg(root, tabletname): if __name__ == "__main__": parser = ArgumentParser(description="Clean SVG files for libwacom") parser.add_argument( - "--ignore-missing", action="store_true", default=False, help="Ignore .tablet files without a Layout" - ) - parser.add_argument( - "filename", type=str, help="SVG file to clean", metavar="FILE" + "--ignore-missing", + action="store_true", + default=False, + help="Ignore .tablet files without a Layout", ) + parser.add_argument("filename", type=str, help="SVG file to clean", metavar="FILE") parser.add_argument( "tabletname", type=str, @@ -321,17 +322,19 @@ def clean_svg(root, tabletname): tabletname = args.tabletname if args.filename.endswith(".tablet"): import configparser + config = configparser.ConfigParser() config.read(args.filename) try: svgname = config["Device"]["Layout"] except KeyError: - print(f"{args.filename} does not specify a layout, skipping", file=sys.stderr) + print( + f"{args.filename} does not specify a layout, skipping", file=sys.stderr + ) sys.exit(0 if args.ignore_missing else 77) svgfile = Path(args.filename).parent / "layouts" / svgname tabletname = config["Device"]["Name"] - ET.register_namespace("", NAMESPACE) try: tree = ET.parse(svgfile) diff --git a/tools/show-stylus.py b/tools/show-stylus.py index cd010c89..26be13c4 100755 --- a/tools/show-stylus.py +++ b/tools/show-stylus.py @@ -38,23 +38,23 @@ class Ansi: - clearline = "\x1B[K" + clearline = "\x1b[K" @classmethod def up(cls, count): - return f"\x1B[{count}A" + return f"\x1b[{count}A" @classmethod def down(cls, count): - return f"\x1B[{count}B" + return f"\x1b[{count}B" @classmethod def right(cls, count): - return f"\x1B[{count}C" + return f"\x1b[{count}C" @classmethod def left(cls, count): - return f"\x1B[{count}D" + return f"\x1b[{count}D" def die(msg): @@ -161,7 +161,7 @@ def load_data_files(): if len(ids) > 1: _, sid = map(lambda x: int(x, 16), ids) else: - _ = 0x56a # vid + _ = 0x56A # vid sid = int(ids[0], 16) # FIXME: vendor should be used here, let's do that when we figure out # who needs it.