Parse arguments.
()
| 261 | |
| 262 | |
| 263 | def parse_args(): |
| 264 | """Parse arguments.""" |
| 265 | parser = argparse.ArgumentParser( |
| 266 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
| 267 | description="Diagnose script for checking the current system.", |
| 268 | ) |
| 269 | choices = ["python", "pip", "verl", "system", "os", "environment"] |
| 270 | for choice in choices: |
| 271 | parser.add_argument("--" + choice, default=1, type=int, help="Diagnose {}.".format(choice)) |
| 272 | parser.add_argument("--network", default=0, type=int, help="Diagnose network.") |
| 273 | parser.add_argument("--hardware", default=0, type=int, help="Diagnose hardware.") |
| 274 | parser.add_argument( |
| 275 | "--region", |
| 276 | default="", |
| 277 | type=str, |
| 278 | help="Additional sites in which region(s) to test. \ |
| 279 | Specify 'cn' for example to test mirror sites in China.", |
| 280 | ) |
| 281 | parser.add_argument("--timeout", default=10, type=int, help="Connection test timeout threshold, 0 to disable.") |
| 282 | args = parser.parse_args() |
| 283 | return args |
| 284 | |
| 285 | |
| 286 | if __name__ == "__main__": |