Returns argparser for use by main(). Allows the ability to toggle default help message with a custom help flag so that argparser does not throw SystemExit when --help is passed in. Useful for custom --help functionality. Returns: (argparse.ArgumentParser): argparser used by mai
(
networks: List[str], description: str = "", add_default_help=False
)
| 244 | |
| 245 | |
| 246 | def get_default_parser( |
| 247 | networks: List[str], description: str = "", add_default_help=False |
| 248 | ) -> argparse.ArgumentParser: |
| 249 | """ |
| 250 | Returns argparser for use by main(). Allows the ability to toggle default help message with a custom help flag |
| 251 | so that argparser does not throw SystemExit when --help is passed in. Useful for custom --help functionality. |
| 252 | |
| 253 | Returns: |
| 254 | (argparse.ArgumentParser): argparser used by main() |
| 255 | """ |
| 256 | # This variable is set so that usage errors don't show up in wrapper |
| 257 | parser = argparse.ArgumentParser( |
| 258 | conflict_handler="resolve", |
| 259 | description=description, |
| 260 | add_help=add_default_help, |
| 261 | prog="run.py", |
| 262 | ) |
| 263 | required_group = parser.add_argument_group("required wrapper arguments") |
| 264 | |
| 265 | required_group.add_argument("action", choices=WRAPPER_ACTIONS) |
| 266 | |
| 267 | if not add_default_help: |
| 268 | parser.add_argument( |
| 269 | "--help", |
| 270 | "-h", |
| 271 | help="Shows help message. If --network is supplied, returns help for specific script.", |
| 272 | action="store_true", |
| 273 | ) |
| 274 | return parser |
| 275 | |
| 276 | |
| 277 | def verify_python_version(): |