77
88This duplicates the behavior of `scripts/run_day.py` but lives inside the package.
99"""
10+
1011from __future__ import annotations
1112
1213import argparse
1314import importlib
14- import sys
15- from typing import Sequence , Optional
15+ from typing import Optional , Sequence
1616
1717
1818def main (argv : Optional [Sequence [str ]] = None ) -> int :
@@ -24,8 +24,12 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
2424 Returns:
2525 exit code (0 on success).
2626 """
27- parser = argparse .ArgumentParser (prog = "aoc" , description = "Run an Advent of Code solution module" )
28- parser .add_argument ("--year" , required = True , type = int , help = "Year directory (e.g. 2025)" )
27+ parser = argparse .ArgumentParser (
28+ prog = "aoc" , description = "Run an Advent of Code solution module"
29+ )
30+ parser .add_argument (
31+ "--year" , required = True , type = int , help = "Year directory (e.g. 2025)"
32+ )
2933 parser .add_argument ("--day" , required = True , type = str , help = "Day number (1 or 01)" )
3034
3135 args = parser .parse_args (argv )
@@ -39,8 +43,12 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
3943 module = importlib .import_module (day_module )
4044 except ModuleNotFoundError as exc :
4145 print (f"Could not find module: { day_module } " )
42- # Helpful hint: if running from the repository root, make sure `src` is on PYTHONPATH or install the package editable
43- print ("Hint: run with `PYTHONPATH=src python -m advent_of_code ...` or `pip install -e .` to make the package importable" )
46+ # Helpful hint: if running from the repository root,
47+ # make sure `src` is on PYTHONPATH or install the package editable.
48+ print (
49+ "Hint: run with `PYTHONPATH=src python -m advent_of_code ...` "
50+ "or `pip install -e .` to make the package importable"
51+ )
4452 if isinstance (exc , ModuleNotFoundError ):
4553 # show original message
4654 print (str (exc ))
0 commit comments