-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Update argparse.pyi #1578
Conversation
argparse.Namespace is also useful as a Bunch
stdlib/2and3/argparse.pyi
Outdated
@@ -117,6 +117,7 @@ class Action: | |||
option_string: _Text = ...) -> None: ... | |||
|
|||
class Namespace: | |||
def __init__(self, **kwargs: Dict[_Text, Any]) -> None: ... |
There was a problem hiding this comment.
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.)
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: ... |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
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).
argparse.Namespace is also useful as a Bunch