This repository has been archived by the owner on Dec 25, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
458 additions
and
0 deletions.
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 @@ | ||
venv/bin/activate |
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 @@ | ||
deactivate |
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,3 @@ | ||
*.egg-info | ||
*.pyc | ||
/.env |
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,43 @@ | ||
exclude: /input\.txt$ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: double-quote-string-fixer | ||
- id: name-tests-test | ||
- id: requirements-txt-fixer | ||
- repo: https://github.com/asottile/reorder_python_imports | ||
rev: v3.14.0 | ||
hooks: | ||
- id: reorder-python-imports | ||
args: [ | ||
--py312-plus, | ||
--add-import, 'from __future__ import annotations', | ||
--application-directories, '.:support-src', | ||
] | ||
- repo: https://github.com/asottile/add-trailing-comma | ||
rev: v3.1.0 | ||
hooks: | ||
- id: add-trailing-comma | ||
args: [--py36-plus] | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.19.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py312-plus] | ||
- repo: https://github.com/hhatto/autopep8 | ||
rev: v2.3.1 | ||
hooks: | ||
- id: autopep8 | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 7.1.1 | ||
hooks: | ||
- id: flake8 | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.13.0 | ||
hooks: | ||
- id: mypy |
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,13 @@ | ||
advent of code 2024 | ||
=================== | ||
|
||
https://adventofcode.com/2024 | ||
|
||
### stream / youtube | ||
|
||
- [Streamed daily on twitch](https://twitch.tv/anthonywritescode) | ||
- [Streams uploaded to youtube afterwards](https://www.youtube.com/@anthonywritescode-vods) | ||
|
||
### about | ||
|
||
for 2024, I'm planning to implement in python |
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,53 @@ | ||
from __future__ import annotations | ||
|
||
import argparse | ||
import os.path | ||
|
||
import pytest | ||
|
||
import support | ||
|
||
INPUT_TXT = os.path.join(os.path.dirname(__file__), 'input.txt') | ||
|
||
|
||
def compute(s: str) -> int: | ||
numbers = support.parse_numbers_split(s) | ||
for n in numbers: | ||
pass | ||
|
||
lines = s.splitlines() | ||
for line in lines: | ||
pass | ||
# TODO: implement solution here! | ||
return 0 | ||
|
||
|
||
INPUT_S = '''\ | ||
''' | ||
EXPECTED = 1 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
('input_s', 'expected'), | ||
( | ||
(INPUT_S, EXPECTED), | ||
), | ||
) | ||
def test(input_s: str, expected: int) -> None: | ||
assert compute(input_s) == expected | ||
|
||
|
||
def main() -> int: | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('data_file', nargs='?', default=INPUT_TXT) | ||
args = parser.parse_args() | ||
|
||
with open(args.data_file) as f, support.timing(): | ||
print(compute(f.read())) | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
raise SystemExit(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,2 @@ | ||
-e support-src | ||
pytest |
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 @@ | ||
[mypy] | ||
mypy_path = support-src | ||
|
||
check_untyped_defs = true | ||
disallow_any_generics = true | ||
disallow_incomplete_defs = true | ||
disallow_untyped_defs = true | ||
warn_redundant_casts = true | ||
warn_unused_ignores = true |
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,11 @@ | ||
[metadata] | ||
name = support | ||
|
||
[options] | ||
py_modules = support | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
aoc-download-input = support:download_input | ||
aoc-submit = support:submit_solution | ||
aoc-25-pt2 = support:submit_25_pt2 |
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,4 @@ | ||
from __future__ import annotations | ||
|
||
from setuptools import setup | ||
setup() |
Oops, something went wrong.