Help message formatter which adds default values to argument help. Only the name of this class is considered a public API. All the methods provided by the class are considered an implementation detail.
| 676 | |
| 677 | |
| 678 | class ArgumentDefaultsHelpFormatter(HelpFormatter): |
| 679 | """Help message formatter which adds default values to argument help. |
| 680 | |
| 681 | Only the name of this class is considered a public API. All the methods |
| 682 | provided by the class are considered an implementation detail. |
| 683 | """ |
| 684 | |
| 685 | def _get_help_string(self, action): |
| 686 | help = action.help |
| 687 | if '%(default)' not in action.help: |
| 688 | if action.default is not SUPPRESS: |
| 689 | defaulting_nargs = [OPTIONAL, ZERO_OR_MORE] |
| 690 | if action.option_strings or action.nargs in defaulting_nargs: |
| 691 | help += ' (default: %(default)s)' |
| 692 | return help |
| 693 | |
| 694 | |
| 695 | # ===================== |
nothing calls this directly
no outgoing calls
no test coverage detected