diff options
| author | 2023-11-19 16:55:03 +0100 | |
|---|---|---|
| committer | 2025-12-01 09:53:01 +0100 | |
| commit | d7e30321ae6ae4c82a8ab7455f6ce33afd719c67 (patch) | |
| tree | e873d640f909ae3e247adc7661b7d954c8af3a26 | |
| download | 2025-d7e30321ae6ae4c82a8ab7455f6ce33afd719c67.tar.gz 2025-d7e30321ae6ae4c82a8ab7455f6ce33afd719c67.tar.bz2 2025-d7e30321ae6ae4c82a8ab7455f6ce33afd719c67.zip | |
Initial commit
| -rw-r--r-- | .gitignore | 235 | ||||
| -rw-r--r-- | .pre-commit-config.yaml | 15 | ||||
| -rw-r--r-- | README.md | 0 | ||||
| -rw-r--r-- | aoc/__init__.py | 43 | ||||
| -rw-r--r-- | aoc/__main__.py | 72 | ||||
| -rw-r--r-- | aoc/datastructures.py | 98 | ||||
| -rw-r--r-- | aoc/decorators.py | 29 | ||||
| -rw-r--r-- | aoc/mixins.py | 77 | ||||
| -rw-r--r-- | aoc/template/__init__.py | 16 | ||||
| -rw-r--r-- | aoc/template/example.txt | 0 | ||||
| -rw-r--r-- | aoc/template/input.txt | 0 | ||||
| -rw-r--r-- | aoc/test_init.py | 8 | ||||
| -rw-r--r-- | aoc/tests/__init__.py | 0 | ||||
| -rw-r--r-- | aoc/tests/test_datastructures.py | 112 | ||||
| -rw-r--r-- | aoc/utils.py | 6 | ||||
| -rw-r--r-- | conftest.py | 36 | ||||
| -rw-r--r-- | pyproject.toml | 11 | ||||
| -rw-r--r-- | uv.lock | 195 |
18 files changed, 953 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0618b3a --- /dev/null +++ b/.gitignore | |||
| @@ -0,0 +1,235 @@ | |||
| 1 | |||
| 2 | # Created by https://www.toptal.com/developers/gitignore/api/python,pycharm+all | ||
| 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=python,pycharm+all | ||
| 4 | |||
| 5 | ### PyCharm+all ### | ||
| 6 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
| 7 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
| 8 | |||
| 9 | # User-specific stuff | ||
| 10 | .idea/**/workspace.xml | ||
| 11 | .idea/**/tasks.xml | ||
| 12 | .idea/**/usage.statistics.xml | ||
| 13 | .idea/**/dictionaries | ||
| 14 | .idea/**/shelf | ||
| 15 | |||
| 16 | # Generated files | ||
| 17 | .idea/**/contentModel.xml | ||
| 18 | |||
| 19 | # Sensitive or high-churn files | ||
| 20 | .idea/**/dataSources/ | ||
| 21 | .idea/**/dataSources.ids | ||
| 22 | .idea/**/dataSources.local.xml | ||
| 23 | .idea/**/sqlDataSources.xml | ||
| 24 | .idea/**/dynamic.xml | ||
| 25 | .idea/**/uiDesigner.xml | ||
| 26 | .idea/**/dbnavigator.xml | ||
| 27 | |||
| 28 | # Gradle | ||
| 29 | .idea/**/gradle.xml | ||
| 30 | .idea/**/libraries | ||
| 31 | |||
| 32 | # Gradle and Maven with auto-import | ||
| 33 | # When using Gradle or Maven with auto-import, you should exclude module files, | ||
| 34 | # since they will be recreated, and may cause churn. Uncomment if using | ||
| 35 | # auto-import. | ||
| 36 | # .idea/artifacts | ||
| 37 | # .idea/compiler.xml | ||
| 38 | # .idea/jarRepositories.xml | ||
| 39 | # .idea/modules.xml | ||
| 40 | # .idea/*.iml | ||
| 41 | # .idea/modules | ||
| 42 | # *.iml | ||
| 43 | # *.ipr | ||
| 44 | |||
| 45 | # CMake | ||
| 46 | cmake-build-*/ | ||
| 47 | |||
| 48 | # Mongo Explorer plugin | ||
| 49 | .idea/**/mongoSettings.xml | ||
| 50 | |||
| 51 | # File-based project format | ||
| 52 | *.iws | ||
| 53 | |||
| 54 | # IntelliJ | ||
| 55 | out/ | ||
| 56 | |||
| 57 | # mpeltonen/sbt-idea plugin | ||
| 58 | .idea_modules/ | ||
| 59 | |||
| 60 | # JIRA plugin | ||
| 61 | atlassian-ide-plugin.xml | ||
| 62 | |||
| 63 | # Cursive Clojure plugin | ||
| 64 | .idea/replstate.xml | ||
| 65 | |||
| 66 | # Crashlytics plugin (for Android Studio and IntelliJ) | ||
| 67 | com_crashlytics_export_strings.xml | ||
| 68 | crashlytics.properties | ||
| 69 | crashlytics-build.properties | ||
| 70 | fabric.properties | ||
| 71 | |||
| 72 | # Editor-based Rest Client | ||
| 73 | .idea/httpRequests | ||
| 74 | |||
| 75 | # Android studio 3.1+ serialized cache file | ||
| 76 | .idea/caches/build_file_checksums.ser | ||
| 77 | |||
| 78 | ### PyCharm+all Patch ### | ||
| 79 | # Ignores the whole .idea folder and all .iml files | ||
| 80 | # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 | ||
| 81 | |||
| 82 | .idea/ | ||
| 83 | |||
| 84 | # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 | ||
| 85 | |||
| 86 | *.iml | ||
| 87 | modules.xml | ||
| 88 | .idea/misc.xml | ||
| 89 | *.ipr | ||
| 90 | |||
| 91 | # Sonarlint plugin | ||
| 92 | .idea/sonarlint | ||
| 93 | |||
| 94 | ### Python ### | ||
| 95 | # Byte-compiled / optimized / DLL files | ||
| 96 | __pycache__/ | ||
| 97 | *.py[cod] | ||
| 98 | *$py.class | ||
| 99 | |||
| 100 | # C extensions | ||
| 101 | *.so | ||
| 102 | |||
| 103 | # Distribution / packaging | ||
| 104 | .Python | ||
| 105 | build/ | ||
| 106 | develop-eggs/ | ||
| 107 | dist/ | ||
| 108 | downloads/ | ||
| 109 | eggs/ | ||
| 110 | .eggs/ | ||
| 111 | lib/ | ||
| 112 | lib64/ | ||
| 113 | parts/ | ||
| 114 | sdist/ | ||
| 115 | var/ | ||
| 116 | wheels/ | ||
| 117 | pip-wheel-metadata/ | ||
| 118 | share/python-wheels/ | ||
| 119 | *.egg-info/ | ||
| 120 | .installed.cfg | ||
| 121 | *.egg | ||
| 122 | MANIFEST | ||
| 123 | |||
| 124 | # PyInstaller | ||
| 125 | # Usually these files are written by a python script from a template | ||
| 126 | # before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
| 127 | *.manifest | ||
| 128 | *.spec | ||
| 129 | |||
| 130 | # Installer logs | ||
| 131 | pip-log.txt | ||
| 132 | pip-delete-this-directory.txt | ||
| 133 | |||
| 134 | # Unit test / coverage reports | ||
| 135 | htmlcov/ | ||
| 136 | .tox/ | ||
| 137 | .nox/ | ||
| 138 | .coverage | ||
| 139 | .coverage.* | ||
| 140 | .cache | ||
| 141 | nosetests.xml | ||
| 142 | coverage.xml | ||
| 143 | *.cover | ||
| 144 | *.py,cover | ||
| 145 | .hypothesis/ | ||
| 146 | .pytest_cache/ | ||
| 147 | pytestdebug.log | ||
| 148 | |||
| 149 | # Translations | ||
| 150 | *.mo | ||
| 151 | *.pot | ||
| 152 | |||
| 153 | # Django stuff: | ||
| 154 | *.log | ||
| 155 | local_settings.py | ||
| 156 | db.sqlite3 | ||
| 157 | db.sqlite3-journal | ||
| 158 | |||
| 159 | # Flask stuff: | ||
| 160 | instance/ | ||
| 161 | .webassets-cache | ||
| 162 | |||
| 163 | # Scrapy stuff: | ||
| 164 | .scrapy | ||
| 165 | |||
| 166 | # Sphinx documentation | ||
| 167 | docs/_build/ | ||
| 168 | doc/_build/ | ||
| 169 | |||
| 170 | # PyBuilder | ||
| 171 | target/ | ||
| 172 | |||
| 173 | # Jupyter Notebook | ||
| 174 | .ipynb_checkpoints | ||
| 175 | |||
| 176 | # IPython | ||
| 177 | profile_default/ | ||
| 178 | ipython_config.py | ||
| 179 | |||
| 180 | # pyenv | ||
| 181 | .python-version | ||
| 182 | |||
| 183 | # pipenv | ||
| 184 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
| 185 | # However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
| 186 | # having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
| 187 | # install all needed dependencies. | ||
| 188 | #Pipfile.lock | ||
| 189 | |||
| 190 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
| 191 | __pypackages__/ | ||
| 192 | |||
| 193 | # Celery stuff | ||
| 194 | celerybeat-schedule | ||
| 195 | celerybeat.pid | ||
| 196 | |||
| 197 | # SageMath parsed files | ||
| 198 | *.sage.py | ||
| 199 | |||
| 200 | # Environments | ||
| 201 | .env | ||
| 202 | .venv | ||
| 203 | env/ | ||
| 204 | venv/ | ||
| 205 | ENV/ | ||
| 206 | env.bak/ | ||
| 207 | venv.bak/ | ||
| 208 | pythonenv* | ||
| 209 | |||
| 210 | # Spyder project settings | ||
| 211 | .spyderproject | ||
| 212 | .spyproject | ||
| 213 | |||
| 214 | # Rope project settings | ||
| 215 | .ropeproject | ||
| 216 | |||
| 217 | # mkdocs documentation | ||
| 218 | /site | ||
| 219 | |||
| 220 | # mypy | ||
| 221 | .mypy_cache/ | ||
| 222 | .dmypy.json | ||
| 223 | dmypy.json | ||
| 224 | |||
| 225 | # Pyre type checker | ||
| 226 | .pyre/ | ||
| 227 | |||
| 228 | # pytype static type analyzer | ||
| 229 | .pytype/ | ||
| 230 | |||
| 231 | # profiling data | ||
| 232 | .prof | ||
| 233 | |||
| 234 | .DS_Store | ||
| 235 | # End of https://www.toptal.com/developers/gitignore/api/python,pycharm+all | ||
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..0715fe6 --- /dev/null +++ b/.pre-commit-config.yaml | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # See https://pre-commit.com for more information | ||
| 2 | # See https://pre-commit.com/hooks.html for more hooks | ||
| 3 | repos: | ||
| 4 | - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| 5 | rev: v4.5.0 | ||
| 6 | hooks: | ||
| 7 | - id: trailing-whitespace | ||
| 8 | - id: end-of-file-fixer | ||
| 9 | - id: check-merge-conflict | ||
| 10 | - id: debug-statements | ||
| 11 | - id: fix-encoding-pragma | ||
| 12 | - repo: https://github.com/psf/black | ||
| 13 | rev: 23.11.0 | ||
| 14 | hooks: | ||
| 15 | - id: black | ||
diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/README.md | |||
diff --git a/aoc/__init__.py b/aoc/__init__.py new file mode 100644 index 0000000..7a089f6 --- /dev/null +++ b/aoc/__init__.py | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | import os | ||
| 3 | from abc import ABC | ||
| 4 | from typing import Generator, Any, Iterator, Dict, TypeVar, Generic | ||
| 5 | |||
| 6 | T = TypeVar("T") | ||
| 7 | I = TypeVar("I") | ||
| 8 | |||
| 9 | |||
| 10 | class BaseAssignment(Generic[T, I], ABC): | ||
| 11 | example_result: T = NotImplemented | ||
| 12 | example_kwargs: Dict = {} | ||
| 13 | |||
| 14 | def __init__(self, path): | ||
| 15 | self.path = path | ||
| 16 | |||
| 17 | def __str__(self): | ||
| 18 | return f"{self.__module__}.{self.__class__.__name__}" | ||
| 19 | |||
| 20 | def parse_item(self, item: str) -> I: | ||
| 21 | return item | ||
| 22 | |||
| 23 | @property | ||
| 24 | def part(self) -> int: | ||
| 25 | return 1 if self.__class__.__name__.endswith("One") else 2 | ||
| 26 | |||
| 27 | def read_input(self, example=False) -> Iterator[I]: | ||
| 28 | file = f"{self.path}/input.txt" | ||
| 29 | |||
| 30 | if example or not os.path.isfile(file): | ||
| 31 | for file in [ | ||
| 32 | f"{self.path}/example_part_{self.part}.txt", | ||
| 33 | f"{self.path}/example.txt", | ||
| 34 | ]: | ||
| 35 | if os.path.exists(file): | ||
| 36 | break | ||
| 37 | |||
| 38 | with open(file, "r") as input_file: | ||
| 39 | for line in input_file.readlines(): | ||
| 40 | yield self.parse_item(line.strip("\n")) | ||
| 41 | |||
| 42 | def run(self, input: Iterator[I]) -> T: | ||
| 43 | raise NotImplementedError("Please implement run") | ||
diff --git a/aoc/__main__.py b/aoc/__main__.py new file mode 100644 index 0000000..596abee --- /dev/null +++ b/aoc/__main__.py | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | import enum | ||
| 3 | import typing | ||
| 4 | import importlib | ||
| 5 | import os | ||
| 6 | from pathlib import Path | ||
| 7 | from shutil import copytree | ||
| 8 | from time import perf_counter | ||
| 9 | from typing import List, Callable | ||
| 10 | import typer | ||
| 11 | |||
| 12 | app = typer.Typer() | ||
| 13 | |||
| 14 | |||
| 15 | class AssignmentPart(str, enum.Enum): | ||
| 16 | One = "1" | ||
| 17 | Two = "2" | ||
| 18 | |||
| 19 | |||
| 20 | def day(assignment_part: str) -> str: | ||
| 21 | return AssignmentPart(assignment_part).name | ||
| 22 | |||
| 23 | |||
| 24 | def kwargs(kwarg: str) -> List: | ||
| 25 | return kwarg.split("=") | ||
| 26 | |||
| 27 | |||
| 28 | @app.command() | ||
| 29 | def run( | ||
| 30 | day: str, | ||
| 31 | part: str = typer.Option( | ||
| 32 | "1", "--part", help="Assignment part. Defaults to 'One'.", show_choices=True | ||
| 33 | ), | ||
| 34 | example: bool = typer.Option(False, "--example", help="Use an example input file"), | ||
| 35 | kwargs: List[str] = typer.Argument(None), | ||
| 36 | ): | ||
| 37 | assignment_day = importlib.import_module(day) | ||
| 38 | |||
| 39 | Assignment = getattr(assignment_day, f"Assignment{AssignmentPart(part).name}") | ||
| 40 | assignment = Assignment( | ||
| 41 | path=os.path.dirname(assignment_day.__file__), **dict(kwargs) | ||
| 42 | ) | ||
| 43 | |||
| 44 | start = perf_counter() | ||
| 45 | typer.echo( | ||
| 46 | assignment.run( | ||
| 47 | input=assignment.read_input(example=example), | ||
| 48 | ) | ||
| 49 | ) | ||
| 50 | end = perf_counter() | ||
| 51 | delta = end - start | ||
| 52 | typer.secho( | ||
| 53 | f'\n{(delta if delta > 1 else delta * 1000):.3f}{"s" if delta > 1 else "ms"}', | ||
| 54 | fg="green", | ||
| 55 | ) | ||
| 56 | |||
| 57 | |||
| 58 | @app.command() | ||
| 59 | def new(day: str): | ||
| 60 | self = importlib.import_module(".", package="aoc") | ||
| 61 | path = Path(self.__file__) | ||
| 62 | template = path.parent.joinpath("template") | ||
| 63 | target = path.parent.parent.joinpath(day) | ||
| 64 | |||
| 65 | try: | ||
| 66 | copytree(template, target) | ||
| 67 | except FileExistsError: | ||
| 68 | typer.secho(f"{day} already exists", fg="red") | ||
| 69 | |||
| 70 | |||
| 71 | if __name__ == "__main__": | ||
| 72 | app() | ||
diff --git a/aoc/datastructures.py b/aoc/datastructures.py new file mode 100644 index 0000000..1f141e2 --- /dev/null +++ b/aoc/datastructures.py | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | from collections import namedtuple | ||
| 3 | from typing import Iterator | ||
| 4 | |||
| 5 | |||
| 6 | class Coordinate(namedtuple("Coordinate", ["x", "y"])): | ||
| 7 | def __sub__(self, other: "Coordinate") -> "Coordinate": | ||
| 8 | return Coordinate(self.x - other.x, self.y - other.y) | ||
| 9 | |||
| 10 | def __add__(self, other: "Coordinate") -> "Coordinate": | ||
| 11 | return Coordinate(self.x + other.x, self.y + other.y) | ||
| 12 | |||
| 13 | def manhattan_distance(self, other: "Coordinate") -> int: | ||
| 14 | return abs(self.x - other.x) + abs(self.y - other.y) | ||
| 15 | |||
| 16 | @property | ||
| 17 | def polarity(self) -> "Coordinate": | ||
| 18 | try: | ||
| 19 | px = abs(self.x) / self.x | ||
| 20 | except ZeroDivisionError: | ||
| 21 | px = 0 | ||
| 22 | |||
| 23 | try: | ||
| 24 | py = abs(self.y) / self.y | ||
| 25 | except ZeroDivisionError: | ||
| 26 | py = 0 | ||
| 27 | |||
| 28 | return Coordinate( | ||
| 29 | px, | ||
| 30 | py, | ||
| 31 | ) | ||
| 32 | |||
| 33 | def neighbours(self, no_diagonal: bool = False) -> Iterator["Coordinate"]: | ||
| 34 | if no_diagonal: | ||
| 35 | yield self + Coordinate(-1, 0) | ||
| 36 | yield self + Coordinate(1, 0) | ||
| 37 | yield self + Coordinate(0, -1) | ||
| 38 | yield self + Coordinate(0, 1) | ||
| 39 | else: | ||
| 40 | for dy in range(self.y - 1, self.y + 2): | ||
| 41 | for dx in range(self.x - 1, self.x + 2): | ||
| 42 | if dy == self.y and dx == self.x: | ||
| 43 | continue | ||
| 44 | |||
| 45 | yield Coordinate(dx, dy) | ||
| 46 | |||
| 47 | |||
| 48 | class Coordinate3(namedtuple("Coordinate3", ["x", "y", "z"])): | ||
| 49 | def __sub__(self, other: "Coordinate3") -> "Coordinate3": | ||
| 50 | return Coordinate3(self.x - other.x, self.y - other.y, self.z - other.z) | ||
| 51 | |||
| 52 | def __add__(self, other: "Coordinate3") -> "Coordinate3": | ||
| 53 | return Coordinate3(self.x + other.x, self.y + other.y, self.z + other.z) | ||
| 54 | |||
| 55 | def manhattan_distance(self, other: "Coordinate3") -> int: | ||
| 56 | return abs(self.x - other.x) + abs(self.y - other.y) + abs(self.z - other.z) | ||
| 57 | |||
| 58 | @property | ||
| 59 | def polarity(self) -> "Coordinate3": | ||
| 60 | try: | ||
| 61 | px = abs(self.x) / self.x | ||
| 62 | except ZeroDivisionError: | ||
| 63 | px = 0 | ||
| 64 | |||
| 65 | try: | ||
| 66 | py = abs(self.y) / self.y | ||
| 67 | except ZeroDivisionError: | ||
| 68 | py = 0 | ||
| 69 | |||
| 70 | try: | ||
| 71 | pz = abs(self.z) / self.z | ||
| 72 | except ZeroDivisionError: | ||
| 73 | pz = 0 | ||
| 74 | |||
| 75 | return Coordinate3( | ||
| 76 | px, | ||
| 77 | py, | ||
| 78 | pz, | ||
| 79 | ) | ||
| 80 | |||
| 81 | def neighbours(self, no_diagonal: bool = False) -> Iterator["Coordinate3"]: | ||
| 82 | if no_diagonal: | ||
| 83 | yield self + Coordinate3(-1, 0, 0) | ||
| 84 | yield self + Coordinate3(1, 0, 0) | ||
| 85 | yield self + Coordinate3(0, -1, 0) | ||
| 86 | yield self + Coordinate3(0, 1, 0) | ||
| 87 | yield self + Coordinate3(0, 0, -1) | ||
| 88 | yield self + Coordinate3(0, 0, 1) | ||
| 89 | else: | ||
| 90 | for dz in range(self.z - 1, self.z + 2): | ||
| 91 | for dy in range(self.y - 1, self.y + 2): | ||
| 92 | for dx in range(self.x - 1, self.x + 2): | ||
| 93 | coordinate = Coordinate3(dx, dy, dz) | ||
| 94 | |||
| 95 | if dy == self.y and dx == self.x and dz == self.z: | ||
| 96 | continue | ||
| 97 | |||
| 98 | yield coordinate | ||
diff --git a/aoc/decorators.py b/aoc/decorators.py new file mode 100644 index 0000000..98246e6 --- /dev/null +++ b/aoc/decorators.py | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | from functools import wraps | ||
| 3 | from typing import Iterator, TypeVar, Callable, List | ||
| 4 | |||
| 5 | T = TypeVar("T") | ||
| 6 | I = TypeVar("I") | ||
| 7 | |||
| 8 | AssignmentRun = Callable[[Iterator[I], ...], Iterator[T]] | ||
| 9 | AssignmentRunList = Callable[[List[I], ...], Iterator[T]] | ||
| 10 | |||
| 11 | |||
| 12 | def infinite_generator(func: AssignmentRun) -> AssignmentRun: | ||
| 13 | @wraps(func) | ||
| 14 | def wrapper(*args, **kwargs): | ||
| 15 | items = list(func(*args, **kwargs)) | ||
| 16 | |||
| 17 | while True: | ||
| 18 | for item in items: | ||
| 19 | yield item | ||
| 20 | |||
| 21 | return wrapper | ||
| 22 | |||
| 23 | |||
| 24 | def list_input(func: AssignmentRun) -> AssignmentRunList: | ||
| 25 | @wraps(func) | ||
| 26 | def wrapper(self, input: Iterator, *args, **kwargs) -> T: | ||
| 27 | return func(self, list(input), *args, **kwargs) | ||
| 28 | |||
| 29 | return wrapper | ||
diff --git a/aoc/mixins.py b/aoc/mixins.py new file mode 100644 index 0000000..5986b6e --- /dev/null +++ b/aoc/mixins.py | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | from math import floor, inf | ||
| 3 | from typing import Tuple, TypeVar, Generic, Callable, Iterator, List, Dict | ||
| 4 | |||
| 5 | Node = TypeVar("Node") | ||
| 6 | |||
| 7 | |||
| 8 | class AStarMixin(Generic[Node]): | ||
| 9 | def _gen_path(self, current: Node, came_from: Dict[Node, Node]) -> List[Node]: | ||
| 10 | print("GENPATH") | ||
| 11 | path = [current] | ||
| 12 | |||
| 13 | while current in came_from: | ||
| 14 | current = came_from[current] | ||
| 15 | path = [current, *path] | ||
| 16 | |||
| 17 | return path | ||
| 18 | |||
| 19 | def a_star( | ||
| 20 | self, | ||
| 21 | start: Node, | ||
| 22 | end: Callable[[Node, Callable[[], List[Node]]], bool], | ||
| 23 | neighbours: Callable[[Node], Iterator[Node]], | ||
| 24 | distance: Callable[[Node, Node], int] = lambda a, b: 1, | ||
| 25 | heuristic: Callable[[Node], int] = lambda a: 0, | ||
| 26 | ) -> List[Node]: | ||
| 27 | open_nodes = {start} | ||
| 28 | came_from = {} | ||
| 29 | |||
| 30 | g_scores = {start: 0} | ||
| 31 | |||
| 32 | f_scores = {start: heuristic(start)} | ||
| 33 | |||
| 34 | while True: | ||
| 35 | try: | ||
| 36 | current = sorted( | ||
| 37 | [item for item in open_nodes], | ||
| 38 | key=lambda item: f_scores.get(item, inf), | ||
| 39 | )[0] | ||
| 40 | except IndexError: | ||
| 41 | raise RuntimeError("No path found") | ||
| 42 | |||
| 43 | if end(current, lambda: self._gen_path(current, came_from)): | ||
| 44 | return self._gen_path(current, came_from) | ||
| 45 | |||
| 46 | open_nodes.remove(current) | ||
| 47 | |||
| 48 | for neighbour in neighbours(current): | ||
| 49 | g_score = g_scores.get(current, inf) + distance(current, neighbour) | ||
| 50 | |||
| 51 | if g_score < g_scores.get(neighbour, inf): | ||
| 52 | came_from[neighbour] = current | ||
| 53 | g_scores[neighbour] = g_score | ||
| 54 | f_scores[neighbour] = g_score + heuristic(neighbour) | ||
| 55 | |||
| 56 | if neighbour not in open_nodes: | ||
| 57 | open_nodes.add(neighbour) | ||
| 58 | |||
| 59 | |||
| 60 | class BreathFirstSearchMixin(Generic[Node]): | ||
| 61 | @staticmethod | ||
| 62 | def bfs( | ||
| 63 | start: Node, neighbours: Callable[[Node], Iterator[Node]] | ||
| 64 | ) -> Iterator[Node]: | ||
| 65 | queue = [start] | ||
| 66 | searched = set() | ||
| 67 | |||
| 68 | while len(queue): | ||
| 69 | item = queue.pop(0) | ||
| 70 | |||
| 71 | for neighbour in neighbours(item): | ||
| 72 | if neighbour not in searched and neighbour not in set(queue): | ||
| 73 | queue.append(neighbour) | ||
| 74 | |||
| 75 | searched.add(item) | ||
| 76 | |||
| 77 | yield item | ||
diff --git a/aoc/template/__init__.py b/aoc/template/__init__.py new file mode 100644 index 0000000..05b2b45 --- /dev/null +++ b/aoc/template/__init__.py | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | from abc import ABC | ||
| 3 | |||
| 4 | from aoc import BaseAssignment | ||
| 5 | |||
| 6 | |||
| 7 | class Assignment(BaseAssignment, ABC): | ||
| 8 | pass | ||
| 9 | |||
| 10 | |||
| 11 | class AssignmentOne(Assignment): | ||
| 12 | pass | ||
| 13 | |||
| 14 | |||
| 15 | class AssignmentTwo(Assignment): | ||
| 16 | pass | ||
diff --git a/aoc/template/example.txt b/aoc/template/example.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/aoc/template/example.txt | |||
diff --git a/aoc/template/input.txt b/aoc/template/input.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/aoc/template/input.txt | |||
diff --git a/aoc/test_init.py b/aoc/test_init.py new file mode 100644 index 0000000..e52daf7 --- /dev/null +++ b/aoc/test_init.py | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | def test_assignment_examples(assignment): | ||
| 3 | assert ( | ||
| 4 | assignment.run( | ||
| 5 | input=assignment.read_input(example=True), **assignment.example_kwargs | ||
| 6 | ) | ||
| 7 | == assignment.example_result | ||
| 8 | ) | ||
diff --git a/aoc/tests/__init__.py b/aoc/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/aoc/tests/__init__.py | |||
diff --git a/aoc/tests/test_datastructures.py b/aoc/tests/test_datastructures.py new file mode 100644 index 0000000..1c291cc --- /dev/null +++ b/aoc/tests/test_datastructures.py | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | from aoc.datastructures import Coordinate, Coordinate3 | ||
| 3 | |||
| 4 | |||
| 5 | class TestCoordinate: | ||
| 6 | def test_addition(self): | ||
| 7 | c1 = Coordinate(1, 1) | ||
| 8 | c2 = Coordinate(2, 2) | ||
| 9 | assert c1 + c2 == Coordinate(3, 3) | ||
| 10 | |||
| 11 | def test_subtraction(self): | ||
| 12 | c1 = Coordinate(2, 2) | ||
| 13 | c2 = Coordinate(1, 1) | ||
| 14 | assert c1 - c2 == Coordinate(1, 1) | ||
| 15 | |||
| 16 | def test_manhattan_distance(self): | ||
| 17 | c1 = Coordinate(1, 1) | ||
| 18 | c2 = Coordinate(3, 3) | ||
| 19 | assert c1.manhattan_distance(c2) == 4 | ||
| 20 | |||
| 21 | def test_polarity(self): | ||
| 22 | c1 = Coordinate(2, -3) | ||
| 23 | assert c1.polarity == Coordinate(1, -1) | ||
| 24 | |||
| 25 | def test_neighbours(self): | ||
| 26 | c = Coordinate(0, 0) | ||
| 27 | neighbours = { | ||
| 28 | Coordinate(-1, 0), | ||
| 29 | Coordinate(1, 0), | ||
| 30 | Coordinate(0, -1), | ||
| 31 | Coordinate(0, 1), | ||
| 32 | Coordinate(-1, -1), | ||
| 33 | Coordinate(-1, 1), | ||
| 34 | Coordinate(1, -1), | ||
| 35 | Coordinate(1, 1), | ||
| 36 | } | ||
| 37 | assert set(c.neighbours()) == neighbours | ||
| 38 | |||
| 39 | def test_neighbours_no_diagonal(self): | ||
| 40 | c = Coordinate(0, 0) | ||
| 41 | neighbours_no_diagonal = { | ||
| 42 | Coordinate(-1, 0), | ||
| 43 | Coordinate(1, 0), | ||
| 44 | Coordinate(0, -1), | ||
| 45 | Coordinate(0, 1), | ||
| 46 | } | ||
| 47 | assert set(c.neighbours(no_diagonal=True)) == neighbours_no_diagonal | ||
| 48 | |||
| 49 | |||
| 50 | class TestCoordinate3: | ||
| 51 | def test_addition(self): | ||
| 52 | c1 = Coordinate3(1, 1, 1) | ||
| 53 | c2 = Coordinate3(2, 2, 2) | ||
| 54 | assert c1 + c2 == Coordinate3(3, 3, 3) | ||
| 55 | |||
| 56 | def test_subtraction(self): | ||
| 57 | c1 = Coordinate3(2, 2, 2) | ||
| 58 | c2 = Coordinate3(1, 1, 1) | ||
| 59 | assert c1 - c2 == Coordinate3(1, 1, 1) | ||
| 60 | |||
| 61 | def test_manhattan_distance(self): | ||
| 62 | c1 = Coordinate3(1, 1, 1) | ||
| 63 | c2 = Coordinate3(3, 3, 3) | ||
| 64 | assert c1.manhattan_distance(c2) == 6 | ||
| 65 | |||
| 66 | def test_polarity(self): | ||
| 67 | c1 = Coordinate3(2, -3, 0) | ||
| 68 | assert c1.polarity == Coordinate3(1, -1, 0) | ||
| 69 | |||
| 70 | def test_neighbours(self): | ||
| 71 | c = Coordinate3(0, 0, 0) | ||
| 72 | neighbours = { | ||
| 73 | Coordinate3(-1, -1, -1), | ||
| 74 | Coordinate3(-1, -1, 0), | ||
| 75 | Coordinate3(-1, -1, 1), | ||
| 76 | Coordinate3(-1, 0, -1), | ||
| 77 | Coordinate3(-1, 0, 0), | ||
| 78 | Coordinate3(-1, 0, 1), | ||
| 79 | Coordinate3(-1, 1, -1), | ||
| 80 | Coordinate3(-1, 1, 0), | ||
| 81 | Coordinate3(-1, 1, 1), | ||
| 82 | Coordinate3(0, -1, -1), | ||
| 83 | Coordinate3(0, -1, 0), | ||
| 84 | Coordinate3(0, -1, 1), | ||
| 85 | Coordinate3(0, 0, -1), | ||
| 86 | Coordinate3(0, 0, 1), | ||
| 87 | Coordinate3(0, 1, -1), | ||
| 88 | Coordinate3(0, 1, 0), | ||
| 89 | Coordinate3(0, 1, 1), | ||
| 90 | Coordinate3(1, -1, -1), | ||
| 91 | Coordinate3(1, -1, 0), | ||
| 92 | Coordinate3(1, -1, 1), | ||
| 93 | Coordinate3(1, 0, -1), | ||
| 94 | Coordinate3(1, 0, 0), | ||
| 95 | Coordinate3(1, 0, 1), | ||
| 96 | Coordinate3(1, 1, -1), | ||
| 97 | Coordinate3(1, 1, 0), | ||
| 98 | Coordinate3(1, 1, 1), | ||
| 99 | } | ||
| 100 | assert set(c.neighbours()) == neighbours | ||
| 101 | |||
| 102 | def test_neighbours_no_diagonal(self): | ||
| 103 | c = Coordinate3(0, 0, 0) | ||
| 104 | neighbours_no_diagonal = { | ||
| 105 | Coordinate3(-1, 0, 0), | ||
| 106 | Coordinate3(1, 0, 0), | ||
| 107 | Coordinate3(0, -1, 0), | ||
| 108 | Coordinate3(0, 1, 0), | ||
| 109 | Coordinate3(0, 0, -1), | ||
| 110 | Coordinate3(0, 0, 1), | ||
| 111 | } | ||
| 112 | assert set(c.neighbours(no_diagonal=True)) == neighbours_no_diagonal | ||
diff --git a/aoc/utils.py b/aoc/utils.py new file mode 100644 index 0000000..a5de050 --- /dev/null +++ b/aoc/utils.py | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | from typing import Callable | ||
| 3 | |||
| 4 | |||
| 5 | def bold(item: str, condition: Callable[[], bool]): | ||
| 6 | return f"\033[36m{item}\033[0m" if condition() else item | ||
diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..1c0a8e4 --- /dev/null +++ b/conftest.py | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | import importlib | ||
| 3 | import os | ||
| 4 | from pkgutil import walk_packages | ||
| 5 | |||
| 6 | from _pytest.python import Metafunc | ||
| 7 | |||
| 8 | from aoc.__main__ import day | ||
| 9 | |||
| 10 | dir_path = os.path.dirname(os.path.realpath(__file__)) | ||
| 11 | |||
| 12 | |||
| 13 | def pytest_generate_tests(metafunc: Metafunc): | ||
| 14 | if "assignment" in metafunc.fixturenames: | ||
| 15 | packages = [ | ||
| 16 | importlib.import_module(package.name) | ||
| 17 | for package in walk_packages([dir_path]) | ||
| 18 | ] | ||
| 19 | |||
| 20 | assignments = [ | ||
| 21 | (getattr(package, f"Assignment{day(part)}", None), package) | ||
| 22 | for package in packages | ||
| 23 | for part in ["1", "2"] | ||
| 24 | ] | ||
| 25 | |||
| 26 | metafunc.parametrize( | ||
| 27 | argnames=f"assignment", | ||
| 28 | argvalues=[ | ||
| 29 | Assignment(path=package.__path__[0]) | ||
| 30 | for (Assignment, package) in assignments | ||
| 31 | if Assignment is not None | ||
| 32 | and hasattr(package, "__path__") | ||
| 33 | and Assignment.example_result != NotImplemented | ||
| 34 | ], | ||
| 35 | ids=lambda assignment: str(assignment), | ||
| 36 | ) | ||
diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0ad8381 --- /dev/null +++ b/pyproject.toml | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | [project] | ||
| 2 | name = "aoc2025" | ||
| 3 | version = "0.1.0" | ||
| 4 | description = "Add your description here" | ||
| 5 | readme = "README.md" | ||
| 6 | requires-python = ">=3.14" | ||
| 7 | dependencies = [ | ||
| 8 | "coverage>=7.12.0", | ||
| 9 | "pytest>=9.0.1", | ||
| 10 | "typer[all]>=0.20.0", | ||
| 11 | ] | ||
| @@ -0,0 +1,195 @@ | |||
| 1 | version = 1 | ||
| 2 | revision = 1 | ||
| 3 | requires-python = ">=3.14" | ||
| 4 | |||
| 5 | [[package]] | ||
| 6 | name = "aoc2025" | ||
| 7 | version = "0.1.0" | ||
| 8 | source = { virtual = "." } | ||
| 9 | dependencies = [ | ||
| 10 | { name = "coverage" }, | ||
| 11 | { name = "pytest" }, | ||
| 12 | { name = "typer" }, | ||
| 13 | ] | ||
| 14 | |||
| 15 | [package.metadata] | ||
| 16 | requires-dist = [ | ||
| 17 | { name = "coverage", specifier = ">=7.12.0" }, | ||
| 18 | { name = "pytest", specifier = ">=9.0.1" }, | ||
| 19 | { name = "typer", extras = ["all"], specifier = ">=0.20.0" }, | ||
| 20 | ] | ||
| 21 | |||
| 22 | [[package]] | ||
| 23 | name = "click" | ||
| 24 | version = "8.3.1" | ||
| 25 | source = { registry = "https://pypi.org/simple" } | ||
| 26 | dependencies = [ | ||
| 27 | { name = "colorama", marker = "sys_platform == 'win32'" }, | ||
| 28 | ] | ||
| 29 | sdist = { url = "https://files.pythonhosted.org/packages/3d/fa/656b739db8587d7b5dfa22e22ed02566950fbfbcdc20311993483657a5c0/click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a", size = 295065 } | ||
| 30 | wheels = [ | ||
| 31 | { url = "https://files.pythonhosted.org/packages/98/78/01c019cdb5d6498122777c1a43056ebb3ebfeef2076d9d026bfe15583b2b/click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6", size = 108274 }, | ||
| 32 | ] | ||
| 33 | |||
| 34 | [[package]] | ||
| 35 | name = "colorama" | ||
| 36 | version = "0.4.6" | ||
| 37 | source = { registry = "https://pypi.org/simple" } | ||
| 38 | sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 } | ||
| 39 | wheels = [ | ||
| 40 | { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 }, | ||
| 41 | ] | ||
| 42 | |||
| 43 | [[package]] | ||
| 44 | name = "coverage" | ||
| 45 | version = "7.12.0" | ||
| 46 | source = { registry = "https://pypi.org/simple" } | ||
| 47 | sdist = { url = "https://files.pythonhosted.org/packages/89/26/4a96807b193b011588099c3b5c89fbb05294e5b90e71018e065465f34eb6/coverage-7.12.0.tar.gz", hash = "sha256:fc11e0a4e372cb5f282f16ef90d4a585034050ccda536451901abfb19a57f40c", size = 819341 } | ||
| 48 | wheels = [ | ||
| 49 | { url = "https://files.pythonhosted.org/packages/bf/2e/fc12db0883478d6e12bbd62d481210f0c8daf036102aa11434a0c5755825/coverage-7.12.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:a1c59b7dc169809a88b21a936eccf71c3895a78f5592051b1af8f4d59c2b4f92", size = 217777 }, | ||
| 50 | { url = "https://files.pythonhosted.org/packages/1f/c1/ce3e525d223350c6ec16b9be8a057623f54226ef7f4c2fee361ebb6a02b8/coverage-7.12.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:8787b0f982e020adb732b9f051f3e49dd5054cebbc3f3432061278512a2b1360", size = 218100 }, | ||
| 51 | { url = "https://files.pythonhosted.org/packages/15/87/113757441504aee3808cb422990ed7c8bcc2d53a6779c66c5adef0942939/coverage-7.12.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:5ea5a9f7dc8877455b13dd1effd3202e0bca72f6f3ab09f9036b1bcf728f69ac", size = 249151 }, | ||
| 52 | { url = "https://files.pythonhosted.org/packages/d9/1d/9529d9bd44049b6b05bb319c03a3a7e4b0a8a802d28fa348ad407e10706d/coverage-7.12.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:fdba9f15849534594f60b47c9a30bc70409b54947319a7c4fd0e8e3d8d2f355d", size = 251667 }, | ||
| 53 | { url = "https://files.pythonhosted.org/packages/11/bb/567e751c41e9c03dc29d3ce74b8c89a1e3396313e34f255a2a2e8b9ebb56/coverage-7.12.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a00594770eb715854fb1c57e0dea08cce6720cfbc531accdb9850d7c7770396c", size = 253003 }, | ||
| 54 | { url = "https://files.pythonhosted.org/packages/e4/b3/c2cce2d8526a02fb9e9ca14a263ca6fc074449b33a6afa4892838c903528/coverage-7.12.0-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:5560c7e0d82b42eb1951e4f68f071f8017c824ebfd5a6ebe42c60ac16c6c2434", size = 249185 }, | ||
| 55 | { url = "https://files.pythonhosted.org/packages/0e/a7/967f93bb66e82c9113c66a8d0b65ecf72fc865adfba5a145f50c7af7e58d/coverage-7.12.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:d6c2e26b481c9159c2773a37947a9718cfdc58893029cdfb177531793e375cfc", size = 251025 }, | ||
| 56 | { url = "https://files.pythonhosted.org/packages/b9/b2/f2f6f56337bc1af465d5b2dc1ee7ee2141b8b9272f3bf6213fcbc309a836/coverage-7.12.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:6e1a8c066dabcde56d5d9fed6a66bc19a2883a3fe051f0c397a41fc42aedd4cc", size = 248979 }, | ||
| 57 | { url = "https://files.pythonhosted.org/packages/f4/7a/bf4209f45a4aec09d10a01a57313a46c0e0e8f4c55ff2965467d41a92036/coverage-7.12.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:f7ba9da4726e446d8dd8aae5a6cd872511184a5d861de80a86ef970b5dacce3e", size = 248800 }, | ||
| 58 | { url = "https://files.pythonhosted.org/packages/b8/b7/1e01b8696fb0521810f60c5bbebf699100d6754183e6cc0679bf2ed76531/coverage-7.12.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:e0f483ab4f749039894abaf80c2f9e7ed77bbf3c737517fb88c8e8e305896a17", size = 250460 }, | ||
| 59 | { url = "https://files.pythonhosted.org/packages/71/ae/84324fb9cb46c024760e706353d9b771a81b398d117d8c1fe010391c186f/coverage-7.12.0-cp314-cp314-win32.whl", hash = "sha256:76336c19a9ef4a94b2f8dc79f8ac2da3f193f625bb5d6f51a328cd19bfc19933", size = 220533 }, | ||
| 60 | { url = "https://files.pythonhosted.org/packages/e2/71/1033629deb8460a8f97f83e6ac4ca3b93952e2b6f826056684df8275e015/coverage-7.12.0-cp314-cp314-win_amd64.whl", hash = "sha256:7c1059b600aec6ef090721f8f633f60ed70afaffe8ecab85b59df748f24b31fe", size = 221348 }, | ||
| 61 | { url = "https://files.pythonhosted.org/packages/0a/5f/ac8107a902f623b0c251abdb749be282dc2ab61854a8a4fcf49e276fce2f/coverage-7.12.0-cp314-cp314-win_arm64.whl", hash = "sha256:172cf3a34bfef42611963e2b661302a8931f44df31629e5b1050567d6b90287d", size = 219922 }, | ||
| 62 | { url = "https://files.pythonhosted.org/packages/79/6e/f27af2d4da367f16077d21ef6fe796c874408219fa6dd3f3efe7751bd910/coverage-7.12.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:aa7d48520a32cb21c7a9b31f81799e8eaec7239db36c3b670be0fa2403828d1d", size = 218511 }, | ||
| 63 | { url = "https://files.pythonhosted.org/packages/67/dd/65fd874aa460c30da78f9d259400d8e6a4ef457d61ab052fd248f0050558/coverage-7.12.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:90d58ac63bc85e0fb919f14d09d6caa63f35a5512a2205284b7816cafd21bb03", size = 218771 }, | ||
| 64 | { url = "https://files.pythonhosted.org/packages/55/e0/7c6b71d327d8068cb79c05f8f45bf1b6145f7a0de23bbebe63578fe5240a/coverage-7.12.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:ca8ecfa283764fdda3eae1bdb6afe58bf78c2c3ec2b2edcb05a671f0bba7b3f9", size = 260151 }, | ||
| 65 | { url = "https://files.pythonhosted.org/packages/49/ce/4697457d58285b7200de6b46d606ea71066c6e674571a946a6ea908fb588/coverage-7.12.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:874fe69a0785d96bd066059cd4368022cebbec1a8958f224f0016979183916e6", size = 262257 }, | ||
| 66 | { url = "https://files.pythonhosted.org/packages/2f/33/acbc6e447aee4ceba88c15528dbe04a35fb4d67b59d393d2e0d6f1e242c1/coverage-7.12.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5b3c889c0b8b283a24d721a9eabc8ccafcfc3aebf167e4cd0d0e23bf8ec4e339", size = 264671 }, | ||
| 67 | { url = "https://files.pythonhosted.org/packages/87/ec/e2822a795c1ed44d569980097be839c5e734d4c0c1119ef8e0a073496a30/coverage-7.12.0-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:8bb5b894b3ec09dcd6d3743229dc7f2c42ef7787dc40596ae04c0edda487371e", size = 259231 }, | ||
| 68 | { url = "https://files.pythonhosted.org/packages/72/c5/a7ec5395bb4a49c9b7ad97e63f0c92f6bf4a9e006b1393555a02dae75f16/coverage-7.12.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:79a44421cd5fba96aa57b5e3b5a4d3274c449d4c622e8f76882d76635501fd13", size = 262137 }, | ||
| 69 | { url = "https://files.pythonhosted.org/packages/67/0c/02c08858b764129f4ecb8e316684272972e60777ae986f3865b10940bdd6/coverage-7.12.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:33baadc0efd5c7294f436a632566ccc1f72c867f82833eb59820ee37dc811c6f", size = 259745 }, | ||
| 70 | { url = "https://files.pythonhosted.org/packages/5a/04/4fd32b7084505f3829a8fe45c1a74a7a728cb251aaadbe3bec04abcef06d/coverage-7.12.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:c406a71f544800ef7e9e0000af706b88465f3573ae8b8de37e5f96c59f689ad1", size = 258570 }, | ||
| 71 | { url = "https://files.pythonhosted.org/packages/48/35/2365e37c90df4f5342c4fa202223744119fe31264ee2924f09f074ea9b6d/coverage-7.12.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:e71bba6a40883b00c6d571599b4627f50c360b3d0d02bfc658168936be74027b", size = 260899 }, | ||
| 72 | { url = "https://files.pythonhosted.org/packages/05/56/26ab0464ca733fa325e8e71455c58c1c374ce30f7c04cebb88eabb037b18/coverage-7.12.0-cp314-cp314t-win32.whl", hash = "sha256:9157a5e233c40ce6613dead4c131a006adfda70e557b6856b97aceed01b0e27a", size = 221313 }, | ||
| 73 | { url = "https://files.pythonhosted.org/packages/da/1c/017a3e1113ed34d998b27d2c6dba08a9e7cb97d362f0ec988fcd873dcf81/coverage-7.12.0-cp314-cp314t-win_amd64.whl", hash = "sha256:e84da3a0fd233aeec797b981c51af1cabac74f9bd67be42458365b30d11b5291", size = 222423 }, | ||
| 74 | { url = "https://files.pythonhosted.org/packages/4c/36/bcc504fdd5169301b52568802bb1b9cdde2e27a01d39fbb3b4b508ab7c2c/coverage-7.12.0-cp314-cp314t-win_arm64.whl", hash = "sha256:01d24af36fedda51c2b1aca56e4330a3710f83b02a5ff3743a6b015ffa7c9384", size = 220459 }, | ||
| 75 | { url = "https://files.pythonhosted.org/packages/ce/a3/43b749004e3c09452e39bb56347a008f0a0668aad37324a99b5c8ca91d9e/coverage-7.12.0-py3-none-any.whl", hash = "sha256:159d50c0b12e060b15ed3d39f87ed43d4f7f7ad40b8a534f4dd331adbb51104a", size = 209503 }, | ||
| 76 | ] | ||
| 77 | |||
| 78 | [[package]] | ||
| 79 | name = "iniconfig" | ||
| 80 | version = "2.3.0" | ||
| 81 | source = { registry = "https://pypi.org/simple" } | ||
| 82 | sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503 } | ||
| 83 | wheels = [ | ||
| 84 | { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484 }, | ||
| 85 | ] | ||
| 86 | |||
| 87 | [[package]] | ||
| 88 | name = "markdown-it-py" | ||
| 89 | version = "4.0.0" | ||
| 90 | source = { registry = "https://pypi.org/simple" } | ||
| 91 | dependencies = [ | ||
| 92 | { name = "mdurl" }, | ||
| 93 | ] | ||
| 94 | sdist = { url = "https://files.pythonhosted.org/packages/5b/f5/4ec618ed16cc4f8fb3b701563655a69816155e79e24a17b651541804721d/markdown_it_py-4.0.0.tar.gz", hash = "sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3", size = 73070 } | ||
| 95 | wheels = [ | ||
| 96 | { url = "https://files.pythonhosted.org/packages/94/54/e7d793b573f298e1c9013b8c4dade17d481164aa517d1d7148619c2cedbf/markdown_it_py-4.0.0-py3-none-any.whl", hash = "sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147", size = 87321 }, | ||
| 97 | ] | ||
| 98 | |||
| 99 | [[package]] | ||
| 100 | name = "mdurl" | ||
| 101 | version = "0.1.2" | ||
| 102 | source = { registry = "https://pypi.org/simple" } | ||
| 103 | sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729 } | ||
| 104 | wheels = [ | ||
| 105 | { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979 }, | ||
| 106 | ] | ||
| 107 | |||
| 108 | [[package]] | ||
| 109 | name = "packaging" | ||
| 110 | version = "25.0" | ||
| 111 | source = { registry = "https://pypi.org/simple" } | ||
| 112 | sdist = { url = "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f", size = 165727 } | ||
| 113 | wheels = [ | ||
| 114 | { url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469 }, | ||
| 115 | ] | ||
| 116 | |||
| 117 | [[package]] | ||
| 118 | name = "pluggy" | ||
| 119 | version = "1.6.0" | ||
| 120 | source = { registry = "https://pypi.org/simple" } | ||
| 121 | sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412 } | ||
| 122 | wheels = [ | ||
| 123 | { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538 }, | ||
| 124 | ] | ||
| 125 | |||
| 126 | [[package]] | ||
| 127 | name = "pygments" | ||
| 128 | version = "2.19.2" | ||
| 129 | source = { registry = "https://pypi.org/simple" } | ||
| 130 | sdist = { url = "https://files.pythonhosted.org/packages/b0/77/a5b8c569bf593b0140bde72ea885a803b82086995367bf2037de0159d924/pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887", size = 4968631 } | ||
| 131 | wheels = [ | ||
| 132 | { url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217 }, | ||
| 133 | ] | ||
| 134 | |||
| 135 | [[package]] | ||
| 136 | name = "pytest" | ||
| 137 | version = "9.0.1" | ||
| 138 | source = { registry = "https://pypi.org/simple" } | ||
| 139 | dependencies = [ | ||
| 140 | { name = "colorama", marker = "sys_platform == 'win32'" }, | ||
| 141 | { name = "iniconfig" }, | ||
| 142 | { name = "packaging" }, | ||
| 143 | { name = "pluggy" }, | ||
| 144 | { name = "pygments" }, | ||
| 145 | ] | ||
| 146 | sdist = { url = "https://files.pythonhosted.org/packages/07/56/f013048ac4bc4c1d9be45afd4ab209ea62822fb1598f40687e6bf45dcea4/pytest-9.0.1.tar.gz", hash = "sha256:3e9c069ea73583e255c3b21cf46b8d3c56f6e3a1a8f6da94ccb0fcf57b9d73c8", size = 1564125 } | ||
| 147 | wheels = [ | ||
| 148 | { url = "https://files.pythonhosted.org/packages/0b/8b/6300fb80f858cda1c51ffa17075df5d846757081d11ab4aa35cef9e6258b/pytest-9.0.1-py3-none-any.whl", hash = "sha256:67be0030d194df2dfa7b556f2e56fb3c3315bd5c8822c6951162b92b32ce7dad", size = 373668 }, | ||
| 149 | ] | ||
| 150 | |||
| 151 | [[package]] | ||
| 152 | name = "rich" | ||
| 153 | version = "14.2.0" | ||
| 154 | source = { registry = "https://pypi.org/simple" } | ||
| 155 | dependencies = [ | ||
| 156 | { name = "markdown-it-py" }, | ||
| 157 | { name = "pygments" }, | ||
| 158 | ] | ||
| 159 | sdist = { url = "https://files.pythonhosted.org/packages/fb/d2/8920e102050a0de7bfabeb4c4614a49248cf8d5d7a8d01885fbb24dc767a/rich-14.2.0.tar.gz", hash = "sha256:73ff50c7c0c1c77c8243079283f4edb376f0f6442433aecb8ce7e6d0b92d1fe4", size = 219990 } | ||
| 160 | wheels = [ | ||
| 161 | { url = "https://files.pythonhosted.org/packages/25/7a/b0178788f8dc6cafce37a212c99565fa1fe7872c70c6c9c1e1a372d9d88f/rich-14.2.0-py3-none-any.whl", hash = "sha256:76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd", size = 243393 }, | ||
| 162 | ] | ||
| 163 | |||
| 164 | [[package]] | ||
| 165 | name = "shellingham" | ||
| 166 | version = "1.5.4" | ||
| 167 | source = { registry = "https://pypi.org/simple" } | ||
| 168 | sdist = { url = "https://files.pythonhosted.org/packages/58/15/8b3609fd3830ef7b27b655beb4b4e9c62313a4e8da8c676e142cc210d58e/shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de", size = 10310 } | ||
| 169 | wheels = [ | ||
| 170 | { url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755 }, | ||
| 171 | ] | ||
| 172 | |||
| 173 | [[package]] | ||
| 174 | name = "typer" | ||
| 175 | version = "0.20.0" | ||
| 176 | source = { registry = "https://pypi.org/simple" } | ||
| 177 | dependencies = [ | ||
| 178 | { name = "click" }, | ||
| 179 | { name = "rich" }, | ||
| 180 | { name = "shellingham" }, | ||
| 181 | { name = "typing-extensions" }, | ||
| 182 | ] | ||
| 183 | sdist = { url = "https://files.pythonhosted.org/packages/8f/28/7c85c8032b91dbe79725b6f17d2fffc595dff06a35c7a30a37bef73a1ab4/typer-0.20.0.tar.gz", hash = "sha256:1aaf6494031793e4876fb0bacfa6a912b551cf43c1e63c800df8b1a866720c37", size = 106492 } | ||
| 184 | wheels = [ | ||
| 185 | { url = "https://files.pythonhosted.org/packages/78/64/7713ffe4b5983314e9d436a90d5bd4f63b6054e2aca783a3cfc44cb95bbf/typer-0.20.0-py3-none-any.whl", hash = "sha256:5b463df6793ec1dca6213a3cf4c0f03bc6e322ac5e16e13ddd622a889489784a", size = 47028 }, | ||
| 186 | ] | ||
| 187 | |||
| 188 | [[package]] | ||
| 189 | name = "typing-extensions" | ||
| 190 | version = "4.15.0" | ||
| 191 | source = { registry = "https://pypi.org/simple" } | ||
| 192 | sdist = { url = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", size = 109391 } | ||
| 193 | wheels = [ | ||
| 194 | { url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614 }, | ||
| 195 | ] | ||
