Skip to content

argparse: fix error __init__, add BooleanOptionalAction for py39 - #4144

Merged
JelleZijlstra merged 2 commits into
python:masterfrom
hauntsaninja:argparse
Jun 4, 2020
Merged

JelleZijlstra merged 2 commits into
python:masterfrom
hauntsaninja:argparse

Conversation

@hauntsaninja

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread stdlib/2and3/argparse.pyi Outdated
class BooleanOptionalAction(Action):
def __init__(
self,
option_strings: Sequence[Text],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is Python 3-only so no real need to use Text

Comment thread stdlib/2and3/argparse.pyi
dest: Text,
const: Any = ...,
default: Any = ...,
type: Optional[Union[Callable[[Text], _T], Callable[[str], _T], FileType]] = ...,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this class be generic over _T?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so? Not sure what that would allows us to accomplish

Comment thread stdlib/2and3/argparse.pyi Outdated
self,
option_strings: Sequence[Text],
dest: Text,
const: Any = ...,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand the description of this argument but it sounds like it and default should be of type Optional[_T].

@hauntsaninja

Copy link
Copy Markdown
Collaborator Author

Re: the unused in implementation, we'll see what happens python/cpython#11478 (review)

@JelleZijlstra
JelleZijlstra merged commit 5369e81 into python:master Jun 4, 2020
@hauntsaninja
hauntsaninja deleted the argparse branch June 4, 2020 23:01
hauntsaninja pushed a commit to hauntsaninja/typeshed that referenced this pull request Jun 26, 2020
python#4144 and
python/cpython#11478 (review)
resulted in the issue being fixed upstream.

A fix in time saves a branch in typeshed :-)
srittau pushed a commit that referenced this pull request Jun 26, 2020
#4144 and
python/cpython#11478 (review)
resulted in the issue being fixed upstream.


Co-authored-by: hauntsaninja <>
vishalkuo pushed a commit to vishalkuo/typeshed that referenced this pull request Jun 26, 2020
vishalkuo pushed a commit to vishalkuo/typeshed that referenced this pull request Jun 26, 2020
python#4144 and
python/cpython#11478 (review)
resulted in the issue being fixed upstream.


Co-authored-by: hauntsaninja <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants