| 435 | |
| 436 | |
| 437 | def parse_args(): |
| 438 | parser = argparse.ArgumentParser() |
| 439 | |
| 440 | parser.add_argument( |
| 441 | "-o", |
| 442 | "--output-dir", |
| 443 | type=str, |
| 444 | default="python/paddle/", |
| 445 | ) |
| 446 | parser.add_argument( |
| 447 | "-m", |
| 448 | "--module-name", |
| 449 | type=str, |
| 450 | default="", |
| 451 | ) |
| 452 | |
| 453 | parser.add_argument( |
| 454 | "--ignore-all-errors", |
| 455 | default=False, |
| 456 | action="store_true", |
| 457 | help="Ignore all errors during module parsing", |
| 458 | ) |
| 459 | |
| 460 | parser.add_argument( |
| 461 | "--print-invalid-expressions-as-is", |
| 462 | default=False, |
| 463 | action="store_true", |
| 464 | help="Suppress the replacement with 'typing.Any' of invalid expressions" |
| 465 | "found in annotations", |
| 466 | ) |
| 467 | |
| 468 | parser.add_argument( |
| 469 | "--ops-yaml", |
| 470 | nargs='*', |
| 471 | help="Parse ops yaml, the input should be `<yaml path>;<ops module>` or `<yaml path>;<ops module>;<op_prefix>`" |
| 472 | "like `/foo/bar/ops.yaml;paddle.x.y.ops` or /foo/bar/ops.yaml;paddle.x.y.ops;sparse", |
| 473 | ) |
| 474 | |
| 475 | parser.add_argument( |
| 476 | "--python-api-info-yaml-path", |
| 477 | type=str, |
| 478 | default=None, |
| 479 | help="the yaml file path for python api info", |
| 480 | ) |
| 481 | |
| 482 | args = parser.parse_args() |
| 483 | |
| 484 | return args |
| 485 | |
| 486 | |
| 487 | def generate_stub_file( |