Skip to content

Commit d68ea35

Browse files
authored
Fix argparse for Python 3.14 (#19020)
python/cpython#132323 added an optional `color` argument to ArgumentParser. As a side effect the help formatters are now called with two new keyword arguments `prefix_chars` and `color`. Add `**kwargs` to the custom `AugmentedHelpFormatter` and pass it through to the super class.
1 parent daf8922 commit d68ea35

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

mypy/dmypy/client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030

3131
class AugmentedHelpFormatter(argparse.RawDescriptionHelpFormatter):
32-
def __init__(self, prog: str) -> None:
33-
super().__init__(prog=prog, max_help_position=30)
32+
def __init__(self, prog: str, **kwargs: Any) -> None:
33+
super().__init__(prog=prog, max_help_position=30, **kwargs)
3434

3535

3636
parser = argparse.ArgumentParser(

mypy/main.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ def show_messages(
249249

250250
# Make the help output a little less jarring.
251251
class AugmentedHelpFormatter(argparse.RawDescriptionHelpFormatter):
252-
def __init__(self, prog: str) -> None:
253-
super().__init__(prog=prog, max_help_position=28)
252+
def __init__(self, prog: str, **kwargs: Any) -> None:
253+
super().__init__(prog=prog, max_help_position=28, **kwargs)
254254

255255
def _fill_text(self, text: str, width: int, indent: str) -> str:
256256
if "\n" in text:

0 commit comments

Comments
 (0)