From 4f150ec3793d03e133d019284eee90b9e8899592 Mon Sep 17 00:00:00 2001 From: rene-d Date: Thu, 1 Feb 2024 06:20:51 +0100 Subject: [PATCH] lint --- 2018/day16/day16.py | 11 ++++------- 2018/day8/day8.py | 9 ++------- 2019/day20/day20.py | 11 +++-------- 2022/day6/day6.py | 12 +++++++++++- 2023/day24/day24.py | 3 +-- scripts/inputs.py | 1 - scripts/requirements.txt | 1 + scripts/runall.py | 3 +-- 8 files changed, 23 insertions(+), 28 deletions(-) diff --git a/2018/day16/day16.py b/2018/day16/day16.py index 57c07b8..51246c2 100755 --- a/2018/day16/day16.py +++ b/2018/day16/day16.py @@ -1,14 +1,11 @@ #!/usr/bin/env python3 # [Day 16: Chronal Classification](https://adventofcode.com/2018/day/16) -from pathlib import Path -from copy import deepcopy -from collections import defaultdict, deque, namedtuple, Counter -import sys, re, math, itertools, time -from functools import reduce -import re -import unittest +import sys import typing as t +from collections import defaultdict +from copy import deepcopy +from pathlib import Path OPCODES = ( "addi", diff --git a/2018/day8/day8.py b/2018/day8/day8.py index 955f2d4..29eeb39 100755 --- a/2018/day8/day8.py +++ b/2018/day8/day8.py @@ -1,13 +1,8 @@ #!/usr/bin/env python3 # [Day 8: Memory Maneuver](https://adventofcode.com/2018/day/8) +import sys from pathlib import Path -from copy import deepcopy -from collections import defaultdict, deque, namedtuple, Counter -import sys, re, math, itertools, time -from functools import reduce -import re -import unittest verbose = "-v" in sys.argv if verbose: @@ -54,7 +49,7 @@ def rec2(pos): value = 0 for n in nodes[pos : pos + metadata]: if 0 < n <= len(values): - value += values[n-1] + value += values[n - 1] pos += metadata return pos, value diff --git a/2019/day20/day20.py b/2019/day20/day20.py index c5eb2be..71dad58 100755 --- a/2019/day20/day20.py +++ b/2019/day20/day20.py @@ -1,15 +1,10 @@ #!/usr/bin/env python3 # [Day 20: Donut Maze](https://adventofcode.com/2019/day/20) -from pathlib import Path -from copy import deepcopy -from collections import defaultdict, deque, namedtuple, Counter -import sys, re, math, itertools, time -from functools import reduce -import re +import sys import unittest -from dataclasses import dataclass - +from collections import defaultdict, deque +from pathlib import Path verbose = "-v" in sys.argv if verbose: diff --git a/2022/day6/day6.py b/2022/day6/day6.py index fd1dff7..cd4769d 100755 --- a/2022/day6/day6.py +++ b/2022/day6/day6.py @@ -4,4 +4,14 @@ filename = ("test.txt" if sys.argv[1] == "-t" else sys.argv[1]) if len(sys.argv) > 1 else "input.txt" data = open(filename).read() -print("\n".join(map(str, list(min(i + length for i in range(len(data) - length) if len(set(data[i : i + length])) == length) for length in (4, 14)),))) +print( + "\n".join( + map( + str, + list( + min(i + length for i in range(len(data) - length) if len(set(data[i : i + length])) == length) + for length in (4, 14) + ), + ) + ) +) diff --git a/2023/day24/day24.py b/2023/day24/day24.py index 6b525db..be6606e 100755 --- a/2023/day24/day24.py +++ b/2023/day24/day24.py @@ -2,14 +2,13 @@ # [Day 24: Never Tell Me The Odds](https://adventofcode.com/2023/day/24) import sys -from collections import Counter, namedtuple +from collections import namedtuple # from fractions import Fraction from pathlib import Path import sympy - verbose = "-v" in sys.argv if verbose: sys.argv.remove("-v") diff --git a/scripts/inputs.py b/scripts/inputs.py index 41525d8..f35e7a6 100755 --- a/scripts/inputs.py +++ b/scripts/inputs.py @@ -5,7 +5,6 @@ import tabulate - RED = "\033[91m" GREEN = "\033[92m" BLUE = "\033[94m" diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 1b82167..644fc14 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -2,3 +2,4 @@ networkx sympy curtsies shapely +tabulate diff --git a/scripts/runall.py b/scripts/runall.py index 7a90d48..ada2de8 100755 --- a/scripts/runall.py +++ b/scripts/runall.py @@ -9,11 +9,10 @@ import typing as t from collections import defaultdict from copy import deepcopy +from datetime import timedelta from operator import itemgetter from pathlib import Path from zlib import crc32 -from datetime import timedelta - RED = "\033[91m" GREEN = "\033[92m"