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

Skip to content

merge py2 and py3 argparse #352

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 1 commit into from
Jul 11, 2016
Merged

Conversation

tharvik
Copy link
Contributor

@tharvik tharvik commented Jul 11, 2016

Add types to argparse, merge both version. There is some undocumented (in general, argparse is badly documented on docs.python.org) element which I removed (thus being more implementation agnostic), but I keep some used by mypy, let me know if something break.

for example help(argparse.HelpFormatter)

Only the name of this class is considered a public API. All the methods provided by the class are considered an implementation detail.

but mypy use the __init__ of it.

conflict_handler: str = ...,
add_help: bool = ...) -> None: ...
def add_argument(self,
*name_or_flags: Union[str, List[str]],
Copy link
Contributor

Choose a reason for hiding this comment

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

stray asterisk?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From docs.python.org, we can have parser.add_argument('-f', '--foo'), so that seems correct to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant: You can only have one "varargs" argument in a function definition. Maybe you need to remove the single "" below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ho, I see what you mean, correct, that's a typo (fixed).

@tharvik tharvik force-pushed the improve_argparse branch from 81da6f4 to 87235ad Compare July 11, 2016 13:24
@matthiaskramm matthiaskramm merged commit b48ddf7 into python:master Jul 11, 2016
@tharvik tharvik deleted the improve_argparse branch July 11, 2016 13:39
hswong3i pushed a commit to alvistack/python-typeshed that referenced this pull request May 25, 2025
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