-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Update Unused
parameters in stubs/
#9704
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
object
parameters with Unused
alias
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
from _typeshed import Unused | ||
from collections.abc import Hashable | ||
|
||
__all__ = ("hashkey", "methodkey", "typedkey") | ||
|
||
def hashkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ... | ||
def methodkey(self: object, *args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ... | ||
def methodkey(self: Unused, *args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ... | ||
def typedkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from _typeshed import Incomplete | ||
from typing import type_check_only | ||
from _typeshed import Incomplete, Unused | ||
from typing import NoReturn, type_check_only | ||
from typing_extensions import final | ||
|
||
from pyasn1.type import constraint, namedtype | ||
|
@@ -41,7 +41,7 @@ class NoValue: | |
def __getattr__(self, attr) -> None: ... | ||
# def __new__.<locals>.getPlug.<locals>.plug | ||
@type_check_only | ||
def plug(self, *args: object, **kw: object): ... | ||
def plug(self, *args: Unused, **kw: Unused) -> NoReturn: ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand why this method is in the stub at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pretty sure it's just to use as an alias below. Source: https://github.com/pyasn1/pyasn1/blob/main/pyasn1/type/base.py#L212 (which the comment also point to being defined in the function |
||
# Magic methods assigned dynamically, priority from right to left: plug < str < int < list < dict | ||
__abs__ = int.__abs__ | ||
__add__ = list.__add__ | ||
|
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.
(I haven't looked at the source code here, just speculating.)
If instances of
ImmutableContainer
are meant to be, well, immutable, it might produce better type checking if we just omitted these methods from the stub altogether.Uh oh!
There was an error while loading. Please reload this page.
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.
Maybe relevant to your question:
microsoft/pyright#4653 (comment)
python/mypy#14726