Skip to content

Commit e0648e2

Browse files
committed
Black formatting
1 parent 2117449 commit e0648e2

File tree

7 files changed

+14
-23
lines changed

7 files changed

+14
-23
lines changed

aoc/models/file.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ def add_day(day: int) -> None:
202202

203203
while now < available_to_download:
204204
logger.info(
205-
"\033[Fnow:", now.strftime(
206-
"%Y-%m-%d %H:%M:%S.%f")[:-3], "UTC"
205+
"\033[Fnow:", now.strftime("%Y-%m-%d %H:%M:%S.%f")[:-3], "UTC"
207206
)
208207
sleep(1)
209208
now = datetime.now()
@@ -254,8 +253,7 @@ def add_test_input(day: int, part_num: int) -> None:
254253

255254
while now < available_to_download:
256255
logger.info(
257-
"\033[Fnow:", now.strftime(
258-
"%Y-%m-%d %H:%M:%S.%f")[:-3], "UTC"
256+
"\033[Fnow:", now.strftime("%Y-%m-%d %H:%M:%S.%f")[:-3], "UTC"
259257
)
260258
sleep(1)
261259
now = datetime.now()
@@ -290,8 +288,7 @@ def add_test_file(day: int) -> None:
290288
if not test_path.exists():
291289
sample_file = f"{path}/templates/tests/sample.txt"
292290
if not os.path.exists(sample_file):
293-
raise FileNotFoundError(
294-
f"Template file not found: {sample_file}")
291+
raise FileNotFoundError(f"Template file not found: {sample_file}")
295292

296293
with open(sample_file, "r") as file:
297294
content = file.read()

aoc/models/reader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class Reader:
1515
the `aoc` package location.
1616
"""
1717

18-
PROJECT_ROOT = os.path.dirname(
19-
os.path.abspath(__file__).rsplit("aoc", 1)[0])
18+
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__).rsplit("aoc", 1)[0])
2019

2120
@staticmethod
2221
def get_path() -> str:

aoc/models/submission.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,13 @@ def submit(day: int, level: int, answer: int) -> None:
110110
values = {"level": level, "answer": answer}
111111
data = urllib.parse.urlencode(values).encode("utf-8")
112112

113-
req = urllib.request.Request(
114-
url, method=method, headers=headers, data=data)
113+
req = urllib.request.Request(url, method=method, headers=headers, data=data)
115114

116115
with urllib.request.urlopen(req) as response:
117116
content = response.read().decode("utf-8")
118117

119118
# Extract and format the response message
120-
article = re.findall(r"<article>(.*?)</article>",
121-
content, re.DOTALL)[0]
119+
article = re.findall(r"<article>(.*?)</article>", content, re.DOTALL)[0]
122120
article = "".join(article.split("</p>"))
123121
article = article.replace("\n", "")
124122
article = re.sub(r"<.*?>", "", article, re.DOTALL)

solutions/day02.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ def part2(self, data: List[str]) -> int:
117117
return sum(
118118
any(
119119
(
120-
self.is_increasing(ls[:i] + ls[i + 1:])
121-
or self.is_decreasing(ls[:i] + ls[i + 1:])
120+
self.is_increasing(ls[:i] + ls[i + 1 :])
121+
or self.is_decreasing(ls[:i] + ls[i + 1 :])
122122
)
123-
and self.between_range(ls[:i] + ls[i + 1:])
123+
and self.between_range(ls[:i] + ls[i + 1 :])
124124
for i in range(len(ls))
125125
)
126126
or (

solutions/day05.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ def parse_data(
4141
"3,1,2"
4242
Returns: ([(1,2), (2,3)], [[1,2,3], [3,1,2]])
4343
"""
44-
rules, ordering = [part.splitlines()
45-
for part in "\n".join(data).split("\n\n")]
46-
rules = [(int(a), int(b))
47-
for a, b in (rule.split("|") for rule in rules)]
44+
rules, ordering = [part.splitlines() for part in "\n".join(data).split("\n\n")]
45+
rules = [(int(a), int(b)) for a, b in (rule.split("|") for rule in rules)]
4846
ordering = [[int(x) for x in line.split(",")] for line in ordering]
4947

5048
return rules, ordering

solutions/day06.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ class Solution(SolutionBase):
2121
guard movement and analyze possible paths.
2222
"""
2323

24-
moves = {"^": (-1, 0), ">": (0, 1), "v": (1, 0),
25-
"<": (0, -1)} # Direction vectors
24+
moves = {"^": (-1, 0), ">": (0, 1), "v": (1, 0), "<": (0, -1)} # Direction vectors
2625
turns = {"^": ">", ">": "v", "v": "<", "<": "^"} # Right turn mappings
2726

2827
def find_start(self, grid: List[List[str]]) -> Tuple[int, int, str]:

solutions/day08.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def part1(self, data: List[str]) -> int:
149149
for positions in antennas.values():
150150
# For each pair of same-frequency antennas
151151
for i, ant1 in enumerate(positions):
152-
for ant2 in positions[i + 1:]:
152+
for ant2 in positions[i + 1 :]:
153153
# Find antinodes for this pair
154154
antinodes = self.find_antinodes(ant1, ant2, data)
155155
all_antinodes.update(antinodes)
@@ -181,7 +181,7 @@ def part2(self, data: List[str]) -> int:
181181

182182
# For each pair of same-frequency antennas
183183
for i, ant1 in enumerate(positions):
184-
for j, ant2 in enumerate(positions[i + 1:], start=i + 1):
184+
for j, ant2 in enumerate(positions[i + 1 :], start=i + 1):
185185
# Add both antenna positions as they are collinear with at least two antennas
186186
all_antinodes.add(ant1)
187187
all_antinodes.add(ant2)

0 commit comments

Comments
 (0)