Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main(args=None):
# main parser
parser = argparse.ArgumentParser(
prog=__package__,
description=__package__ + ' command-line tool.')
parser.add_argument(
'-V', '--version',
action='version',
version=__package__ + ' ' + pybase64.get_version())
parser.add_argument(
'--license',
action=LicenseAction,
license=pybase64.get_license_text())
# create sub-parsers
subparsers = parser.add_subparsers(help='tool help')
# benchmark parser
benchmark_parser = subparsers.add_parser('benchmark', help='-h for usage')
benchmark_parser.add_argument(
'-d', '--duration',
metavar='D',
dest='duration',
type=float,
default=1.0,
help='expected duration for a single encode or decode test')
benchmark_parser.add_argument(
'input',
type=argparse.FileType('rb'),
help='input file used for the benchmark')
benchmark_parser.set_defaults(func=benchmark)