From c1f163cd699259ddc9bf6fc8517a75a5e101d04b Mon Sep 17 00:00:00 2001 From: Simon Brugman Date: Mon, 2 Sep 2024 12:20:17 +0200 Subject: [PATCH] `args.path` is never not set --- torchfix/__main__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/torchfix/__main__.py b/torchfix/__main__.py index b8eaebf..eb17658 100644 --- a/torchfix/__main__.py +++ b/torchfix/__main__.py @@ -40,7 +40,7 @@ def StderrSilencer(redirect: bool = True): libc.close(orig_stderr) -def main() -> None: +def _parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser() parser.add_argument( @@ -78,11 +78,11 @@ def main() -> None: action="store_true", ) - args = parser.parse_args() + return parser.parse_args() - if not args.path: - parser.print_usage() - sys.exit(1) + +def main() -> None: + args = _parse_args() files = codemod.gather_files(args.path)