Update config & checks

This commit is contained in:
Gabriel Augendre 2022-12-02 13:35:44 +01:00
parent bebb4de924
commit a1782c4cae
78 changed files with 205 additions and 163 deletions

View file

@ -3,24 +3,43 @@ repos:
rev: v4.4.0
hooks:
- id: check-ast
types: [python]
- id: check-json
- id: check-toml
types: [toml]
- id: check-xml
- id: check-yaml
types: [yaml]
- id: end-of-file-fixer
types: [python]
- id: check-merge-conflict
- id: pretty-format-json
args:
- --autofix
- --no-sort-keys
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md
- repo: https://github.com/timothycrosley/isort
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py311-plus]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
types: [python]
args: [--profile, black]
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
types: [python]
- id: black
args: [--target-version, py310]
- repo: https://github.com/flakeheaven/flakeheaven
rev: 3.2.1
hooks:
- id: flakeheaven
additional_dependencies:
- flake8-annotations-complexity
- flake8-bandit
- flake8-builtins
- flake8-bugbear
- flake8-comprehensions
- flake8-noqa
- pep8-naming

View file

@ -1,5 +1,5 @@
from dataclasses import dataclass
from typing import Dict, List
from typing import Dict
@dataclass
@ -21,7 +21,7 @@ class Node:
chain.append(current)
return chain
def common_chain(self, other: "Node") -> List["Node"]:
def common_chain(self, other: "Node") -> list["Node"]:
chain = []
for el1, el2 in zip(reversed(self.chain()), reversed(other.chain())):
if el1 != el2:

View file

@ -1,5 +1,5 @@
import itertools
from typing import List, Union
from typing import List
NUMBER_OF_PARAMS_MAP = {
1: 3,
@ -54,13 +54,13 @@ class Computer:
self.pointer += offset
self.pointer_moved = False
def __init__(self, initial_program: List[int], inputs: List[int] = None):
def __init__(self, initial_program: list[int], inputs: list[int] = None):
self.program = initial_program.copy() # type: List[int]
self.inputs = inputs.copy() # type: List[int]
self.pointer = 0
self.pointer_moved = False
def compute(self, additional_inputs: List[int] = None) -> int:
def compute(self, additional_inputs: list[int] = None) -> int:
if additional_inputs is None:
additional_inputs = []
self.inputs.extend(additional_inputs)

View file

@ -1,5 +1,3 @@
from typing import List
WIDTH = 25
HEIGHT = 6
LAYER_SIZE = WIDTH * HEIGHT
@ -9,7 +7,7 @@ BLACK = "0"
TRANSPARENT = "2"
def find_pixel(layers: List[str], index: int) -> str:
def find_pixel(layers: list[str], index: int) -> str:
for layer in layers:
pixel = layer[index]
if pixel in [WHITE, BLACK]:

View file

@ -1,6 +1,5 @@
import itertools
from collections import defaultdict
from typing import List, Union
from typing import List
RELATIVE_MODE = 2
POSITION_MODE = 0
@ -36,7 +35,7 @@ class IntcodeOutput(Exception):
class Computer:
def __init__(self, initial_program: List[int], inputs: List[int] = None):
def __init__(self, initial_program: list[int], inputs: list[int] = None):
self.program = defaultdict(int, enumerate(initial_program))
if inputs is None:
inputs = []
@ -75,7 +74,7 @@ class Computer:
self.pointer += offset
self.pointer_moved = False
def compute(self, additional_inputs: List[int] = None) -> int:
def compute(self, additional_inputs: list[int] = None) -> int:
if additional_inputs is None:
additional_inputs = []
self.inputs.extend(additional_inputs)

View file

@ -1,5 +1,4 @@
from dataclasses import dataclass
from typing import Set, Tuple
@dataclass
@ -41,7 +40,7 @@ class Asteroid:
return True
def can_see(self, other: "Asteroid", asteroids: Set["Asteroid"]) -> bool:
def can_see(self, other: "Asteroid", asteroids: set["Asteroid"]) -> bool:
for asteroid in asteroids:
if asteroid in [self, other]:
continue

View file

@ -1,2 +1,2 @@
R75,D30,R83,U83,L12,D49,R71,U7,L72
U62,R66,U55,R34,D71,R55,D58,R83
U62,R66,U55,R34,D71,R55,D58,R83

View file

@ -1,2 +1,2 @@
R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51
U98,R91,D20,R16,D67,R40,U7,R15,U6,R7
U98,R91,D20,R16,D67,R40,U7,R15,U6,R7

View file

@ -1,2 +1,2 @@
R8,U5,L5,D3
U7,R6,D4,L4
U7,R6,D4,L4

View file

@ -1 +1 @@
3,225,1,225,6,6,1100,1,238,225,104,0,1001,92,74,224,1001,224,-85,224,4,224,1002,223,8,223,101,1,224,224,1,223,224,223,1101,14,63,225,102,19,83,224,101,-760,224,224,4,224,102,8,223,223,101,2,224,224,1,224,223,223,1101,21,23,224,1001,224,-44,224,4,224,102,8,223,223,101,6,224,224,1,223,224,223,1102,40,16,225,1102,6,15,225,1101,84,11,225,1102,22,25,225,2,35,96,224,1001,224,-350,224,4,224,102,8,223,223,101,6,224,224,1,223,224,223,1101,56,43,225,101,11,192,224,1001,224,-37,224,4,224,102,8,223,223,1001,224,4,224,1,223,224,223,1002,122,61,224,1001,224,-2623,224,4,224,1002,223,8,223,101,7,224,224,1,223,224,223,1,195,87,224,1001,224,-12,224,4,224,1002,223,8,223,101,5,224,224,1,223,224,223,1101,75,26,225,1101,6,20,225,1102,26,60,224,101,-1560,224,224,4,224,102,8,223,223,101,3,224,224,1,223,224,223,4,223,99,0,0,0,677,0,0,0,0,0,0,0,0,0,0,0,1105,0,99999,1105,227,247,1105,1,99999,1005,227,99999,1005,0,256,1105,1,99999,1106,227,99999,1106,0,265,1105,1,99999,1006,0,99999,1006,227,274,1105,1,99999,1105,1,280,1105,1,99999,1,225,225,225,1101,294,0,0,105,1,0,1105,1,99999,1106,0,300,1105,1,99999,1,225,225,225,1101,314,0,0,106,0,0,1105,1,99999,108,677,226,224,102,2,223,223,1006,224,329,1001,223,1,223,1108,226,677,224,1002,223,2,223,1006,224,344,101,1,223,223,7,226,677,224,102,2,223,223,1006,224,359,1001,223,1,223,1007,226,677,224,1002,223,2,223,1006,224,374,1001,223,1,223,1108,677,226,224,102,2,223,223,1005,224,389,1001,223,1,223,107,226,226,224,102,2,223,223,1006,224,404,101,1,223,223,1107,226,226,224,1002,223,2,223,1005,224,419,1001,223,1,223,1007,677,677,224,102,2,223,223,1006,224,434,101,1,223,223,1107,226,677,224,1002,223,2,223,1006,224,449,101,1,223,223,107,677,677,224,102,2,223,223,1005,224,464,1001,223,1,223,1008,226,226,224,1002,223,2,223,1005,224,479,101,1,223,223,1007,226,226,224,102,2,223,223,1005,224,494,1001,223,1,223,8,677,226,224,1002,223,2,223,1005,224,509,1001,223,1,223,108,677,677,224,1002,223,2,223,1005,224,524,1001,223,1,223,1008,677,677,224,102,2,223,223,1006,224,539,1001,223,1,223,7,677,226,224,1002,223,2,223,1005,224,554,101,1,223,223,1108,226,226,224,1002,223,2,223,1005,224,569,101,1,223,223,107,677,226,224,102,2,223,223,1005,224,584,101,1,223,223,8,226,226,224,1002,223,2,223,1005,224,599,101,1,223,223,108,226,226,224,1002,223,2,223,1006,224,614,1001,223,1,223,7,226,226,224,102,2,223,223,1006,224,629,1001,223,1,223,1107,677,226,224,102,2,223,223,1005,224,644,101,1,223,223,8,226,677,224,102,2,223,223,1006,224,659,1001,223,1,223,1008,226,677,224,1002,223,2,223,1006,224,674,1001,223,1,223,4,223,99,226
3,225,1,225,6,6,1100,1,238,225,104,0,1001,92,74,224,1001,224,-85,224,4,224,1002,223,8,223,101,1,224,224,1,223,224,223,1101,14,63,225,102,19,83,224,101,-760,224,224,4,224,102,8,223,223,101,2,224,224,1,224,223,223,1101,21,23,224,1001,224,-44,224,4,224,102,8,223,223,101,6,224,224,1,223,224,223,1102,40,16,225,1102,6,15,225,1101,84,11,225,1102,22,25,225,2,35,96,224,1001,224,-350,224,4,224,102,8,223,223,101,6,224,224,1,223,224,223,1101,56,43,225,101,11,192,224,1001,224,-37,224,4,224,102,8,223,223,1001,224,4,224,1,223,224,223,1002,122,61,224,1001,224,-2623,224,4,224,1002,223,8,223,101,7,224,224,1,223,224,223,1,195,87,224,1001,224,-12,224,4,224,1002,223,8,223,101,5,224,224,1,223,224,223,1101,75,26,225,1101,6,20,225,1102,26,60,224,101,-1560,224,224,4,224,102,8,223,223,101,3,224,224,1,223,224,223,4,223,99,0,0,0,677,0,0,0,0,0,0,0,0,0,0,0,1105,0,99999,1105,227,247,1105,1,99999,1005,227,99999,1005,0,256,1105,1,99999,1106,227,99999,1106,0,265,1105,1,99999,1006,0,99999,1006,227,274,1105,1,99999,1105,1,280,1105,1,99999,1,225,225,225,1101,294,0,0,105,1,0,1105,1,99999,1106,0,300,1105,1,99999,1,225,225,225,1101,314,0,0,106,0,0,1105,1,99999,108,677,226,224,102,2,223,223,1006,224,329,1001,223,1,223,1108,226,677,224,1002,223,2,223,1006,224,344,101,1,223,223,7,226,677,224,102,2,223,223,1006,224,359,1001,223,1,223,1007,226,677,224,1002,223,2,223,1006,224,374,1001,223,1,223,1108,677,226,224,102,2,223,223,1005,224,389,1001,223,1,223,107,226,226,224,102,2,223,223,1006,224,404,101,1,223,223,1107,226,226,224,1002,223,2,223,1005,224,419,1001,223,1,223,1007,677,677,224,102,2,223,223,1006,224,434,101,1,223,223,1107,226,677,224,1002,223,2,223,1006,224,449,101,1,223,223,107,677,677,224,102,2,223,223,1005,224,464,1001,223,1,223,1008,226,226,224,1002,223,2,223,1005,224,479,101,1,223,223,1007,226,226,224,102,2,223,223,1005,224,494,1001,223,1,223,8,677,226,224,1002,223,2,223,1005,224,509,1001,223,1,223,108,677,677,224,1002,223,2,223,1005,224,524,1001,223,1,223,1008,677,677,224,102,2,223,223,1006,224,539,1001,223,1,223,7,677,226,224,1002,223,2,223,1005,224,554,101,1,223,223,1108,226,226,224,1002,223,2,223,1005,224,569,101,1,223,223,107,677,226,224,102,2,223,223,1005,224,584,101,1,223,223,8,226,226,224,1002,223,2,223,1005,224,599,101,1,223,223,108,226,226,224,1002,223,2,223,1006,224,614,1001,223,1,223,7,226,226,224,102,2,223,223,1006,224,629,1001,223,1,223,1107,677,226,224,102,2,223,223,1005,224,644,101,1,223,223,8,226,677,224,102,2,223,223,1006,224,659,1001,223,1,223,1008,226,677,224,1002,223,2,223,1006,224,674,1001,223,1,223,4,223,99,226

View file

@ -1 +1 @@
3,9,8,9,10,9,4,9,99,-1,8
3,9,8,9,10,9,4,9,99,-1,8

View file

@ -1 +1 @@
3,21,1008,21,8,20,1005,20,22,107,8,21,20,1006,20,31,1106,0,36,98,0,0,1002,21,125,20,4,20,1105,1,46,104,999,1105,1,46,1101,1000,1,20,4,20,1105,1,46,98,99
3,21,1008,21,8,20,1005,20,22,107,8,21,20,1006,20,31,1106,0,36,98,0,0,1002,21,125,20,4,20,1105,1,46,104,999,1105,1,46,1101,1000,1,20,4,20,1105,1,46,98,99

View file

@ -8,4 +8,4 @@ G)H
D)I
E)J
J)K
K)L
K)L

View file

@ -1 +1 @@
3,15,3,16,1002,16,10,16,1,16,15,15,4,15,99,0,0
3,15,3,16,1002,16,10,16,1,16,15,15,4,15,99,0,0

View file

@ -1 +1 @@
3,23,3,24,1002,24,10,24,1002,23,-1,23,101,5,23,23,1,24,23,23,4,23,99,0,0
3,23,3,24,1002,24,10,24,1002,23,-1,23,101,5,23,23,1,24,23,23,4,23,99,0,0

View file

@ -1 +1 @@
3,31,3,32,1002,32,10,32,1001,31,-2,31,1007,31,0,33,1002,33,7,33,1,33,31,31,1,32,31,31,4,31,99,0,0,0
3,31,3,32,1002,32,10,32,1001,31,-2,31,1007,31,0,33,1002,33,7,33,1,33,31,31,1,32,31,31,4,31,99,0,0,0

View file

@ -1 +1 @@
3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5
3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5

View file

@ -1 +1 @@
3,52,1001,52,-5,52,3,53,1,52,56,54,1007,54,5,55,1005,55,26,1001,54,-5,54,1105,1,12,1,53,54,53,1008,54,0,55,1001,55,1,55,2,53,55,53,4,53,1001,56,-1,56,1005,56,6,99,0,0,0,0,10
3,52,1001,52,-5,52,3,53,1,52,56,54,1007,54,5,55,1005,55,26,1001,54,-5,54,1105,1,12,1,53,54,53,1008,54,0,55,1001,55,1,55,2,53,55,53,4,53,1001,56,-1,56,1005,56,6,99,0,0,0,0,10

View file

@ -1 +1 @@
1102,34463338,34463338,63,1007,63,34463338,63,1005,63,53,1101,0,3,1000,109,988,209,12,9,1000,209,6,209,3,203,0,1008,1000,1,63,1005,63,65,1008,1000,2,63,1005,63,904,1008,1000,0,63,1005,63,58,4,25,104,0,99,4,0,104,0,99,4,17,104,0,99,0,0,1102,32,1,1016,1101,38,0,1012,1102,1,693,1022,1102,1,27,1007,1101,0,190,1025,1102,20,1,1019,1102,1,33,1008,1102,28,1,1013,1101,0,1,1021,1102,1,851,1026,1102,22,1,1018,1101,29,0,1005,1101,0,21,1004,1101,36,0,1009,1101,0,195,1024,1101,0,39,1002,1101,0,848,1027,1102,1,34,1003,1102,23,1,1015,1102,1,30,1010,1101,0,26,1017,1102,1,35,1001,1102,1,489,1028,1102,1,484,1029,1102,1,686,1023,1102,0,1,1020,1102,25,1,1006,1102,1,31,1014,1101,37,0,1000,1102,1,24,1011,109,23,2105,1,1,4,187,1105,1,199,1001,64,1,64,1002,64,2,64,109,-18,2102,1,-3,63,1008,63,41,63,1005,63,223,1001,64,1,64,1106,0,225,4,205,1002,64,2,64,109,2,2101,0,1,63,1008,63,33,63,1005,63,251,4,231,1001,64,1,64,1105,1,251,1002,64,2,64,109,13,21107,40,41,-8,1005,1012,269,4,257,1106,0,273,1001,64,1,64,1002,64,2,64,109,9,1205,-8,287,4,279,1105,1,291,1001,64,1,64,1002,64,2,64,109,-38,2101,0,9,63,1008,63,34,63,1005,63,315,1001,64,1,64,1106,0,317,4,297,1002,64,2,64,109,18,21108,41,38,1,1005,1010,337,1001,64,1,64,1106,0,339,4,323,1002,64,2,64,109,-5,2107,30,1,63,1005,63,359,1001,64,1,64,1106,0,361,4,345,1002,64,2,64,109,14,21101,42,0,-7,1008,1011,42,63,1005,63,387,4,367,1001,64,1,64,1106,0,387,1002,64,2,64,109,-18,1208,0,39,63,1005,63,403,1106,0,409,4,393,1001,64,1,64,1002,64,2,64,109,3,1207,-1,38,63,1005,63,425,1106,0,431,4,415,1001,64,1,64,1002,64,2,64,109,-8,1201,5,0,63,1008,63,35,63,1005,63,455,1001,64,1,64,1106,0,457,4,437,1002,64,2,64,109,30,1206,-4,469,1106,0,475,4,463,1001,64,1,64,1002,64,2,64,109,10,2106,0,-7,4,481,1106,0,493,1001,64,1,64,1002,64,2,64,109,-24,21102,43,1,3,1008,1014,40,63,1005,63,517,1001,64,1,64,1105,1,519,4,499,1002,64,2,64,109,-4,2108,41,-5,63,1005,63,539,1001,64,1,64,1106,0,541,4,525,1002,64,2,64,109,18,21101,44,0,-8,1008,1017,47,63,1005,63,561,1105,1,567,4,547,1001,64,1,64,1002,64,2,64,109,-24,1202,6,1,63,1008,63,27,63,1005,63,589,4,573,1106,0,593,1001,64,1,64,1002,64,2,64,109,7,1208,-5,34,63,1005,63,611,4,599,1106,0,615,1001,64,1,64,1002,64,2,64,109,-5,1207,6,37,63,1005,63,637,4,621,1001,64,1,64,1106,0,637,1002,64,2,64,109,23,1206,-6,655,4,643,1001,64,1,64,1105,1,655,1002,64,2,64,109,-10,2107,32,-8,63,1005,63,673,4,661,1105,1,677,1001,64,1,64,1002,64,2,64,109,5,2105,1,2,1001,64,1,64,1106,0,695,4,683,1002,64,2,64,109,-17,1202,0,1,63,1008,63,20,63,1005,63,715,1106,0,721,4,701,1001,64,1,64,1002,64,2,64,109,-4,1201,4,0,63,1008,63,21,63,1005,63,743,4,727,1106,0,747,1001,64,1,64,1002,64,2,64,109,10,1205,10,763,1001,64,1,64,1105,1,765,4,753,1002,64,2,64,109,1,21102,45,1,1,1008,1012,45,63,1005,63,787,4,771,1105,1,791,1001,64,1,64,1002,64,2,64,109,-4,2102,1,-2,63,1008,63,29,63,1005,63,813,4,797,1105,1,817,1001,64,1,64,1002,64,2,64,109,-4,2108,33,5,63,1005,63,835,4,823,1105,1,839,1001,64,1,64,1002,64,2,64,109,23,2106,0,1,1106,0,857,4,845,1001,64,1,64,1002,64,2,64,109,-12,21108,46,46,1,1005,1015,879,4,863,1001,64,1,64,1106,0,879,1002,64,2,64,109,10,21107,47,46,-5,1005,1019,899,1001,64,1,64,1105,1,901,4,885,4,64,99,21101,27,0,1,21101,915,0,0,1105,1,922,21201,1,52134,1,204,1,99,109,3,1207,-2,3,63,1005,63,964,21201,-2,-1,1,21101,0,942,0,1105,1,922,22101,0,1,-1,21201,-2,-3,1,21101,0,957,0,1105,1,922,22201,1,-1,-2,1106,0,968,21201,-2,0,-2,109,-3,2106,0,0
1102,34463338,34463338,63,1007,63,34463338,63,1005,63,53,1101,0,3,1000,109,988,209,12,9,1000,209,6,209,3,203,0,1008,1000,1,63,1005,63,65,1008,1000,2,63,1005,63,904,1008,1000,0,63,1005,63,58,4,25,104,0,99,4,0,104,0,99,4,17,104,0,99,0,0,1102,32,1,1016,1101,38,0,1012,1102,1,693,1022,1102,1,27,1007,1101,0,190,1025,1102,20,1,1019,1102,1,33,1008,1102,28,1,1013,1101,0,1,1021,1102,1,851,1026,1102,22,1,1018,1101,29,0,1005,1101,0,21,1004,1101,36,0,1009,1101,0,195,1024,1101,0,39,1002,1101,0,848,1027,1102,1,34,1003,1102,23,1,1015,1102,1,30,1010,1101,0,26,1017,1102,1,35,1001,1102,1,489,1028,1102,1,484,1029,1102,1,686,1023,1102,0,1,1020,1102,25,1,1006,1102,1,31,1014,1101,37,0,1000,1102,1,24,1011,109,23,2105,1,1,4,187,1105,1,199,1001,64,1,64,1002,64,2,64,109,-18,2102,1,-3,63,1008,63,41,63,1005,63,223,1001,64,1,64,1106,0,225,4,205,1002,64,2,64,109,2,2101,0,1,63,1008,63,33,63,1005,63,251,4,231,1001,64,1,64,1105,1,251,1002,64,2,64,109,13,21107,40,41,-8,1005,1012,269,4,257,1106,0,273,1001,64,1,64,1002,64,2,64,109,9,1205,-8,287,4,279,1105,1,291,1001,64,1,64,1002,64,2,64,109,-38,2101,0,9,63,1008,63,34,63,1005,63,315,1001,64,1,64,1106,0,317,4,297,1002,64,2,64,109,18,21108,41,38,1,1005,1010,337,1001,64,1,64,1106,0,339,4,323,1002,64,2,64,109,-5,2107,30,1,63,1005,63,359,1001,64,1,64,1106,0,361,4,345,1002,64,2,64,109,14,21101,42,0,-7,1008,1011,42,63,1005,63,387,4,367,1001,64,1,64,1106,0,387,1002,64,2,64,109,-18,1208,0,39,63,1005,63,403,1106,0,409,4,393,1001,64,1,64,1002,64,2,64,109,3,1207,-1,38,63,1005,63,425,1106,0,431,4,415,1001,64,1,64,1002,64,2,64,109,-8,1201,5,0,63,1008,63,35,63,1005,63,455,1001,64,1,64,1106,0,457,4,437,1002,64,2,64,109,30,1206,-4,469,1106,0,475,4,463,1001,64,1,64,1002,64,2,64,109,10,2106,0,-7,4,481,1106,0,493,1001,64,1,64,1002,64,2,64,109,-24,21102,43,1,3,1008,1014,40,63,1005,63,517,1001,64,1,64,1105,1,519,4,499,1002,64,2,64,109,-4,2108,41,-5,63,1005,63,539,1001,64,1,64,1106,0,541,4,525,1002,64,2,64,109,18,21101,44,0,-8,1008,1017,47,63,1005,63,561,1105,1,567,4,547,1001,64,1,64,1002,64,2,64,109,-24,1202,6,1,63,1008,63,27,63,1005,63,589,4,573,1106,0,593,1001,64,1,64,1002,64,2,64,109,7,1208,-5,34,63,1005,63,611,4,599,1106,0,615,1001,64,1,64,1002,64,2,64,109,-5,1207,6,37,63,1005,63,637,4,621,1001,64,1,64,1106,0,637,1002,64,2,64,109,23,1206,-6,655,4,643,1001,64,1,64,1105,1,655,1002,64,2,64,109,-10,2107,32,-8,63,1005,63,673,4,661,1105,1,677,1001,64,1,64,1002,64,2,64,109,5,2105,1,2,1001,64,1,64,1106,0,695,4,683,1002,64,2,64,109,-17,1202,0,1,63,1008,63,20,63,1005,63,715,1106,0,721,4,701,1001,64,1,64,1002,64,2,64,109,-4,1201,4,0,63,1008,63,21,63,1005,63,743,4,727,1106,0,747,1001,64,1,64,1002,64,2,64,109,10,1205,10,763,1001,64,1,64,1105,1,765,4,753,1002,64,2,64,109,1,21102,45,1,1,1008,1012,45,63,1005,63,787,4,771,1105,1,791,1001,64,1,64,1002,64,2,64,109,-4,2102,1,-2,63,1008,63,29,63,1005,63,813,4,797,1105,1,817,1001,64,1,64,1002,64,2,64,109,-4,2108,33,5,63,1005,63,835,4,823,1105,1,839,1001,64,1,64,1002,64,2,64,109,23,2106,0,1,1106,0,857,4,845,1001,64,1,64,1002,64,2,64,109,-12,21108,46,46,1,1005,1015,879,4,863,1001,64,1,64,1106,0,879,1002,64,2,64,109,10,21107,47,46,-5,1005,1019,899,1001,64,1,64,1105,1,901,4,885,4,64,99,21101,27,0,1,21101,915,0,0,1105,1,922,21201,1,52134,1,204,1,99,109,3,1207,-2,3,63,1005,63,964,21201,-2,-1,1,21101,0,942,0,1105,1,922,22101,0,1,-1,21201,-2,-3,1,21101,0,957,0,1105,1,922,22201,1,-1,-2,1106,0,968,21201,-2,0,-2,109,-3,2106,0,0

View file

@ -1 +1 @@
109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99
109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99

View file

@ -1 +1 @@
1102,34915192,34915192,7,4,7,99,0
1102,34915192,34915192,7,4,7,99,0

View file

@ -1 +1 @@
104,1125899906842624,99
104,1125899906842624,99

View file

@ -22,4 +22,4 @@
....#.....##..#.##.#...##
.##..#.#..##..##.#..##..#
.##..#####....#####.#.#.#
#..#..#..##...#..#.#.#.##
#..#..#..##...#..#.#.#.##

View file

@ -7,4 +7,4 @@
#..#....#.
.##.#..###
##...#..#.
.#....####
.#....####

View file

@ -7,4 +7,4 @@
..#...##..
..##....##
......#...
.####.###.
.####.###.

View file

@ -7,4 +7,4 @@
..#.#..#.#
#..#.#.###
.##...##.#
.....#.#..
.....#.#..

View file

@ -17,4 +17,4 @@
....##.##.###..#####
.#.#.###########.###
#.#.#.#####.####.###
###.##.####.##.#..##
###.##.####.##.#..##

View file

@ -1,5 +1,4 @@
from collections import Counter
from typing import Tuple
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
@ -20,7 +19,7 @@ def main(filename: str, expected_part_1: int = None, expected_part_2: int = None
assert counter_part_2 == expected_part_2
def extract_password_and_policy(line) -> Tuple[Tuple[int, int], str, str]:
def extract_password_and_policy(line) -> tuple[tuple[int, int], str, str]:
policy, password = line.strip().split(": ")
range_, letter = policy.split(" ")
range_ = range_.split("-")
@ -28,12 +27,12 @@ def extract_password_and_policy(line) -> Tuple[Tuple[int, int], str, str]:
return range_, letter, password
def is_valid_part_1(range_: Tuple[int, int], letter: str, password: str):
def is_valid_part_1(range_: tuple[int, int], letter: str, password: str):
counter = Counter(password)
return range_[0] <= counter[letter] <= range_[1]
def is_valid_part_2(range_: Tuple[int, int], letter: str, password: str):
def is_valid_part_2(range_: tuple[int, int], letter: str, password: str):
first_index = password[range_[0] - 1]
second_index = password[range_[1] - 1]
return first_index != second_index and (

View file

@ -28,7 +28,7 @@ def main(filename: str, expected_part_1: int = None, expected_part_2: int = None
assert prod_trees == expected_part_2
def trees_for_slope(forest: List[str], right: int, down: int) -> int:
def trees_for_slope(forest: list[str], right: int, down: int) -> int:
trees = 0
current_line = 0
current_col = 0

View file

@ -1,6 +1,6 @@
import functools
import itertools
from typing import List, Tuple
from typing import List
import networkx as nx
@ -39,13 +39,13 @@ def count_diffs(jolts):
return diffs
def solve_part_2(jolts: List[int]):
def solve_part_2(jolts: list[int]):
jolts = tuple(jolts)
return with_recursion(jolts, jolts[-1])
@functools.lru_cache(maxsize=None)
def with_recursion(jolts: Tuple[int], target: int):
@functools.cache
def with_recursion(jolts: tuple[int], target: int):
if target == 0:
return 1
counter = 0

View file

@ -1,6 +1,6 @@
import functools
from collections import Counter
from typing import List, Tuple, Dict, Optional
from typing import Dict
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
@ -25,7 +25,7 @@ def main(filename: str, expected_part_1: int = None, expected_part_2: int = None
assert expected_part_2 == counter_part_2
Coordinates = Tuple[int, int]
Coordinates = tuple[int, int]
class SeatMap:
@ -90,7 +90,7 @@ class SeatMap:
count_occupied += 1
return count_occupied
def _visible_seats(self, coordinates: Coordinates) -> List[str]:
def _visible_seats(self, coordinates: Coordinates) -> list[str]:
adjacent_cells = [
self._find_top_left(coordinates),
self._find_top(coordinates),
@ -105,13 +105,13 @@ class SeatMap:
return list(map(self._square_at, filter(None, adjacent_cells)))
@functools.lru_cache(None)
def _find_top_left(self, coordinates: Coordinates) -> Optional[Coordinates]:
def _find_top_left(self, coordinates: Coordinates) -> Coordinates | None:
return self._find_with_delta(coordinates, (-1, -1))
@functools.lru_cache(None)
def _find_with_delta(
self, coordinates: Coordinates, delta: Tuple[int, int]
) -> Optional[Coordinates]:
self, coordinates: Coordinates, delta: tuple[int, int]
) -> Coordinates | None:
other_coord = (coordinates[0] + delta[0], coordinates[1] + delta[1])
try:
self._square_at(other_coord)
@ -120,31 +120,31 @@ class SeatMap:
return other_coord
@functools.lru_cache(None)
def _find_top(self, coordinates: Coordinates) -> Optional[Coordinates]:
def _find_top(self, coordinates: Coordinates) -> Coordinates | None:
return self._find_with_delta(coordinates, (-1, 0))
@functools.lru_cache(None)
def _find_top_right(self, coordinates: Coordinates) -> Optional[Coordinates]:
def _find_top_right(self, coordinates: Coordinates) -> Coordinates | None:
return self._find_with_delta(coordinates, (-1, 1))
@functools.lru_cache(None)
def _find_right(self, coordinates: Coordinates) -> Optional[Coordinates]:
def _find_right(self, coordinates: Coordinates) -> Coordinates | None:
return self._find_with_delta(coordinates, (0, 1))
@functools.lru_cache(None)
def _find_bottom_right(self, coordinates: Coordinates) -> Optional[Coordinates]:
def _find_bottom_right(self, coordinates: Coordinates) -> Coordinates | None:
return self._find_with_delta(coordinates, (1, 1))
@functools.lru_cache(None)
def _find_bottom(self, coordinates: Coordinates) -> Optional[Coordinates]:
def _find_bottom(self, coordinates: Coordinates) -> Coordinates | None:
return self._find_with_delta(coordinates, (1, 0))
@functools.lru_cache(None)
def _find_bottom_left(self, coordinates: Coordinates) -> Optional[Coordinates]:
def _find_bottom_left(self, coordinates: Coordinates) -> Coordinates | None:
return self._find_with_delta(coordinates, (1, -1))
@functools.lru_cache(None)
def _find_left(self, coordinates: Coordinates) -> Optional[Coordinates]:
def _find_left(self, coordinates: Coordinates) -> Coordinates | None:
return self._find_with_delta(coordinates, (0, -1))
@ -153,8 +153,8 @@ class SeatMapPart2(SeatMap):
@functools.lru_cache(None)
def _find_with_delta(
self, coordinates: Coordinates, delta: Tuple[int, int]
) -> Optional[Coordinates]:
self, coordinates: Coordinates, delta: tuple[int, int]
) -> Coordinates | None:
other_coord = (coordinates[0] + delta[0], coordinates[1] + delta[1])
try:
other_square = self._square_at(other_coord)

View file

@ -1,6 +1,5 @@
import enum
import functools
from typing import List
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
@ -20,13 +19,13 @@ def main(filename: str, expected_part_1: int = None, expected_part_2: int = None
assert expected_part_2 == counter_part_2
def solve_part_1(instructions: List[str]):
def solve_part_1(instructions: list[str]):
ship = ShipPart1()
ship.apply_instructions(instructions)
return ship.distance_from_origin
def solve_part_2(instructions: List[str]):
def solve_part_2(instructions: list[str]):
ship = ShipPart2()
ship.apply_instructions(instructions)
return ship.distance_from_origin

View file

@ -1,7 +1,6 @@
import enum
import functools
import math
from typing import List, Dict
from typing import Dict
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):

View file

@ -1,6 +1,7 @@
import functools
import re
from typing import List, Dict, Iterable, Union
from collections.abc import Iterable
from typing import Union
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
@ -24,7 +25,7 @@ def main(filename: str, expected_part_1: int = None, expected_part_2: int = None
assert expected_part_2 == counter_part_2
Memory = Dict[Union[str, int], Union[str, int]]
Memory = dict[Union[str, int], Union[str, int]]
class Program:
@ -72,7 +73,7 @@ class ProgramPart1(Program):
self.memory[address] = self.get_masked_value(value)
def get_masked_value(self, value: int) -> str:
binary_value = "{:036b}".format(value)
binary_value = f"{value:036b}"
masked_value = []
for binary_bit, mask_bit in zip(binary_value, self.mask):
if mask_bit == "X":
@ -102,7 +103,7 @@ class ProgramPart2(Program):
self.memory[masked_address] = value
def get_masked_addresses(self, address: int) -> Iterable[int]:
binary_address = "{:036b}".format(address)
binary_address = f"{address:036b}"
corrected_binary_address = ""
for binary_bit, mask_bit in zip(binary_address, self.mask):
if mask_bit == "1":
@ -113,7 +114,7 @@ class ProgramPart2(Program):
int_base_2 = functools.partial(int, base=2)
return map(int_base_2, addresses)
def get_floating_addresses(self, prefix: str, address: str, mask: str) -> List[str]:
def get_floating_addresses(self, prefix: str, address: str, mask: str) -> list[str]:
if "X" not in mask:
return [prefix + address]
first_x = mask.index("X")

View file

@ -1,6 +1,4 @@
import functools
import re
from typing import Dict, Iterable, List, Tuple, Union
from typing import Union
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
@ -20,8 +18,8 @@ def main(filename: str, expected_part_1: int = None, expected_part_2: int = None
assert expected_part_2 == counter_part_2
SeenTuple = Union[Tuple[int], Tuple[int, int]]
Seen = Dict[int, SeenTuple]
SeenTuple = Union[tuple[int], tuple[int, int]]
Seen = dict[int, SeenTuple]
def solve_part_1(starting_numbers):

View file

@ -1,6 +1,6 @@
import re
from collections import defaultdict
from typing import Iterable, List, Tuple
from collections.abc import Iterable
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
@ -22,8 +22,8 @@ def main(filename: str, expected_part_1: int = None, expected_part_2: int = None
assert expected_part_2 == counter_part_2
Range = Tuple[int, int]
Ranges = List[Range]
Range = tuple[int, int]
Ranges = list[Range]
class TicketAnalyserPart1:
@ -40,7 +40,7 @@ class TicketAnalyserPart1:
self.valid_tickets = []
@staticmethod
def extract_ranges(named_range: str) -> Tuple[str, Ranges]:
def extract_ranges(named_range: str) -> tuple[str, Ranges]:
name, ranges = named_range.split(": ")
reg = re.compile(r"(\d+)-(\d+) or (\d+)-(\d+)$")
matches = reg.match(ranges)
@ -57,7 +57,7 @@ class TicketAnalyserPart1:
self.valid_tickets.append(ticket)
return error_rate
def get_invalid_values(self, ticket: List[int]) -> List[int]:
def get_invalid_values(self, ticket: list[int]) -> list[int]:
invalid_values = []
for value in ticket:
if self.value_is_invalid(value):
@ -77,8 +77,7 @@ class TicketAnalyserPart1:
def iter_ranges(self) -> Iterable[Range]:
for ranges in self.ranges.values():
for rng in ranges:
yield rng
yield from ranges
def compute_class_assignation(self):
possible_columns_for_range = defaultdict(list)

View file

@ -3,4 +3,4 @@
366
299
675
1456
1456

View file

@ -1,3 +1,3 @@
1-3 a: abcde
1-3 b: cdefg
2-9 c: ccccccccc
2-9 c: ccccccccc

View file

@ -8,4 +8,4 @@
.#........#
#.##...#...
#...##....#
.#..#...#.#
.#..#...#.#

View file

@ -1,2 +1,2 @@
BFFFBBFRLR
BFFFBBFRRR
BFFFBBFRRR

View file

@ -1 +1 @@
FFFBBBFRRR
FFFBBBFRRR

View file

@ -1 +1 @@
BBFFBBFRLL
BBFFBBFRLL

View file

@ -1,3 +1,3 @@
BFFFBBFRRR
BBFFBBFRLL
FFFBBBFRRR
FFFBBBFRRR

View file

@ -6,4 +6,4 @@ jmp -3
acc -99
acc +1
jmp -4
acc +6
acc +6

View file

@ -998,4 +998,3 @@
95914697526990
99484174471360
100861876842026

View file

@ -8,4 +8,4 @@
19
6
12
4
4

View file

@ -28,4 +28,4 @@
2
34
10
3
3

View file

@ -7,4 +7,4 @@ L.LLLLL.LL
..L.L.....
LLLLLLLLLL
L.LLLLLL.L
L.LLLLL.LL
L.LLLLL.LL

View file

@ -2,4 +2,4 @@ F10
N3
F7
R90
F11
F11

View file

@ -4,4 +4,4 @@ F7
R90
F11
L180
F10
F10

View file

@ -1,2 +1,2 @@
939
7,13,x,x,59,x,31,19
7,13,x,x,59,x,31,19

View file

@ -1,2 +1,2 @@
939
17,x,13,19
17,x,13,19

View file

@ -1,2 +1,2 @@
939
67,7,59,61
67,7,59,61

View file

@ -1,2 +1,2 @@
939
67,x,7,59,61
67,x,7,59,61

View file

@ -1,2 +1,2 @@
939
67,7,x,59,61
67,7,x,59,61

View file

@ -1,2 +1,2 @@
939
1789,37,47,1889
1789,37,47,1889

View file

@ -1 +1 @@
1,17,0,10,18,11,6
1,17,0,10,18,11,6

View file

@ -1 +1 @@
0,3,6
0,3,6

View file

@ -1 +1 @@
1,3,2
1,3,2

View file

@ -1 +1 @@
3,2,1
3,2,1

View file

@ -1 +1 @@
3,1,2
3,1,2

View file

@ -1,5 +1,4 @@
import pytest
from day11_seating import SeatMap

View file

@ -1,5 +1,4 @@
import pytest
from day14_docking import ProgramPart2

View file

@ -1,4 +1,3 @@
let total = 0;
$("pre").innerText.trim().split("\n").map(el => Number(el)).map((el, index, array) => el + array[index+1] + array[index+2]).reduce((prev, current) => {if (prev < current) {total += 1} return current});
console.log(total);

View file

@ -1,8 +1,8 @@
import itertools
from typing import List, Set, TypeAlias
from typing import TypeAlias
Numbers: TypeAlias = List[int]
Grid: TypeAlias = List[Numbers]
Numbers: TypeAlias = list[int]
Grid: TypeAlias = list[Numbers]
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
@ -23,10 +23,10 @@ def main(filename: str, expected_part_1: int = None, expected_part_2: int = None
assert expected_part_2 == solution_part_2
def parse_data(data: List[str]) -> (Numbers, List[Grid]):
def parse_data(data: list[str]) -> (Numbers, list[Grid]):
numbers: Numbers = list(map(int, data[0].split(",")))
data = data[1:]
grids: List[Grid] = []
grids: list[Grid] = []
for grid in data:
parsed_grid: Grid = []
grid_lines = grid.split("\n")
@ -37,8 +37,8 @@ def parse_data(data: List[str]) -> (Numbers, List[Grid]):
return numbers, grids
def solve_part_1(numbers: Numbers, grids: List[Grid]) -> int:
seen: Set[int] = set()
def solve_part_1(numbers: Numbers, grids: list[Grid]) -> int:
seen: set[int] = set()
for number in numbers:
seen.add(number)
for grid in grids:
@ -46,18 +46,18 @@ def solve_part_1(numbers: Numbers, grids: List[Grid]) -> int:
return sum(unseen(grid, seen)) * number
def check_bingo(grid: Grid, seen: Set[int]) -> bool:
def check_bingo(grid: Grid, seen: set[int]) -> bool:
return check_row(grid, seen) or check_column(grid, seen)
def check_row(grid: Grid, seen: Set[int]) -> bool:
def check_row(grid: Grid, seen: set[int]) -> bool:
for row in grid:
if check_line(row, seen):
return True
return False
def check_column(grid: Grid, seen: Set[int]) -> bool:
def check_column(grid: Grid, seen: set[int]) -> bool:
for i in range(len(grid[0])):
column = [row[i] for row in grid]
if check_line(column, seen):
@ -65,21 +65,21 @@ def check_column(grid: Grid, seen: Set[int]) -> bool:
return False
def check_line(line: Numbers, seen: Set[int]) -> bool:
def check_line(line: Numbers, seen: set[int]) -> bool:
for number in line:
if number not in seen:
return False
return True
def unseen(grid: Grid, seen: Set[int]) -> Numbers:
def unseen(grid: Grid, seen: set[int]) -> Numbers:
return [n for n in itertools.chain.from_iterable(grid) if n not in seen]
def solve_part_2(numbers: Numbers, grids: List[Grid]) -> int:
seen: Set[int] = set()
def solve_part_2(numbers: Numbers, grids: list[Grid]) -> int:
seen: set[int] = set()
score = 0
winners: Set[int] = set()
winners: set[int] = set()
for number in numbers:
seen.add(number)
for index, grid in enumerate(grids):

View file

@ -1,5 +1,4 @@
from dataclasses import dataclass
from typing import List, Set
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
@ -37,7 +36,7 @@ class Segment:
def is_vertical(self):
return self.start.x == self.end.x
def get_points_part_1(self) -> Set[Point]:
def get_points_part_1(self) -> set[Point]:
if self.is_horizontal():
start = min(self.start.x, self.end.x)
end = max(self.start.x, self.end.x)
@ -48,7 +47,7 @@ class Segment:
return {Point(self.start.x, y) for y in range(start, end + 1)}
return set()
def get_points_part_2(self) -> Set[Point]:
def get_points_part_2(self) -> set[Point]:
part_1 = self.get_points_part_1()
if part_1:
return part_1
@ -71,7 +70,7 @@ class Segment:
return points
def parse_data(data: List[str]) -> List[Segment]:
def parse_data(data: list[str]) -> list[Segment]:
segments = []
for line in data:
start, end = line.split(" -> ")
@ -84,7 +83,7 @@ def parse_data(data: List[str]) -> List[Segment]:
return segments
def solve_part_1(data: List[Segment]) -> int:
def solve_part_1(data: list[Segment]) -> int:
seen_points = set()
multiple_times = set()
for segment in data:
@ -95,7 +94,7 @@ def solve_part_1(data: List[Segment]) -> int:
return len(multiple_times)
def solve_part_2(data: List[Segment]) -> int:
def solve_part_2(data: list[Segment]) -> int:
seen_points = set()
multiple_times = set()
for segment in data:

View file

@ -1,6 +1,4 @@
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor, as_completed
from typing import Dict, Iterator, List
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
@ -21,7 +19,7 @@ def main(filename: str, expected_part_1: int = None, expected_part_2: int = None
assert expected_part_2 == solution_part_2
def parse_data(data: List[str]) -> Dict[int, int]:
def parse_data(data: list[str]) -> dict[int, int]:
dct = defaultdict(int)
for x in map(int, data[0].split(",")):
dct[x] += 1
@ -34,7 +32,7 @@ def solve_part_1(data) -> int:
return sum(data.values())
def _run_day(data: Dict[int, int]) -> Dict[int, int]:
def _run_day(data: dict[int, int]) -> dict[int, int]:
new_data = defaultdict(int)
for k, v in data.items():
if k == 0:

View file

@ -1,6 +1,5 @@
import math
import statistics
from typing import List
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
@ -21,11 +20,11 @@ def main(filename: str, expected_part_1: int = None, expected_part_2: int = None
assert expected_part_2 == solution_part_2
def parse_data(data: List[str]) -> List[int]:
def parse_data(data: list[str]) -> list[int]:
return list(map(int, data[0].split(",")))
def solve_part_1(data: List[int]) -> int:
def solve_part_1(data: list[int]) -> int:
target_position = int(statistics.median(data))
fuel_cost = 0
for crab in data:
@ -33,7 +32,7 @@ def solve_part_1(data: List[int]) -> int:
return fuel_cost
def solve_part_2(data: List[int]) -> int:
def solve_part_2(data: list[int]) -> int:
target_position_1 = math.floor(statistics.mean(data))
target_position_2 = math.ceil(statistics.mean(data))
return min(
@ -44,7 +43,7 @@ def solve_part_2(data: List[int]) -> int:
)
def compute_part_2(data: List[int], target_position: int) -> int:
def compute_part_2(data: list[int], target_position: int) -> int:
fuel_cost = 0
for index, crab in enumerate(data):
fuel_for_crab = sum([i for i in range(abs(crab - target_position) + 1)])

View file

@ -9,4 +9,4 @@
10000
11001
00010
01010
01010

View file

@ -16,4 +16,4 @@
10 16 15 9 19
18 8 23 26 20
22 11 13 6 5
2 0 12 3 7
2 0 12 3 7

View file

@ -7,4 +7,4 @@
0,9 -> 2,9
3,4 -> 1,4
0,0 -> 8,8
5,5 -> 8,2
5,5 -> 8,2

View file

@ -1,4 +1,4 @@
1,0 -> 3,0
1,0 -> 1,1
1,0 -> 2,1
2,0 -> 2,1
2,0 -> 2,1

View file

@ -1 +1 @@
3,4,3,1,2
3,4,3,1,2

View file

@ -1 +1 @@
16,1,2,0,4,2,7,1,2,14
16,1,2,0,4,2,7,1,2,14

View file

@ -1,6 +1,3 @@
from typing import List
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
print(f"\n+ Running on {filename}")
with open(filename) as f:
@ -19,7 +16,7 @@ def main(filename: str, expected_part_1: int = None, expected_part_2: int = None
assert expected_part_2 == solution_part_2
def parse_data(data: List[str]):
def parse_data(data: list[str]):
return data

View file

@ -22,4 +22,3 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>

23
baseline.txt Normal file
View file

@ -0,0 +1,23 @@
192ba80a7bf992445f8320737416cfd1
ea9c1c33a5879bb5c437218a0eb0ec99
12f99f3b98ebc4e1225798400e307f47
5f3b0f184c3e7cacd25d4bf3f9fc0e62
408296793fc6e98b5959c0c17510e584
10fb4c63998a627df816295f2507f786
2ec39e0044b1212025f7a7bcf047fd4f
38579bf5ef8a53dd86b290137e90ef07
02f5c14b08c62eb4bb9d39ae1f99dbf8
81a486b330b1a68b74c12c897d258930
81a486b330b1a68b74c12c897d258930
81a486b330b1a68b74c12c897d258930
81a486b330b1a68b74c12c897d258930
81a486b330b1a68b74c12c897d258930
81a486b330b1a68b74c12c897d258930
81a486b330b1a68b74c12c897d258930
81a486b330b1a68b74c12c897d258930
81a486b330b1a68b74c12c897d258930
81a486b330b1a68b74c12c897d258930
78f847458ed2bbf800bc9b0a87d24b83
505c155f15a5f931779aebcc8defa624
fe797f6243a22a070cdbcc2bc60519df
4c869a5cb1ed32f419a0f8677798d1b4

View file

@ -3,7 +3,7 @@ name = "advent-of-code"
version = "0.1.0"
description = ""
authors = ["Gabriel Augendre <gabriel@augendre.info>"]
license = "MIT"
license = "Unlicense"
[tool.poetry.dependencies]
python = "^3.10"
@ -18,8 +18,29 @@ pytest = ">=6.1.2"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.black]
target-version = ['py38']
[tool.isort]
profile = "black"
###############################################################################
# flake8 / flakeheaven
###############################################################################
[tool.flakeheaven]
max_complexity = 10
format = "grouped"
baseline = "baseline.txt"
# Base rules
#############################
[tool.flakeheaven.plugins]
"*" = [
"+*",
"-E501", # long lines
"-E203", # conflict with black on PEP8 interpretation
"-W503", # deprecated rule: https://www.flake8rules.com/rules/W503.html
]
flake8-builtins = [
"+*",
"-A003", # class attribute is shadowing a python builtin
]
flake8-bandit = [
"+*",
"-S101", # Use of assert detected.
]