Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
Ted Cassirer committed Dec 1, 2023
1 parent 36a3600 commit b1f7018
Show file tree
Hide file tree
Showing 187 changed files with 377 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: poetry install
- name: Black code style check
run: |
poetry run black --check -l 120 .
poetry run black --check .
- name: Test with pytest
run: |
poetry run pytest
18 changes: 18 additions & 0 deletions .idea/advent-of-code.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/python-terminal.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/ruff.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 104 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,37 @@ You can run this project with: [Advent of code Data](https://github.com/wimglenn

## Setup

`
pip install -e .
`
```sh
poetry install
````





## Run tests
```pytest```
```sh
poetry run pytest
```





## Run specific day
```aoccas -y 2021 -d 1 -f inputData```
## Run
```sh
poetry run aoccas -y 2021 -d 5 --submit
```

The file argument is optional if you set up set the env variable `AOC_SESSION`. It will then instead use your account's generated input for that problem
To submit the results you can add the `-s` flag

Instructions: [How to find the session id](https://github.com/wimglenn/advent-of-code-wim/issues/1)
Set the environment variable `AOC_SESSION` to use your personal input.

Instructions: [How to find the session id](https://github.com/wimglenn/advent-of-code-wim/issues/1)


To run it using the aocd plugin you can run:

## Submit results
[You can submit your results directly by setting up your `~/config/aocd/tokens.json`](https://github.com/wimglenn/advent-of-code-data#verify-your-code-against-multiple-different-inputs)

Then run: `aoc -y 2021 -d 1`
```sh
poetry run aoc -y 2021 -d 1
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions aoc_cas/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import importlib

from aocd import get_data


def plugin(year, day, **kwargs):
module_name = f"aoc_cas.aoc{year}.day{day}"
mod = importlib.import_module(module_name)
data = get_data(year=year, day=day)
return mod.part1(data), mod.part2(data)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions aoc_cas/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import importlib
import logging
from datetime import datetime

import click
from aocd import get_data
from aocd.models import Puzzle
from aocd.utils import AOC_TZ


def solve(day, year, data):
moduleName = "aoc{}.day{}".format(year, day)
mod = importlib.import_module(moduleName)
part1 = mod.part1(data)
part2 = mod.part2(data)
return part1, part2


@click.command()
@click.option("--year", "-y", default=datetime.now(tz=AOC_TZ).year, type=int)
@click.option("--day", "-d", default=datetime.now(tz=AOC_TZ).day, type=int)
@click.option("--submit", "-s", is_flag=True)
def run_one(year: int, day: int, submit: bool):
logging.basicConfig(format="%(message)s", level=logging.INFO)

mod_name = "aoc_cas.aoc{}.day{}".format(year, day)
print(mod_name)
mod = importlib.import_module(mod_name)
data = get_data(year=year, day=day)
puzzle = Puzzle(year, day)
print(f"--- {year} Day {day}: {puzzle.title} ---")
part_1_result = mod.part1(data)
part_2_result = mod.part2(data)
print(f"Part1: {part_1_result}")
print(f"Part2: {part_2_result}")
if submit:
puzzle.answer_a = part_1_result
puzzle.answer_2 = part_2_result
Loading

0 comments on commit b1f7018

Please sign in to comment.