From 120a42f1b05cb4423bb3dff9a64dc712c5a35821 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 23 Nov 2024 18:45:57 +0000 Subject: [PATCH] nix: migrate to 'ruff' formatting Having just the one tool is better. Incidentally, this fixes the ternary formatting, which was messed up in recent `black` versions. --- .isort.cfg | 2 -- 2020/d17/ex1/ex1.py | 1 - 2020/d17/ex2/ex2.py | 1 - 2021/d25/ex1/ex1.py | 4 +++- 2022/d07/ex1/ex1.py | 1 - 2022/d07/ex2/ex2.py | 1 - flake.nix | 15 +++++---------- 7 files changed, 8 insertions(+), 17 deletions(-) delete mode 100644 .isort.cfg diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index b9fb3f3..0000000 --- a/.isort.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[settings] -profile=black diff --git a/2020/d17/ex1/ex1.py b/2020/d17/ex1/ex1.py index dd9efee..03bf46b 100755 --- a/2020/d17/ex1/ex1.py +++ b/2020/d17/ex1/ex1.py @@ -41,7 +41,6 @@ def update(grid: Grid) -> Grid: def solve(grid: Grid) -> int: - for __ in range(6): grid = update(grid) diff --git a/2020/d17/ex2/ex2.py b/2020/d17/ex2/ex2.py index 8589288..ba979a1 100755 --- a/2020/d17/ex2/ex2.py +++ b/2020/d17/ex2/ex2.py @@ -41,7 +41,6 @@ def update(grid: Grid) -> Grid: def solve(grid: Grid) -> int: - for __ in range(6): grid = update(grid) diff --git a/2021/d25/ex1/ex1.py b/2021/d25/ex1/ex1.py index 6a2aef8..fe8132c 100755 --- a/2021/d25/ex1/ex1.py +++ b/2021/d25/ex1/ex1.py @@ -64,7 +64,9 @@ def solve(input: List[str]) -> int: ( "v" if Point(x, y) in map.south - else ">" if Point(x, y) in map.east else "." + else ">" + if Point(x, y) in map.east + else "." ) for y in range(map.dimensions.y) ) diff --git a/2022/d07/ex1/ex1.py b/2022/d07/ex1/ex1.py index 43e49f1..fcd28d4 100755 --- a/2022/d07/ex1/ex1.py +++ b/2022/d07/ex1/ex1.py @@ -8,7 +8,6 @@ FileSystem = dict[str, Union[int, "FileSystem"]] def solve(input: list[str]) -> int: def build_tree(input: list[str], i: int = 0) -> tuple[FileSystem, int]: - fs: FileSystem = {} while i < len(input): diff --git a/2022/d07/ex2/ex2.py b/2022/d07/ex2/ex2.py index 9886cf0..6a6d447 100755 --- a/2022/d07/ex2/ex2.py +++ b/2022/d07/ex2/ex2.py @@ -8,7 +8,6 @@ FileSystem = dict[str, Union[int, "FileSystem"]] def solve(input: list[str]) -> int: def build_tree(input: list[str], i: int = 0) -> tuple[FileSystem, int]: - fs: FileSystem = {} while i < len(input): diff --git a/flake.nix b/flake.nix index 36616f8..066f6db 100644 --- a/flake.nix +++ b/flake.nix @@ -39,17 +39,13 @@ src = self; hooks = { - black = { - enable = true; - }; - - isort = { - enable = true; - }; - nixpkgs-fmt = { enable = true; }; + + ruff-format = { + enable = true; + }; }; }; }; @@ -57,12 +53,11 @@ devShell = pkgs.mkShell { buildInputs = with pkgs; [ (python3.withPackages (ps: with ps; [ - black - isort mypy z3 ])) pyright + ruff ]; inherit (self.checks.${system}.pre-commit) shellHook;