fixed argparse help bug

This commit is contained in:
k4yt3x 2022-02-16 02:56:35 +00:00
parent c07fafc0e9
commit bb572e2468

View File

@ -27,7 +27,7 @@ __ __ _ _ ___ __ __
Name: Video2X Name: Video2X
Creator: K4YT3X Creator: K4YT3X
Date Created: Feb 24, 2018 Date Created: Feb 24, 2018
Last Modified: February 12, 2022 Last Modified: February 15, 2022
Editor: BrianPetkovsek Editor: BrianPetkovsek
Last Modified: June 17, 2019 Last Modified: June 17, 2019
@ -123,7 +123,7 @@ class Video2X:
""" """
def __init__(self): def __init__(self):
self.version = "5.0.0" self.version = __version__
def _get_video_info(self, path: pathlib.Path): def _get_video_info(self, path: pathlib.Path):
""" """
@ -430,7 +430,12 @@ def parse_arguments() -> argparse.Namespace:
help="action to perform", dest="action", required=True help="action to perform", dest="action", required=True
) )
upscale = action.add_parser("upscale", help="upscale a file", add_help=False) upscale = action.add_parser(
"upscale",
help="upscale a file",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
)
upscale.add_argument( upscale.add_argument(
"--help", action="help", help="show this help message and exit" "--help", action="help", help="show this help message and exit"
) )
@ -448,13 +453,16 @@ def parse_arguments() -> argparse.Namespace:
"-t", "-t",
"--threshold", "--threshold",
type=float, type=float,
help="skip if the % difference between two adjacent frames is below this value; set to 0 to process all frames", help="skip if the percent difference between two adjacent frames is below this value; set to 0 to process all frames",
default=0, default=0,
) )
# interpolator arguments # interpolator arguments
interpolate = action.add_parser( interpolate = action.add_parser(
"interpolate", help="interpolate frames for file", add_help=False "interpolate",
help="interpolate frames for file",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
) )
interpolate.add_argument( interpolate.add_argument(
"--help", action="help", help="show this help message and exit" "--help", action="help", help="show this help message and exit"
@ -470,7 +478,7 @@ def parse_arguments() -> argparse.Namespace:
"-t", "-t",
"--threshold", "--threshold",
type=float, type=float,
help="skip if the % difference between two adjacent frames exceeds this value; set to 100 to interpolate all frames", help="skip if the percent difference between two adjacent frames exceeds this value; set to 100 to interpolate all frames",
default=10, default=10,
) )
@ -534,7 +542,7 @@ def main():
) )
# don't print the traceback for manual terminations # don't print the traceback for manual terminations
except (SystemExit, KeyboardInterrupt) as e: except KeyboardInterrupt as e:
raise SystemExit(e) raise SystemExit(e)
except Exception as e: except Exception as e: