def parse_args():
    """Parse arguments."""
    parser = argparse.ArgumentParser(
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        description='Diagnose script for checking the current system.')
    choices = ['python', 'pip', 'mxnet', 'os', 'hardware', 'network']
    for choice in choices:
        parser.add_argument('--' + choice, default=1, type=int,
                            help='Diagnose {}.'.format(choice))
    parser.add_argument('--region', default='', type=str,
                        help="Additional sites in which region(s) to test. \
                        Specify 'cn' for example to test mirror sites in China.")
    parser.add_argument('--timeout', default=10, type=int,
                        help="Connection test timeout threshold, 0 to disable.")
    args = parser.parse_args()
    return args
def parse_args ( ) : parser = argparse . ArgumentParser ( formatter_class = argparse . ArgumentDefaultsHelpFormatter , description = 'Diagnose script for checking the current system.' ) choices = [ 'python' , 'pip' , 'mxnet' , 'os' , 'hardware' , 'network' ] for choice in choices : parser . add_argument ( '--' + choice , default = 1 , type = int , help = 'Diagnose {}.' . format ( choice ) ) parser . add_argument ( '--region' , default = '' , type = str , help = "Additional sites in which region(s) to test. \
                        Specify 'cn' for example to test mirror sites in China." ) parser . add_argument ( '--timeout' , default = 10 , type = int , help = "Connection test timeout threshold, 0 to disable." ) args = parser . parse_args ( ) return args
Parse arguments.