Skip to content

argparse: type Action.__call__ values as Any via _ActionValue - #16263

Open
ekanshul wants to merge 1 commit into
python:mainfrom
ekanshul:argparse-action-values
Open

argparse: type Action.__call__ values as Any via _ActionValue#16263
ekanshul wants to merge 1 commit into
python:mainfrom
ekanshul:argparse-action-values

Conversation

@ekanshul

Copy link
Copy Markdown
Contributor

Closes #7559

Introduce a private _ActionValue alias to Any (with a comment describing the possible runtime types) and use it for the values parameter of Action.__call__, so that subclasses can narrow it without override errors.

Agent used: Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

meson (https://github.com/mesonbuild/meson)
+ mesonbuild/cmdline.py:134: error: Unused "type: ignore" comment  [unused-ignore]
+ mesonbuild/cmdline.py:171: error: Unused "type: ignore" comment  [unused-ignore]
+ mesonbuild/cmdline.py:192: error: Unused "type: ignore" comment  [unused-ignore]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implications of Union in argparse.Action.__call__ parameter types

1 participant