-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from GriceTurrble/feat/day3-and-justfiles
feat: day3 scaffold; justfiles added
- Loading branch information
Showing
10 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Root justfile for AoC 2024 | ||
|
||
mod py 'python/py.just' | ||
|
||
|
||
# Show these help docs | ||
help: | ||
@just --list --unsorted --justfile {{ source_file() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# justfile recipes specific to the Python project in AoC 2024 | ||
|
||
# Show these help docs | ||
help: | ||
@just --list --unsorted --justfile {{ source_file() }} | ||
|
||
# Generate files for a new day | ||
new-day DAY: | ||
uv run cli create-day {{DAY}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from __future__ import annotations | ||
|
||
import time | ||
import typing | ||
from pathlib import Path | ||
|
||
if typing.TYPE_CHECKING: | ||
from io import TextIOWrapper | ||
|
||
FILE = Path(__file__).parent / "inputs.txt" | ||
|
||
|
||
def part1(inputs: TextIOWrapper): | ||
return "Not done yet!" | ||
|
||
|
||
def part2(inputs: TextIOWrapper): | ||
return "Not done yet!" | ||
|
||
|
||
def main(): | ||
_start1 = time.perf_counter() | ||
with open(FILE) as f: | ||
result1 = part1(f) | ||
_delta1 = time.perf_counter() - _start1 | ||
print(f">> Part 1: {result1} ({_delta1:.6f}s)") | ||
|
||
_start2 = time.perf_counter() | ||
with open(FILE) as f: | ||
result2 = part2(f) | ||
_delta2 = time.perf_counter() - _start2 | ||
print(f">> Part 2: {result2} ({_delta2:.6f}s)") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
|
||
from .main import part1, part2 | ||
|
||
TEST_FILE = Path(__file__).parent / "test_inputs.txt" | ||
RESULT_PART_1 = "Now it's done!" | ||
RESULT_PART_2 = "Now it's done!" | ||
|
||
|
||
def test_part1(): | ||
with open(TEST_FILE) as f: | ||
result = part1(f) | ||
assert result == RESULT_PART_1 | ||
|
||
|
||
def test_part2(): | ||
with open(TEST_FILE) as f: | ||
result = part2(f) | ||
assert result == RESULT_PART_2 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters