Message363216
For the benefit of other developers willing to control text width with `argparse`, using the lambda function let `mypy` fail with the following error:
541: error: Argument "formatter_class" to "ArgumentParser" has incompatible type "Callable[[Any], RawDescriptionHelpFormatter]"; expected "Type[HelpFormatter]"
So I am reverting back to the following custom formatting class:
class RawDescriptionHelpFormatterMaxTextWidth80(argparse.RawDescriptionHelpFormatter):
"""Set maximum text width = 80."""
def __init__(self, prog):
width = min(80, shutil.get_terminal_size().columns - 2)
argparse.RawDescriptionHelpFormatter.__init__(self, prog, width=width) |
|
Date |
User |
Action |
Args |
2020-03-02 23:33:22 | lucatrv | set | recipients:
+ lucatrv, rhettinger, paul.j3 |
2020-03-02 23:33:22 | lucatrv | set | messageid: <1583192002.84.0.926921679158.issue39809@roundup.psfhosted.org> |
2020-03-02 23:33:22 | lucatrv | link | issue39809 messages |
2020-03-02 23:33:22 | lucatrv | create | |
|