Skip to content

Update argparse.pyi #1578

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 3 commits into from
Aug 27, 2017
Merged

Update argparse.pyi #1578

merged 3 commits into from
Aug 27, 2017

Conversation

rmcgibbo
Copy link
Contributor

argparse.Namespace is also useful as a Bunch

argparse.Namespace is also useful as a Bunch
@@ -117,6 +117,7 @@ class Action:
option_string: _Text = ...) -> None: ...

class Namespace:
def __init__(self, **kwargs: Dict[_Text, Any]) -> None: ...
Copy link
Member

Choose a reason for hiding this comment

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

This means that every keyword argument must be a Dict. I think you want just **kwargs: Any. (That would also fix the Travis failures.)

@rmcgibbo
Copy link
Contributor Author

Oh, that makes sense. Thanks for the tip!

@@ -117,6 +117,7 @@ class Action:
option_string: _Text = ...) -> None: ...

class Namespace:
def __init__(self, **kwargs: Any) -> None: ...
def __getattr__(self, name: _Text) -> Any: ...
def __setattr__(self, name: _Text, value: Any) -> None: ...
Copy link
Member

Choose a reason for hiding this comment

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

Looking at the code I noticed it also has def __contains__(self, key: str) -> bool: ...; would you mind adding that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! I'll merge once Travis passes (unless I forget).

@JelleZijlstra JelleZijlstra merged commit f1a13ce into python:master Aug 27, 2017
@rmcgibbo rmcgibbo deleted the patch-1 branch August 27, 2017 21:38
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