11#!usr/bin/env python3
2+ from __future__ import annotations
23
34import argparse
45import re
@@ -40,8 +41,7 @@ def parse_args() -> argparse.Namespace:
4041 help = "Path to the s5cmd file" ,
4142 default = Path (__file__ ).parents [1 ].joinpath ("s5cmdUrls.cmake" ).as_posix (),
4243 )
43- args = parser .parse_args ()
44- return args
44+ return parser .parse_args ()
4545
4646
4747def read_checksum_text (path : str ) -> str :
@@ -51,12 +51,13 @@ def read_checksum_text(path: str) -> str:
5151
5252 _path = Path (path )
5353 if not _path .exists () or not _path .is_file ():
54- raise FileNotFoundError (f"Checksum file `{ _path } ` does not exist." )
54+ msg = f"Checksum file `{ _path } ` does not exist."
55+ raise FileNotFoundError (msg )
5556 return _path .read_text (encoding = "utf-8" )
5657
5758
5859def generate_cmake_text (text : str ) -> str :
59- checksums = [l .split () for l in text .rstrip ("\n " ).split ("\n " )]
60+ checksums = [line .split () for line in text .rstrip ("\n " ).split ("\n " )]
6061
6162 version = re .search (VERSION_RE , checksums [0 ][1 ]).group (1 )
6263 if version is None :
@@ -111,7 +112,7 @@ def overwrite_cmake_file(text: str, path: str) -> None:
111112 replaced_text = re .sub (TEXT_RE , text , cmake_text )
112113 _path .write_text (replaced_text , encoding = "utf-8" )
113114
114- print (f"Updated `{ _path } ` with new checksums ." )
115+ print (f"Checksum file `{ _path } ` updated ." ) # noqa: T201
115116
116117
117118def main ():
0 commit comments