Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 4, 2020

Conversation

hauntsaninja
Copy link
Collaborator

No description provided.

class BooleanOptionalAction(Action):
def __init__(
self,
option_strings: Sequence[Text],
Copy link
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

dest: Text,
const: Any = ...,
default: Any = ...,
type: Optional[Union[Callable[[Text], _T], Callable[[str], _T], FileType]] = ...,
Copy link
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
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

self,
option_strings: Sequence[Text],
dest: Text,
const: Any = ...,
Copy link
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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants