Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Dec 1, 2024
1 parent 2bd9d15 commit 73a0193
Show file tree
Hide file tree
Showing 14 changed files with 458 additions and 0 deletions.
1 change: 1 addition & 0 deletions .activate.sh
1 change: 1 addition & 0 deletions .deactivate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deactivate
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.egg-info
*.pyc
/.env
43 changes: 43 additions & 0 deletions .pre-commit-config.yaml
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
13 changes: 13 additions & 0 deletions README.md
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 added day00/__init__.py
Empty file.
Empty file added day00/input.txt
Empty file.
53 changes: 53 additions & 0 deletions day00/part1.py
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())
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-e support-src
pytest
9 changes: 9 additions & 0 deletions setup.cfg
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
11 changes: 11 additions & 0 deletions support-src/setup.cfg
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
4 changes: 4 additions & 0 deletions support-src/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from __future__ import annotations

from setuptools import setup
setup()
Loading

0 comments on commit 73a0193

Please sign in to comment.