Initial
This commit is contained in:
commit
a355de5d8b
24 changed files with 1133 additions and 0 deletions
0
advent/days/__init__.py
Normal file
0
advent/days/__init__.py
Normal file
0
advent/days/day__/__init__.py
Normal file
0
advent/days/day__/__init__.py
Normal file
0
advent/days/day__/data/input.txt
Normal file
0
advent/days/day__/data/input.txt
Normal file
13
advent/days/day__/solution.py
Normal file
13
advent/days/day__/solution.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Iterator
|
||||
|
||||
day_num = 0
|
||||
|
||||
|
||||
def part1(lines: Iterator[str]) -> None:
|
||||
return None
|
||||
|
||||
|
||||
def part2(lines: Iterator[str]) -> None:
|
||||
return None
|
||||
17
advent/days/day__/test_solution.py
Normal file
17
advent/days/day__/test_solution.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from advent.common import utils
|
||||
|
||||
from .solution import day_num, part1, part2
|
||||
|
||||
|
||||
def test_part1():
|
||||
data = utils.read_data(day_num, '')
|
||||
expected = None
|
||||
result = part1(data)
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_part2():
|
||||
data = utils.read_data(day_num, '')
|
||||
expected = None
|
||||
result = part2(data)
|
||||
assert result == expected
|
||||
23
advent/days/template.py
Normal file
23
advent/days/template.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import typing
|
||||
|
||||
ResultType = int | str | list[str]
|
||||
|
||||
|
||||
class Day(typing.Protocol):
|
||||
day_num: int
|
||||
|
||||
@staticmethod
|
||||
def part1(lines: typing.Iterator[str]) -> ResultType | None:
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def part2(lines: typing.Iterator[str]) -> ResultType | None:
|
||||
...
|
||||
|
||||
|
||||
def is_day(object: typing.Any) -> typing.TypeGuard[Day]:
|
||||
try:
|
||||
return (isinstance(object.day_num, int)
|
||||
and callable(object.part1) and callable(object.part2))
|
||||
except AttributeError:
|
||||
return False
|
||||
Loading…
Add table
Add a link
Reference in a new issue