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/2019/d03/ex2/ex2.py b/2019/d03/ex2/ex2.py index a0abfac..077f2e3 100755 --- a/2019/d03/ex2/ex2.py +++ b/2019/d03/ex2/ex2.py @@ -2,7 +2,7 @@ import sys from fractions import Fraction -from typing import Dict, List, NamedTuple, Optional +from typing import List, NamedTuple, Optional class Point(NamedTuple): diff --git a/2019/d04/ex1/ex1.py b/2019/d04/ex1/ex1.py index 460b7d8..49bb589 100755 --- a/2019/d04/ex1/ex1.py +++ b/2019/d04/ex1/ex1.py @@ -7,7 +7,7 @@ def is_valid_password(p: int) -> bool: digits = str(p) def has_adjacent_digit(): - for (a, b) in zip(digits, digits[1:]): + for a, b in zip(digits, digits[1:]): if a == b: return True return False diff --git a/2019/d04/ex2/ex2.py b/2019/d04/ex2/ex2.py index 883abf9..a54ccfe 100755 --- a/2019/d04/ex2/ex2.py +++ b/2019/d04/ex2/ex2.py @@ -8,7 +8,7 @@ def is_valid_password(p: int) -> bool: def has_unique_adjacent_digit(): counts = {d: 0 for d in range(10)} - for (a, b) in zip(digits, digits[1:]): + for a, b in zip(digits, digits[1:]): if a == b: counts[int(a)] += 1 return any(count == 1 for count in counts.values()) diff --git a/2019/d05/ex1/ex1.py b/2019/d05/ex1/ex1.py index 09dac02..fe46167 100755 --- a/2019/d05/ex1/ex1.py +++ b/2019/d05/ex1/ex1.py @@ -1,7 +1,5 @@ #!/usr/bin/env python -import sys -from copy import deepcopy from enum import IntEnum from typing import List, NamedTuple diff --git a/2019/d07/ex2/ex2.py b/2019/d07/ex2/ex2.py index c239eaa..8f5e209 100755 --- a/2019/d07/ex2/ex2.py +++ b/2019/d07/ex2/ex2.py @@ -5,7 +5,7 @@ import sys from copy import deepcopy from dataclasses import dataclass, field from enum import IntEnum -from typing import Callable, List, NamedTuple +from typing import List, NamedTuple class ParameterMode(IntEnum): diff --git a/2019/d09/ex1/ex1.py b/2019/d09/ex1/ex1.py index 6f54dec..9a2df1e 100755 --- a/2019/d09/ex1/ex1.py +++ b/2019/d09/ex1/ex1.py @@ -1,11 +1,10 @@ #!/usr/bin/env python -import itertools import sys from copy import deepcopy from dataclasses import dataclass, field from enum import IntEnum -from typing import Callable, List, NamedTuple +from typing import List, NamedTuple class ParameterMode(IntEnum): diff --git a/2019/d09/ex2/ex2.py b/2019/d09/ex2/ex2.py index 598f628..7c8be67 100755 --- a/2019/d09/ex2/ex2.py +++ b/2019/d09/ex2/ex2.py @@ -1,11 +1,10 @@ #!/usr/bin/env python -import itertools import sys from copy import deepcopy from dataclasses import dataclass, field from enum import IntEnum -from typing import Callable, List, NamedTuple +from typing import List, NamedTuple class ParameterMode(IntEnum): diff --git a/2019/d10/ex2/ex2.py b/2019/d10/ex2/ex2.py index 60f115a..480234e 100755 --- a/2019/d10/ex2/ex2.py +++ b/2019/d10/ex2/ex2.py @@ -4,7 +4,6 @@ import sys from cmath import phase from itertools import groupby from math import gcd, pi -from pprint import pprint from typing import NamedTuple, Set, Tuple diff --git a/2019/d13/ex1/ex1.py b/2019/d13/ex1/ex1.py index 1bf7e8c..924ffb7 100755 --- a/2019/d13/ex1/ex1.py +++ b/2019/d13/ex1/ex1.py @@ -3,7 +3,7 @@ import sys from dataclasses import dataclass, field from enum import IntEnum -from typing import Dict, Iterable, List, NamedTuple, Tuple, TypeVar +from typing import Iterable, List, NamedTuple, Tuple, TypeVar class ParameterMode(IntEnum): diff --git a/2019/d13/ex2/ex2.py b/2019/d13/ex2/ex2.py index 9fb669f..af0d24f 100755 --- a/2019/d13/ex2/ex2.py +++ b/2019/d13/ex2/ex2.py @@ -3,7 +3,7 @@ import sys from dataclasses import dataclass, field from enum import IntEnum -from typing import Dict, Iterable, List, NamedTuple, Tuple, TypeVar +from typing import Iterable, List, NamedTuple, Tuple, TypeVar class ParameterMode(IntEnum): diff --git a/2019/d16/ex2/ex2.py b/2019/d16/ex2/ex2.py index a13a0bf..317d157 100755 --- a/2019/d16/ex2/ex2.py +++ b/2019/d16/ex2/ex2.py @@ -2,8 +2,6 @@ import sys from functools import reduce -from itertools import chain, cycle -from typing import Iterable, List def main() -> None: diff --git a/2019/d19/ex2/ex2.py b/2019/d19/ex2/ex2.py index 138e45b..8dd132c 100755 --- a/2019/d19/ex2/ex2.py +++ b/2019/d19/ex2/ex2.py @@ -4,7 +4,7 @@ import sys from copy import deepcopy from dataclasses import dataclass, field from enum import IntEnum -from typing import Iterator, List, NamedTuple, Tuple +from typing import List, NamedTuple class ParameterMode(IntEnum): diff --git a/2020/d07/ex2/ex2.py b/2020/d07/ex2/ex2.py index 107d737..a955087 100755 --- a/2020/d07/ex2/ex2.py +++ b/2020/d07/ex2/ex2.py @@ -2,8 +2,6 @@ import re import sys -from collections import defaultdict -from copy import deepcopy from dataclasses import dataclass from typing import Dict, List, Set, Tuple 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/2020/d18/ex2/ex2.py b/2020/d18/ex2/ex2.py index 94f13ed..a83161c 100755 --- a/2020/d18/ex2/ex2.py +++ b/2020/d18/ex2/ex2.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -from typing import Callable, Dict, List +from typing import List """ E : T [ * T ]* diff --git a/2020/d20/ex2/ex2.py b/2020/d20/ex2/ex2.py index e923806..c9e06a7 100755 --- a/2020/d20/ex2/ex2.py +++ b/2020/d20/ex2/ex2.py @@ -5,7 +5,6 @@ import itertools import math import sys from collections import defaultdict -from copy import deepcopy from typing import Dict, Iterator, List, Set, Tuple Tile = List[List[str]] diff --git a/2020/d23/ex1/ex1.py b/2020/d23/ex1/ex1.py index faae133..2d7ff20 100755 --- a/2020/d23/ex1/ex1.py +++ b/2020/d23/ex1/ex1.py @@ -2,7 +2,7 @@ import itertools import sys -from typing import List, Tuple +from typing import List def solve(circle: List[int]) -> int: diff --git a/2020/d23/ex2/ex2.py b/2020/d23/ex2/ex2.py index 90c8c81..8993dcb 100755 --- a/2020/d23/ex2/ex2.py +++ b/2020/d23/ex2/ex2.py @@ -2,7 +2,7 @@ import itertools import sys -from typing import List, Tuple +from typing import List def solve(circle: List[int]) -> int: diff --git a/2020/d24/ex2/ex2.py b/2020/d24/ex2/ex2.py index 17728b2..ef749f9 100755 --- a/2020/d24/ex2/ex2.py +++ b/2020/d24/ex2/ex2.py @@ -3,7 +3,6 @@ import itertools import sys from collections import defaultdict -from copy import deepcopy from typing import Dict, Iterator, List, Tuple Offset = Tuple[int, int] diff --git a/2021/d01/ex1/ex1.py b/2021/d01/ex1/ex1.py index 24cc5d1..3853ce4 100755 --- a/2021/d01/ex1/ex1.py +++ b/2021/d01/ex1/ex1.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from typing import List diff --git a/2021/d02/ex1/ex1.py b/2021/d02/ex1/ex1.py index f28dd77..f891b43 100755 --- a/2021/d02/ex1/ex1.py +++ b/2021/d02/ex1/ex1.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from typing import List diff --git a/2021/d02/ex2/ex2.py b/2021/d02/ex2/ex2.py index b48215c..8843639 100755 --- a/2021/d02/ex2/ex2.py +++ b/2021/d02/ex2/ex2.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from typing import List diff --git a/2021/d03/ex1/ex1.py b/2021/d03/ex1/ex1.py index ed2eeb7..7519004 100755 --- a/2021/d03/ex1/ex1.py +++ b/2021/d03/ex1/ex1.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from typing import List diff --git a/2021/d03/ex2/ex2.py b/2021/d03/ex2/ex2.py index 9c6515b..acf0ff2 100755 --- a/2021/d03/ex2/ex2.py +++ b/2021/d03/ex2/ex2.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from copy import deepcopy from typing import List diff --git a/2021/d06/ex1/ex1.py b/2021/d06/ex1/ex1.py index 5eec9ce..65abb44 100755 --- a/2021/d06/ex1/ex1.py +++ b/2021/d06/ex1/ex1.py @@ -3,7 +3,6 @@ import itertools import sys from collections import Counter -from dataclasses import dataclass from typing import Iterator, List, TypeVar T = TypeVar("T") diff --git a/2021/d06/ex2/ex2.py b/2021/d06/ex2/ex2.py index 2e64423..bb40805 100755 --- a/2021/d06/ex2/ex2.py +++ b/2021/d06/ex2/ex2.py @@ -3,7 +3,6 @@ import itertools import sys from collections import Counter -from dataclasses import dataclass from typing import Iterator, List, TypeVar T = TypeVar("T") diff --git a/2021/d07/ex1/ex1.py b/2021/d07/ex1/ex1.py index 4205009..2b8a8a9 100755 --- a/2021/d07/ex1/ex1.py +++ b/2021/d07/ex1/ex1.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from typing import List diff --git a/2021/d07/ex2/ex2.py b/2021/d07/ex2/ex2.py index 56b818c..8eec5ef 100755 --- a/2021/d07/ex2/ex2.py +++ b/2021/d07/ex2/ex2.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from math import ceil, floor from typing import List diff --git a/2021/d08/ex2/ex2.py b/2021/d08/ex2/ex2.py index 1553e29..c22b23b 100755 --- a/2021/d08/ex2/ex2.py +++ b/2021/d08/ex2/ex2.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from dataclasses import dataclass from typing import Dict, List, Set diff --git a/2021/d09/ex1/ex1.py b/2021/d09/ex1/ex1.py index cf7d7d6..e84e893 100755 --- a/2021/d09/ex1/ex1.py +++ b/2021/d09/ex1/ex1.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from typing import Iterator, List, Tuple diff --git a/2021/d09/ex2/ex2.py b/2021/d09/ex2/ex2.py index 451883a..0311995 100755 --- a/2021/d09/ex2/ex2.py +++ b/2021/d09/ex2/ex2.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from typing import Iterator, List, Tuple diff --git a/2021/d10/ex1/ex1.py b/2021/d10/ex1/ex1.py index 4667d43..6770222 100755 --- a/2021/d10/ex1/ex1.py +++ b/2021/d10/ex1/ex1.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from typing import List, Optional, cast diff --git a/2021/d10/ex2/ex2.py b/2021/d10/ex2/ex2.py index 27de8ac..d100b0f 100755 --- a/2021/d10/ex2/ex2.py +++ b/2021/d10/ex2/ex2.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from typing import Iterator, List, Optional diff --git a/2021/d11/ex1/ex1.py b/2021/d11/ex1/ex1.py index 19669b3..c6bf0be 100755 --- a/2021/d11/ex1/ex1.py +++ b/2021/d11/ex1/ex1.py @@ -2,7 +2,6 @@ import itertools import sys -from copy import deepcopy from typing import Iterator, List, Set, Tuple Grid = List[List[int]] @@ -39,7 +38,7 @@ def solve(input: List[str]) -> int: # Second step, do flashes has_flashed: Set[Point] = set() while len(flashes := (excited(levels) - has_flashed)) > 0: - for (i, j) in flashes: + for i, j in flashes: has_flashed.add((i, j)) for x, y in neighbours_of((i, j)): levels[x][y] += 1 diff --git a/2021/d11/ex2/ex2.py b/2021/d11/ex2/ex2.py index 0dee9eb..8f95f55 100755 --- a/2021/d11/ex2/ex2.py +++ b/2021/d11/ex2/ex2.py @@ -2,7 +2,6 @@ import itertools import sys -from copy import deepcopy from typing import Iterator, List, Set, Tuple Grid = List[List[int]] @@ -39,7 +38,7 @@ def solve(input: List[str]) -> int: # Second step, do flashes has_flashed: Set[Point] = set() while len(flashes := (excited(levels) - has_flashed)) > 0: - for (i, j) in flashes: + for i, j in flashes: has_flashed.add((i, j)) for x, y in neighbours_of((i, j)): levels[x][y] += 1 diff --git a/2021/d12/ex1/ex1.py b/2021/d12/ex1/ex1.py index 4d0cacf..6108876 100755 --- a/2021/d12/ex1/ex1.py +++ b/2021/d12/ex1/ex1.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from collections import defaultdict from typing import Dict, List, Set @@ -12,7 +11,7 @@ def solve(input: List[str]) -> int: def parse() -> Map: res: Map = defaultdict(set) - for (start, to) in map(lambda s: s.split("-"), input): + for start, to in map(lambda s: s.split("-"), input): res[start].add(to) res[to].add(start) diff --git a/2021/d12/ex2/ex2.py b/2021/d12/ex2/ex2.py index 69d9aa9..b30d9b8 100755 --- a/2021/d12/ex2/ex2.py +++ b/2021/d12/ex2/ex2.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import itertools import sys from collections import defaultdict from typing import Dict, List, Set @@ -12,7 +11,7 @@ def solve(input: List[str]) -> int: def parse() -> Map: res: Map = defaultdict(set) - for (start, to) in map(lambda s: s.split("-"), input): + for start, to in map(lambda s: s.split("-"), input): res[start].add(to) res[to].add(start) diff --git a/2021/d15/ex1/ex1.py b/2021/d15/ex1/ex1.py index d7c5e88..4399aba 100755 --- a/2021/d15/ex1/ex1.py +++ b/2021/d15/ex1/ex1.py @@ -1,9 +1,8 @@ #!/usr/bin/env python import heapq -import itertools import sys -from typing import Iterator, List, NamedTuple, Set, Tuple +from typing import Iterator, List, NamedTuple, Set class Point(NamedTuple): diff --git a/2021/d15/ex2/ex2.py b/2021/d15/ex2/ex2.py index 0fa89b8..c2bbd30 100755 --- a/2021/d15/ex2/ex2.py +++ b/2021/d15/ex2/ex2.py @@ -1,9 +1,8 @@ #!/usr/bin/env python import heapq -import itertools import sys -from typing import Iterator, List, NamedTuple, Set, Tuple +from typing import Iterator, List, NamedTuple, Set class Point(NamedTuple): diff --git a/2021/d16/ex1/ex1.py b/2021/d16/ex1/ex1.py index d65fec5..1978196 100755 --- a/2021/d16/ex1/ex1.py +++ b/2021/d16/ex1/ex1.py @@ -5,7 +5,7 @@ import functools import itertools import sys from dataclasses import dataclass -from typing import Iterable, Iterator, List, Tuple, TypeVar +from typing import Iterable, Iterator, List, Tuple RawPacket = List[bool] diff --git a/2021/d16/ex2/ex2.py b/2021/d16/ex2/ex2.py index 7ecb73a..bb9ad4e 100755 --- a/2021/d16/ex2/ex2.py +++ b/2021/d16/ex2/ex2.py @@ -6,7 +6,7 @@ import itertools import math import sys from dataclasses import dataclass -from typing import Callable, Dict, Iterable, Iterator, List, Tuple, TypeVar +from typing import Callable, Dict, Iterable, Iterator, List, Tuple RawPacket = List[bool] diff --git a/2021/d17/ex1/ex1.py b/2021/d17/ex1/ex1.py index d58a72e..00bbca2 100755 --- a/2021/d17/ex1/ex1.py +++ b/2021/d17/ex1/ex1.py @@ -1,7 +1,6 @@ #!/usr/bin/env python import itertools -import math import sys from typing import Iterator, List, NamedTuple diff --git a/2021/d17/ex2/ex2.py b/2021/d17/ex2/ex2.py index e2beb9a..bc7dab1 100755 --- a/2021/d17/ex2/ex2.py +++ b/2021/d17/ex2/ex2.py @@ -1,7 +1,5 @@ #!/usr/bin/env python -import itertools -import math import sys from typing import Iterator, List, NamedTuple diff --git a/2021/d18/ex2/ex2.py b/2021/d18/ex2/ex2.py index 56c8d48..c0a37a7 100755 --- a/2021/d18/ex2/ex2.py +++ b/2021/d18/ex2/ex2.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import functools import itertools import sys from copy import deepcopy diff --git a/2021/d19/ex1/ex1.py b/2021/d19/ex1/ex1.py index 922e709..e42af3c 100755 --- a/2021/d19/ex1/ex1.py +++ b/2021/d19/ex1/ex1.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import functools import itertools import sys from dataclasses import dataclass diff --git a/2021/d19/ex2/ex2.py b/2021/d19/ex2/ex2.py index 1ad850a..ff4f6ad 100755 --- a/2021/d19/ex2/ex2.py +++ b/2021/d19/ex2/ex2.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import functools import itertools import sys from dataclasses import dataclass diff --git a/2021/d22/ex1/ex1.py b/2021/d22/ex1/ex1.py index 662dd49..dac1513 100755 --- a/2021/d22/ex1/ex1.py +++ b/2021/d22/ex1/ex1.py @@ -3,7 +3,7 @@ import functools import itertools import sys -from typing import Iterator, List, NamedTuple, Optional, Set, Tuple, cast +from typing import List, NamedTuple, Optional, Set, Tuple class Point(NamedTuple): diff --git a/2021/d22/ex2/ex2.py b/2021/d22/ex2/ex2.py index 4753b54..3c7d2c5 100755 --- a/2021/d22/ex2/ex2.py +++ b/2021/d22/ex2/ex2.py @@ -3,7 +3,7 @@ import functools import itertools import sys -from typing import Iterator, List, NamedTuple, Optional, Set, Tuple, cast +from typing import List, NamedTuple, Optional, Set, Tuple class Point(NamedTuple): diff --git a/2021/d23/ex1/ex1.py b/2021/d23/ex1/ex1.py index 4d585cd..0b99d71 100755 --- a/2021/d23/ex1/ex1.py +++ b/2021/d23/ex1/ex1.py @@ -3,7 +3,7 @@ import enum import functools import sys -from typing import Iterator, List, NamedTuple, Optional, Tuple, cast +from typing import Iterator, List, NamedTuple, Optional, Tuple class Point(NamedTuple): diff --git a/2021/d23/ex2/ex2.py b/2021/d23/ex2/ex2.py index 1ea1d8f..8c077d9 100755 --- a/2021/d23/ex2/ex2.py +++ b/2021/d23/ex2/ex2.py @@ -3,7 +3,7 @@ import enum import functools import sys -from typing import Iterator, List, NamedTuple, Optional, Tuple, cast +from typing import Iterator, List, NamedTuple, Optional, Tuple class Point(NamedTuple): diff --git a/2021/d25/ex1/ex1.py b/2021/d25/ex1/ex1.py index 76fbe54..5d6f612 100755 --- a/2021/d25/ex1/ex1.py +++ b/2021/d25/ex1/ex1.py @@ -1,9 +1,8 @@ #!/usr/bin/env python -import enum import itertools import sys -from typing import Iterable, Iterator, List, NamedTuple, Set +from typing import List, NamedTuple, Set class Point(NamedTuple): @@ -61,11 +60,13 @@ def solve(input: List[str]) -> int: for x in range(map.dimensions.x): print( "".join( - "v" - if Point(x, y) in map.south - else ">" - if Point(x, y) in map.east - else "." + ( + "v" + if Point(x, y) in map.south + 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/2022/d12/ex1/ex1.py b/2022/d12/ex1/ex1.py index 9e1c372..3e78cfc 100755 --- a/2022/d12/ex1/ex1.py +++ b/2022/d12/ex1/ex1.py @@ -20,7 +20,7 @@ class HeightMap: def reachable_neighbours(self, p: Point) -> Iterator[Point]: reachable_height = self.heights[p.x][p.y] + 1 - for (dx, dy) in ((-1, 0), (1, 0), (0, -1), (0, 1)): + for dx, dy in ((-1, 0), (1, 0), (0, -1), (0, 1)): x, y = p.x + dx, p.y + dy if x < 0 or x >= len(self.heights): continue diff --git a/2022/d12/ex2/ex2.py b/2022/d12/ex2/ex2.py index 657f807..0a713b3 100755 --- a/2022/d12/ex2/ex2.py +++ b/2022/d12/ex2/ex2.py @@ -20,7 +20,7 @@ class HeightMap: def reachable_neighbours(self, p: Point) -> Iterator[Point]: reachable_height = self.heights[p.x][p.y] + 1 - for (dx, dy) in ((-1, 0), (1, 0), (0, -1), (0, 1)): + for dx, dy in ((-1, 0), (1, 0), (0, -1), (0, 1)): x, y = p.x + dx, p.y + dy if x < 0 or x >= len(self.heights): continue diff --git a/2022/d18/ex2/ex2.py b/2022/d18/ex2/ex2.py index 6f7bfcb..57f8b5a 100755 --- a/2022/d18/ex2/ex2.py +++ b/2022/d18/ex2/ex2.py @@ -2,7 +2,6 @@ import itertools import sys -from collections import deque from collections.abc import Iterator from typing import NamedTuple diff --git a/2022/d21/ex1/ex1.py b/2022/d21/ex1/ex1.py index 7c12836..e9c4727 100755 --- a/2022/d21/ex1/ex1.py +++ b/2022/d21/ex1/ex1.py @@ -25,7 +25,7 @@ class Operator(str, enum.Enum): class Monkey: def get_value(self, monkeys: dict[str, "Monkey"]) -> int: - raise NotImplemented + raise NotImplementedError @dataclasses.dataclass diff --git a/2022/d21/ex2/ex2.py b/2022/d21/ex2/ex2.py index ec9ca8d..386a187 100755 --- a/2022/d21/ex2/ex2.py +++ b/2022/d21/ex2/ex2.py @@ -93,7 +93,7 @@ class MathObserver: class Monkey: def get_value(self, monkeys: dict[str, "Monkey"]) -> Num: - raise NotImplemented + raise NotImplementedError @dataclasses.dataclass diff --git a/2023/d02/ex2/ex2.py b/2023/d02/ex2/ex2.py index 309753e..32c3a34 100755 --- a/2023/d02/ex2/ex2.py +++ b/2023/d02/ex2/ex2.py @@ -1,8 +1,6 @@ #!/usr/bin/env python -import functools import math -import operator as op import sys from collections import Counter from enum import StrEnum diff --git a/2023/d14/ex2/ex2.py b/2023/d14/ex2/ex2.py index 090724f..b7b0222 100755 --- a/2023/d14/ex2/ex2.py +++ b/2023/d14/ex2/ex2.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import dataclasses import itertools import sys from enum import StrEnum diff --git a/2023/d17/ex2/ex2.py b/2023/d17/ex2/ex2.py index a643534..f4cfc6e 100755 --- a/2023/d17/ex2/ex2.py +++ b/2023/d17/ex2/ex2.py @@ -2,7 +2,6 @@ import functools import heapq -import itertools import sys from collections.abc import Iterator from enum import Enum diff --git a/flake.lock b/flake.lock index ffbe623..d2cf81b 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -21,11 +21,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -43,11 +43,11 @@ ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -58,11 +58,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1701336116, - "narHash": "sha256-kEmpezCR/FpITc6yMbAh4WrOCiT2zg5pSjnKrq51h5Y=", + "lastModified": 1731890469, + "narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f5c27c6136db4d76c30e533c20517df6864c46ee", + "rev": "5083ec887760adfe12af64830a66807423a859a7", "type": "github" }, "original": { @@ -75,9 +75,6 @@ "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", - "flake-utils": [ - "futils" - ], "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" @@ -87,11 +84,11 @@ ] }, "locked": { - "lastModified": 1700922917, - "narHash": "sha256-ej2fch/T584b5K9sk1UhmZF7W6wEfDHuoUYpFN8dtvM=", + "lastModified": 1732021966, + "narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "e5ee5c5f3844550c01d2131096c7271cec5e9b78", + "rev": "3308484d1a443fc5bc92012435d79e80458fe43c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 6334931..066f6db 100644 --- a/flake.nix +++ b/flake.nix @@ -22,7 +22,6 @@ repo = "pre-commit-hooks.nix"; ref = "master"; inputs = { - flake-utils.follows = "futils"; nixpkgs.follows = "nixpkgs"; nixpkgs-stable.follows = "nixpkgs"; }; @@ -40,17 +39,13 @@ src = self; hooks = { - black = { - enable = true; - }; - - isort = { - enable = true; - }; - nixpkgs-fmt = { enable = true; }; + + ruff-format = { + enable = true; + }; }; }; }; @@ -58,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;