import argparse

# https://docs.python.org/dev/howto/argparse.html

def parse_arguments():
    # setup parser
    parser = argparse.ArgumentParser(
            description='Short argparse usage example',
            )

    # positional args (mandatory)
    parser.add_argument('echo', help='echo this string')

    # specify a type for the arg
    parser.add_argument("square", type=int,
            help="display a square of a given number")

    # define a flag
    parser.add_argument("-v", "--verbose",
            action="store_true",                # store only true or false value
            help="increase output verbosity")

    # limit possible values
    parser.add_argument('-n', '--number',
            type=int,
            choices=[0,1,2],
            help='number can only be 0,1,2',
            )

    # fancy option with count
    parser.add_argument('-r', '--repeat',
            action='count',
            default=0,
            help='you can repeat this option and it will be counted',
            )

    # last line to parse them
    args = parser.parse_args()

    # you can access a Namespace fields like this
    print(f'args.repeat: {args.repeat}')

    #  parse the args even more if needed
    args_parsed = { a : v for a, v in args._get_kwargs() }
    return args_parsed

def main(x, y, echo, square, verbose, number, repeat=1):
    print(f'echo: {echo}')
    print(f'repeat: {repeat}')

if __name__ == '__main__':
    arguments = parse_arguments()
    print(f'{arguments}')

    myx = 9
    myy = 3
    main(myx, myy, **arguments)

17f6d222299d6e8535ba7b9d55654172134fadff
<mask token>


def parse_arguments():
    parser = argparse.ArgumentParser(description='Short argparse usage example'
        )
    parser.add_argument('echo', help='echo this string')
    parser.add_argument('square', type=int, help=
        'display a square of a given number')
    parser.add_argument('-v', '--verbose', action='store_true', help=
        'increase output verbosity')
    parser.add_argument('-n', '--number', type=int, choices=[0, 1, 2], help
        ='number can only be 0,1,2')
    parser.add_argument('-r', '--repeat', action='count', default=0, help=
        'you can repeat this option and it will be counted')
    args = parser.parse_args()
    print(f'args.repeat: {args.repeat}')
    args_parsed = {a: v for a, v in args._get_kwargs()}
    return args_parsed


<mask token>

<mask token>


def parse_arguments():
    parser = argparse.ArgumentParser(description='Short argparse usage example'
        )
    parser.add_argument('echo', help='echo this string')
    parser.add_argument('square', type=int, help=
        'display a square of a given number')
    parser.add_argument('-v', '--verbose', action='store_true', help=
        'increase output verbosity')
    parser.add_argument('-n', '--number', type=int, choices=[0, 1, 2], help
        ='number can only be 0,1,2')
    parser.add_argument('-r', '--repeat', action='count', default=0, help=
        'you can repeat this option and it will be counted')
    args = parser.parse_args()
    print(f'args.repeat: {args.repeat}')
    args_parsed = {a: v for a, v in args._get_kwargs()}
    return args_parsed


def main(x, y, echo, square, verbose, number, repeat=1):
    print(f'echo: {echo}')
    print(f'repeat: {repeat}')


<mask token>

<mask token>


def parse_arguments():
    parser = argparse.ArgumentParser(description='Short argparse usage example'
        )
    parser.add_argument('echo', help='echo this string')
    parser.add_argument('square', type=int, help=
        'display a square of a given number')
    parser.add_argument('-v', '--verbose', action='store_true', help=
        'increase output verbosity')
    parser.add_argument('-n', '--number', type=int, choices=[0, 1, 2], help
        ='number can only be 0,1,2')
    parser.add_argument('-r', '--repeat', action='count', default=0, help=
        'you can repeat this option and it will be counted')
    args = parser.parse_args()
    print(f'args.repeat: {args.repeat}')
    args_parsed = {a: v for a, v in args._get_kwargs()}
    return args_parsed


def main(x, y, echo, square, verbose, number, repeat=1):
    print(f'echo: {echo}')
    print(f'repeat: {repeat}')


if __name__ == '__main__':
    arguments = parse_arguments()
    print(f'{arguments}')
    myx = 9
    myy = 3
    main(myx, myy, **arguments)

import argparse


def parse_arguments():
    parser = argparse.ArgumentParser(description='Short argparse usage example'
        )
    parser.add_argument('echo', help='echo this string')
    parser.add_argument('square', type=int, help=
        'display a square of a given number')
    parser.add_argument('-v', '--verbose', action='store_true', help=
        'increase output verbosity')
    parser.add_argument('-n', '--number', type=int, choices=[0, 1, 2], help
        ='number can only be 0,1,2')
    parser.add_argument('-r', '--repeat', action='count', default=0, help=
        'you can repeat this option and it will be counted')
    args = parser.parse_args()
    print(f'args.repeat: {args.repeat}')
    args_parsed = {a: v for a, v in args._get_kwargs()}
    return args_parsed


def main(x, y, echo, square, verbose, number, repeat=1):
    print(f'echo: {echo}')
    print(f'repeat: {repeat}')


if __name__ == '__main__':
    arguments = parse_arguments()
    print(f'{arguments}')
    myx = 9
    myy = 3
    main(myx, myy, **arguments)

import argparse

# https://docs.python.org/dev/howto/argparse.html

def parse_arguments():
    # setup parser
    parser = argparse.ArgumentParser(
            description='Short argparse usage example',
            )

    # positional args (mandatory)
    parser.add_argument('echo', help='echo this string')

    # specify a type for the arg
    parser.add_argument("square", type=int,
            help="display a square of a given number")

    # define a flag
    parser.add_argument("-v", "--verbose",
            action="store_true",                # store only true or false value
            help="increase output verbosity")

    # limit possible values
    parser.add_argument('-n', '--number',
            type=int,
            choices=[0,1,2],
            help='number can only be 0,1,2',
            )

    # fancy option with count
    parser.add_argument('-r', '--repeat',
            action='count',
            default=0,
            help='you can repeat this option and it will be counted',
            )

    # last line to parse them
    args = parser.parse_args()

    # you can access a Namespace fields like this
    print(f'args.repeat: {args.repeat}')

    #  parse the args even more if needed
    args_parsed = { a : v for a, v in args._get_kwargs() }
    return args_parsed

def main(x, y, echo, square, verbose, number, repeat=1):
    print(f'echo: {echo}')
    print(f'repeat: {repeat}')

if __name__ == '__main__':
    arguments = parse_arguments()
    print(f'{arguments}')

    myx = 9
    myy = 3
    main(myx, myy, **arguments)
