Skip to content

[WIP] Typeshed support for mypy_extensions.declared_type#1230

Closed
sixolet wants to merge 6 commits intopython:masterfrom
sixolet:decorated-type
Closed

[WIP] Typeshed support for mypy_extensions.declared_type#1230
sixolet wants to merge 6 commits intopython:masterfrom
sixolet:decorated-type

Conversation

@sixolet
Copy link
Contributor

@sixolet sixolet commented May 1, 2017

The typeshed part of python/mypy#3291

# distinguish the None type from the None value.
NoReturn = Union[None]

def decorated_type(t: Type) -> Callable[[_T], _T]: pass No newline at end of file
Copy link
Member

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.

@JelleZijlstra
Copy link
Member

Looks good, I'll merge this once the corresponding mypy PR is merged.

# distinguish the None type from the None value.
NoReturn = Union[None]

def decorated_type(t: Type[Any]) -> Callable[[_T], _T]: ...
Copy link
Contributor

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Thanks. Good catch.

@sixolet
Copy link
Contributor Author

sixolet commented May 2, 2017

Gonna conflict with my other PR, but that'll be easy to merge -- just imports I think.

@JelleZijlstra
Copy link
Member

Looks good; let's merge this after the mypy PR is merged.

@sixolet sixolet changed the title Typeshed support for mypy_extensions.decorated_type Typeshed support for mypy_extensions.declared_type Jun 15, 2017
@sixolet
Copy link
Contributor Author

sixolet commented Jun 15, 2017

@JukkaL ping seems ready

Copy link
Member

@gvanrossum gvanrossum left a 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
Copy link
Member

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.

@gvanrossum
Copy link
Member

Maybe this should go into typing_extensions (see https://github.com/python/typing/tree/master/typing_extensions).

@gvanrossum gvanrossum changed the title Typeshed support for mypy_extensions.declared_type [WIP] Typeshed support for mypy_extensions.declared_type Mar 9, 2018
@gvanrossum gvanrossum removed the blocked label Mar 9, 2018
@gvanrossum
Copy link
Member

Thanks for keeping this fresh, but the mypy patch is still out of date. I think we need a new volunteer...

@JelleZijlstra
Copy link
Member

Closing this since there's been no activity for many months. If somebody wants to pick it up we can re-open this PR.

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.

4 participants