@@ -30,11 +30,7 @@ def get_path() -> str:
3030 str: Absolute path to either the directory containing the script or
3131 the script's directory if it is itself a directory.
3232 """
33- return (
34- path
35- if os .path .isdir (path := os .path .realpath (sys .argv [0 ]))
36- else os .path .dirname (path )
37- )
33+ return path if os .path .isdir (path := os .path .realpath (sys .argv [0 ])) else os .path .dirname (path )
3834
3935 @staticmethod
4036 def get_session () -> str :
@@ -137,11 +133,7 @@ def download_test_input(day: int, part_num: int) -> str | None:
137133 if response .status_code == 200 :
138134 content = response .text
139135 soup = BeautifulSoup (content , "html.parser" )
140- code_elements = [
141- element
142- for element in soup .find_all ("code" )
143- if element .text .count ("\n " ) > 0
144- ]
136+ code_elements = [element for element in soup .find_all ("code" ) if element .text .count ("\n " ) > 0 ]
145137 return code_elements [part_num - 1 ].text
146138
147139 else :
@@ -189,9 +181,7 @@ def add_day(day: int) -> None:
189181
190182 if file_path .stat ().st_size == 0 :
191183 now = datetime .now ()
192- available_to_download = datetime (
193- int (path .split (os .sep )[- 1 ].split ("-" )[- 1 ]), 12 , day , 5 , 0 , 0
194- )
184+ available_to_download = datetime (int (path .split (os .sep )[- 1 ].split ("-" )[- 1 ]), 12 , day , 5 , 0 , 0 )
195185
196186 if now < available_to_download :
197187 logger .info (
@@ -201,9 +191,7 @@ def add_day(day: int) -> None:
201191 )
202192
203193 while now < available_to_download :
204- logger .info (
205- "\033 [Fnow:" , now .strftime ("%Y-%m-%d %H:%M:%S.%f" )[:- 3 ], "UTC"
206- )
194+ logger .info ("\033 [Fnow:" , now .strftime ("%Y-%m-%d %H:%M:%S.%f" )[:- 3 ], "UTC" )
207195 sleep (1 )
208196 now = datetime .now ()
209197
@@ -240,9 +228,7 @@ def add_test_input(day: int, part_num: int) -> None:
240228
241229 if file_path .stat ().st_size == 0 :
242230 now = datetime .now ()
243- available_to_download = datetime (
244- int (path .split (os .sep )[- 1 ].split ("-" )[- 1 ]), 12 , day , 5 , 0 , 0
245- )
231+ available_to_download = datetime (int (path .split (os .sep )[- 1 ].split ("-" )[- 1 ]), 12 , day , 5 , 0 , 0 )
246232
247233 if now < available_to_download :
248234 logger .info (
@@ -252,9 +238,7 @@ def add_test_input(day: int, part_num: int) -> None:
252238 )
253239
254240 while now < available_to_download :
255- logger .info (
256- "\033 [Fnow:" , now .strftime ("%Y-%m-%d %H:%M:%S.%f" )[:- 3 ], "UTC"
257- )
241+ logger .info ("\033 [Fnow:" , now .strftime ("%Y-%m-%d %H:%M:%S.%f" )[:- 3 ], "UTC" )
258242 sleep (1 )
259243 now = datetime .now ()
260244
0 commit comments