nix: migrate to 'ruff'
Having just the one tool is better. Incidentally, this fixes the ternary formatting, which was messed up in recent `black` versions.
This commit is contained in:
parent
f9fc9fbd6b
commit
741bb33544
8 changed files with 20 additions and 17 deletions
|
|
@ -1,2 +0,0 @@
|
||||||
[settings]
|
|
||||||
profile=black
|
|
||||||
|
|
@ -41,7 +41,6 @@ def update(grid: Grid) -> Grid:
|
||||||
|
|
||||||
|
|
||||||
def solve(grid: Grid) -> int:
|
def solve(grid: Grid) -> int:
|
||||||
|
|
||||||
for __ in range(6):
|
for __ in range(6):
|
||||||
grid = update(grid)
|
grid = update(grid)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ def update(grid: Grid) -> Grid:
|
||||||
|
|
||||||
|
|
||||||
def solve(grid: Grid) -> int:
|
def solve(grid: Grid) -> int:
|
||||||
|
|
||||||
for __ in range(6):
|
for __ in range(6):
|
||||||
grid = update(grid)
|
grid = update(grid)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,9 @@ def solve(input: List[str]) -> int:
|
||||||
(
|
(
|
||||||
"v"
|
"v"
|
||||||
if Point(x, y) in map.south
|
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)
|
for y in range(map.dimensions.y)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ FileSystem = dict[str, Union[int, "FileSystem"]]
|
||||||
|
|
||||||
def solve(input: list[str]) -> int:
|
def solve(input: list[str]) -> int:
|
||||||
def build_tree(input: list[str], i: int = 0) -> tuple[FileSystem, int]:
|
def build_tree(input: list[str], i: int = 0) -> tuple[FileSystem, int]:
|
||||||
|
|
||||||
fs: FileSystem = {}
|
fs: FileSystem = {}
|
||||||
|
|
||||||
while i < len(input):
|
while i < len(input):
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ FileSystem = dict[str, Union[int, "FileSystem"]]
|
||||||
|
|
||||||
def solve(input: list[str]) -> int:
|
def solve(input: list[str]) -> int:
|
||||||
def build_tree(input: list[str], i: int = 0) -> tuple[FileSystem, int]:
|
def build_tree(input: list[str], i: int = 0) -> tuple[FileSystem, int]:
|
||||||
|
|
||||||
fs: FileSystem = {}
|
fs: FileSystem = {}
|
||||||
|
|
||||||
while i < len(input):
|
while i < len(input):
|
||||||
|
|
|
||||||
19
flake.nix
19
flake.nix
|
|
@ -39,17 +39,17 @@
|
||||||
src = self;
|
src = self;
|
||||||
|
|
||||||
hooks = {
|
hooks = {
|
||||||
black = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
isort = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs-fmt = {
|
nixpkgs-fmt = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ruff = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
ruff-format = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -57,12 +57,11 @@
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
(python3.withPackages (ps: with ps; [
|
(python3.withPackages (ps: with ps; [
|
||||||
black
|
|
||||||
isort
|
|
||||||
mypy
|
mypy
|
||||||
z3
|
z3
|
||||||
]))
|
]))
|
||||||
pyright
|
pyright
|
||||||
|
ruff
|
||||||
];
|
];
|
||||||
|
|
||||||
inherit (self.checks.${system}.pre-commit) shellHook;
|
inherit (self.checks.${system}.pre-commit) shellHook;
|
||||||
|
|
|
||||||
8
ruff.toml
Normal file
8
ruff.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
[lint]
|
||||||
|
extend-select = [
|
||||||
|
"I", # Import sorting is a lint check
|
||||||
|
]
|
||||||
|
ignore = [
|
||||||
|
"E731", # Assigning lambdas is sometimes more readable
|
||||||
|
"E741", # Ambiguous variable names are good enough actually
|
||||||
|
]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue