start function used when show_config is True
(self)
| 475 | return self.subapp.start() |
| 476 | |
| 477 | def start_show_config(self) -> None: |
| 478 | """start function used when show_config is True""" |
| 479 | config = self.config.copy() |
| 480 | # exclude show_config flags from displayed config |
| 481 | for cls in self.__class__.mro(): |
| 482 | if cls.__name__ in config: |
| 483 | cls_config = config[cls.__name__] |
| 484 | cls_config.pop("show_config", None) |
| 485 | cls_config.pop("show_config_json", None) |
| 486 | |
| 487 | if self.show_config_json: |
| 488 | json.dump(config, sys.stdout, indent=1, sort_keys=True, default=repr) |
| 489 | # add trailing newline |
| 490 | sys.stdout.write("\n") |
| 491 | return |
| 492 | |
| 493 | if self._loaded_config_files: |
| 494 | print("Loaded config files:") |
| 495 | for f in self._loaded_config_files: |
| 496 | print(" " + f) |
| 497 | print() |
| 498 | |
| 499 | for classname in sorted(config): |
| 500 | class_config = config[classname] |
| 501 | if not class_config: |
| 502 | continue |
| 503 | print(classname) |
| 504 | pformat_kwargs: StrDict = dict(indent=4, compact=True) # noqa: C408 |
| 505 | |
| 506 | for traitname in sorted(class_config): |
| 507 | value = class_config[traitname] |
| 508 | print(f" .{traitname} = {pprint.pformat(value, **pformat_kwargs)}") |
| 509 | |
| 510 | def print_alias_help(self) -> None: |
| 511 | """Print the alias parts of the help.""" |