diff options
| author | Cody Logan <cody@lokken.dev> | 2023-11-01 13:33:39 -0700 |
|---|---|---|
| committer | Cody Logan <cody@lokken.dev> | 2023-11-01 13:33:39 -0700 |
| commit | 420a50672067b1a736a30c2f671fcf43495c4df0 (patch) | |
| tree | 720d5d45de3c405a7bdc239b7279911fd90a4e4a /src/wikiget | |
| parent | bdc566773e27f0fc4b9268526643a2aaadad06ff (diff) | |
| download | wikiget-420a50672067b1a736a30c2f671fcf43495c4df0.tar.gz wikiget-420a50672067b1a736a30c2f671fcf43495c4df0.zip | |
Rename some symbols and functions to better match their purpose
Diffstat (limited to 'src/wikiget')
| -rw-r--r-- | src/wikiget/dl.py | 4 | ||||
| -rw-r--r-- | src/wikiget/parse.py | 6 | ||||
| -rw-r--r-- | src/wikiget/wikiget.py | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/wikiget/dl.py b/src/wikiget/dl.py index f39c355..a29e049 100644 --- a/src/wikiget/dl.py +++ b/src/wikiget/dl.py @@ -85,7 +85,7 @@ def batch_download(args: Namespace) -> int: # parse batch file try: - dl_list = read_batch_file(args.FILE) + dl_dict = read_batch_file(args.FILE) except OSError as e: logger.error(f"File could not be read: {e}") sys.exit(1) @@ -93,7 +93,7 @@ def batch_download(args: Namespace) -> int: # TODO: validate file contents before download process starts with ThreadPoolExecutor(max_workers=args.threads) as executor: futures = [] - for line_num, line in dl_list.items(): + for line_num, line in dl_dict.items(): # keep track of batch file line numbers for debugging/logging purposes logger.info(f"Processing '{line}' at line {line_num}") try: diff --git a/src/wikiget/parse.py b/src/wikiget/parse.py index 122c45f..892f0f0 100644 --- a/src/wikiget/parse.py +++ b/src/wikiget/parse.py @@ -60,7 +60,7 @@ def get_dest(dl: str, args: Namespace) -> File: def read_batch_file(batch_file: str) -> Dict[int, str]: - dl_list = {} + dl_dict = {} if batch_file == "-": logger.info("Using stdin for batch download") @@ -73,6 +73,6 @@ def read_batch_file(batch_file: str) -> Dict[int, str]: line_s = line.strip() # ignore blank lines and lines starting with "#" (for comments) if line_s and not line_s.startswith("#"): - dl_list[line_num] = line_s + dl_dict[line_num] = line_s - return dl_list + return dl_dict diff --git a/src/wikiget/wikiget.py b/src/wikiget/wikiget.py index ca655b0..db8ebf4 100644 --- a/src/wikiget/wikiget.py +++ b/src/wikiget/wikiget.py @@ -27,7 +27,7 @@ from wikiget.logging import configure_logging logger = logging.getLogger(__name__) -def construct_parser(argv: List[str]) -> argparse.Namespace: +def parse_args(argv: List[str]) -> argparse.Namespace: parser = argparse.ArgumentParser( description=""" A tool for downloading files from MediaWiki sites using the file name or @@ -120,9 +120,9 @@ def construct_parser(argv: List[str]) -> argparse.Namespace: return parser.parse_args(argv) -def main() -> None: +def cli() -> None: # setup our environment - args = construct_parser(sys.argv[1:]) + args = parse_args(sys.argv[1:]) configure_logging(verbosity=args.verbose, logfile=args.logfile, quiet=args.quiet) # log events are appended to the file if it already exists, so note the start of a |
