Commit 336bd2f
committed
Make BooleanOptionalAction's addition of default to help more similar to other actions.
Help for other actions omit the default value if default is SUPPRESS or
already contains the special format string '%(default)'. Add those
special cases to BooleanOptionalAction's help formatting too.
Other actions emit (default: None) when the default value is None. This
allows documenting that the unset case is treated differently. Add this
functionality to BooleanOptionalAction as well.
Fixes https://bugs.python.org/issue44587 so that default=SUPPRESS is not
emitted.
Fixes https://bugs.python.org/issue38956 as this code will detect
whether '%(default)s' has already been specified in the help string.1 parent b04e02c commit 336bd2f
File tree
3 files changed
+45
-22
lines changed- Lib
- test
- Misc/NEWS.d/next/Library
3 files changed
+45
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
156 | 177 | | |
157 | 178 | | |
158 | 179 | | |
| |||
695 | 716 | | |
696 | 717 | | |
697 | 718 | | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
| 719 | + | |
705 | 720 | | |
706 | 721 | | |
707 | 722 | | |
| |||
719 | 734 | | |
720 | 735 | | |
721 | 736 | | |
722 | | - | |
723 | 737 | | |
724 | 738 | | |
725 | 739 | | |
| |||
882 | 896 | | |
883 | 897 | | |
884 | 898 | | |
885 | | - | |
886 | | - | |
887 | | - | |
888 | 899 | | |
889 | 900 | | |
890 | 901 | | |
| |||
896 | 907 | | |
897 | 908 | | |
898 | 909 | | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
899 | 913 | | |
900 | 914 | | |
901 | 915 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3348 | 3348 | | |
3349 | 3349 | | |
3350 | 3350 | | |
| 3351 | + | |
3351 | 3352 | | |
3352 | 3353 | | |
3353 | 3354 | | |
| |||
3742 | 3743 | | |
3743 | 3744 | | |
3744 | 3745 | | |
3745 | | - | |
| 3746 | + | |
3746 | 3747 | | |
3747 | 3748 | | |
| 3749 | + | |
3748 | 3750 | | |
3749 | 3751 | | |
3750 | 3752 | | |
| |||
4423 | 4425 | | |
4424 | 4426 | | |
4425 | 4427 | | |
| 4428 | + | |
| 4429 | + | |
4426 | 4430 | | |
4427 | 4431 | | |
4428 | 4432 | | |
| |||
4432 | 4436 | | |
4433 | 4437 | | |
4434 | 4438 | | |
4435 | | - | |
4436 | | - | |
| 4439 | + | |
| 4440 | + | |
4437 | 4441 | | |
4438 | 4442 | | |
4439 | 4443 | | |
4440 | 4444 | | |
4441 | 4445 | | |
4442 | 4446 | | |
4443 | 4447 | | |
4444 | | - | |
4445 | | - | |
| 4448 | + | |
| 4449 | + | |
4446 | 4450 | | |
4447 | 4451 | | |
4448 | | - | |
4449 | | - | |
4450 | | - | |
4451 | | - | |
4452 | | - | |
| 4452 | + | |
| 4453 | + | |
| 4454 | + | |
| 4455 | + | |
| 4456 | + | |
| 4457 | + | |
4453 | 4458 | | |
4454 | 4459 | | |
4455 | 4460 | | |
4456 | 4461 | | |
4457 | | - | |
| 4462 | + | |
4458 | 4463 | | |
4459 | 4464 | | |
4460 | 4465 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments