Skip to content

Commit 6415dfd

Browse files
[pre-commit.ci] pre-commit autoupdate (#26)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: S. Co1 <[email protected]>
1 parent 36876a8 commit 6415dfd

File tree

6 files changed

+385
-252
lines changed

6 files changed

+385
-252
lines changed

.flake8

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
[flake8]
2-
max-line-length=100
3-
import-order-style=pycharm
42
extend-ignore=
5-
# pycodestyle
6-
E203,E226,E701
3+
E,F,W,
74
# flake8-annotations
85
ANN002,ANN003,ANN101,ANN102,ANN204,ANN206,
96
extend-exclude=
107
.venv,
11-
per-file-ignores =
12-
test_*.py:E501,

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ ci:
22
autoupdate_schedule: quarterly
33

44
repos:
5-
- repo: https://github.com/psf/black
6-
rev: 25.1.0
5+
- repo: https://github.com/psf/black-pre-commit-mirror
6+
rev: 25.9.0
77
hooks:
88
- id: black
99
- repo: https://github.com/pycqa/isort
10-
rev: 6.0.1
10+
rev: 6.1.0
1111
hooks:
1212
- id: isort
1313
name: isort
@@ -18,7 +18,7 @@ repos:
1818
additional_dependencies:
1919
- flake8-annotations
2020
- repo: https://github.com/pre-commit/pre-commit-hooks
21-
rev: v5.0.0
21+
rev: v6.0.0
2222
hooks:
2323
- id: check-case-conflict
2424
- id: check-json
@@ -40,6 +40,6 @@ repos:
4040
- id: matlab-reflow-comments
4141
args: [--line-length=100]
4242
- repo: https://github.com/astral-sh/ruff-pre-commit
43-
rev: v0.12.2
43+
rev: v0.14.0
4444
hooks:
4545
- id: ruff-check

.ruff.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ select = [
1212
"B", # flake8-bugbear
1313
"C4", # flake8-comprehensions
1414
"D", # pydocstyle/flake8-docstrings
15+
"E", # pycodestyle
1516
"F", # Pyflakes
1617
"FIX", # flake8-fixme
1718
"N", # pep8-naming
19+
"W", # pycodestyle
1820
]
1921

2022
ignore = [
@@ -58,5 +60,6 @@ ignore = [
5860
"test_*.py" = [
5961
"D101",
6062
"D103",
63+
"E501",
6164
]
6265
"2021/Day_18/aoc_2021_day18.py" = ["D202"]

2021/Day_14/aoc_2021_day14.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def calculate_spread(polymer: str) -> int:
7070
# How about a smarter not harder approach instead
7171
def non_brute_deconstruct(template: str, rules: dict[str, str], n_cycles: int) -> int:
7272
"""Calculate the element spread of the provided polymer after the target insertion cycle(s)."""
73-
l: str
74-
r: str
73+
left: str
74+
right: str
7575

7676
# Since we don't care about order, we can keep track of the pairs created by each step and
7777
# use these counts to determine element counts once we run through all of the insertion cycles
@@ -80,12 +80,12 @@ def non_brute_deconstruct(template: str, rules: dict[str, str], n_cycles: int) -
8080
for _ in range(n_cycles):
8181
updated_pairs: Counter[str] = Counter()
8282
for pair, count in pairs_counter.items():
83-
l, r = pair
83+
left, right = pair
8484
# Each pair will add the corresponding number of pairs composed of the inserted element
8585
# and the left/right sides
8686
# This will end up double counting the middle element but we can fix that later
87-
updated_pairs[f"{l}{rules[pair]}"] += count
88-
updated_pairs[f"{rules[pair]}{r}"] += count
87+
updated_pairs[f"{left}{rules[pair]}"] += count
88+
updated_pairs[f"{rules[pair]}{right}"] += count
8989

9090
# Now that we've updated our pairs we can replace our starting point
9191
pairs_counter = updated_pairs
@@ -94,9 +94,9 @@ def non_brute_deconstruct(template: str, rules: dict[str, str], n_cycles: int) -
9494
# quantities. As noted above, our inserted elements have all been double counted, except for the
9595
# first & last elements. So we can just double the first & last and divide the counts by 2.
9696
element_counts: Counter[str] = Counter()
97-
for (l, r), count in pairs_counter.items():
98-
element_counts[l] += count
99-
element_counts[r] += count
97+
for (left, right), count in pairs_counter.items():
98+
element_counts[left] += count
99+
element_counts[right] += count
100100
element_counts[template[0]] += 1
101101
element_counts[template[-1]] += 1
102102

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ Repository = "https://github.com/sco1/adventofcode"
2828
aoc-init = "helpers.init_puzzle:main"
2929
set-prog = "helpers.update_progress:main"
3030

31-
[tool.uv]
32-
dev-dependencies = [
31+
[dependency-groups]
32+
dev = [
3333
"black~=25.0",
3434
"cogapp~=3.4",
3535
"flake8~=7.1",
3636
"flake8-annotations~=3.1",
37+
"flake8-define-class-attributes~=0.2",
3738
"isort~=6.0",
3839
"mypy~=1.11",
3940
"pre-commit~=4.0",

0 commit comments

Comments
 (0)