-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[WIP] Typeshed support for mypy_extensions.declared_type #1230
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
Conversation
@@ -9,3 +9,5 @@ def TypedDict(typename: str, fields: Dict[str, Type[_T]]) -> Type[dict]: ... | |||
# This type is equivalent to the None type, but the no-op Union is necessary to | |||
# distinguish the None type from the None value. | |||
NoReturn = Union[None] | |||
|
|||
def decorated_type(t: Type) -> Callable[[_T], _T]: pass |
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.
Extremely minor, but I prefer Type[Any]
over just Type
to be explicit; typeshed style is to use ...
instead of pass
, and please add a closing newline.
Looks good, I'll merge this once the corresponding mypy PR is merged. |
@@ -9,3 +9,5 @@ def TypedDict(typename: str, fields: Dict[str, Type[_T]]) -> Type[dict]: ... | |||
# This type is equivalent to the None type, but the no-op Union is necessary to | |||
# distinguish the None type from the None value. | |||
NoReturn = Union[None] | |||
|
|||
def decorated_type(t: Type[Any]) -> Callable[[_T], _T]: ... |
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.
The argument type should probably be Any
, since some valid types aren't real types (e.g. 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.
Yep. Thanks. Good catch.
Gonna conflict with my other PR, but that'll be easy to merge -- just imports I think. |
Looks good; let's merge this after the mypy PR is merged. |
@JukkaL ping seems ready |
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.
One optional suggestion. I'm not sure if this ought to be merged before or after the corresponding mypy change (#3291).
@@ -1,4 +1,4 @@ | |||
from typing import Dict, Type, TypeVar, Optional, Union | |||
from typing import Dict, Type, TypeVar, Union, Callable, Any, Optional |
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.
Usually when I update such an import list I also alphabetize the names.
Maybe this should go into typing_extensions (see https://github.com/python/typing/tree/master/typing_extensions). |
Thanks for keeping this fresh, but the mypy patch is still out of date. I think we need a new volunteer... |
Closing this since there's been no activity for many months. If somebody wants to pick it up we can re-open this PR. |
The typeshed part of python/mypy#3291