Args for "flexible callable" experimental mypy feature.#793
Args for "flexible callable" experimental mypy feature.#793JukkaL merged 9 commits intopython:masterfrom
Conversation
This is the typeshed for the constructors for the Arg types that we'll now be able to pass to Callable. They really just return their type arguments.
|
In stubs the usual PEP 8 rule about blank lines between functions does not apply (not even one blank line is required). |
|
Flake8 was complaining not about newlines between declarations but about a missing newline at the end of the file. This warning is about detecting truncated content. |
|
Nobody was claiming otherwise. :-) |
|
This should be merged along with python/mypy#2607, not sooner. |
|
@sixolet Could you rebase this one? |
|
@sixolet Can you rebase this too? I'm optimistically removing the "blocked" label, and the "feature" label because we don't really use that. |
|
Yep, will do. |
| _T = TypeVar('_T') | ||
|
|
||
|
|
||
| def Arg(typ: _T = ..., name: Optional[str] = ...) -> _T: ... |
There was a problem hiding this comment.
Rename typ to type for consistency with python/mypy#2607.
There was a problem hiding this comment.
I might prefer typ to avoid shadowing a builtin, although it doesn't matter much here. Either way, obviously the runtime implementation and stub should be consistent.
| from typing import Dict, Type, TypeVar, Optional, Union | ||
|
|
||
| _T = TypeVar('_T') | ||
|
|
There was a problem hiding this comment.
Remove second empty line (in typeshed we tend to use a single empty line between different sorts of things).
There was a problem hiding this comment.
I am a smartass and put this as a separate diff because it is unrelated: #1237
|
|
||
| def KwArg(typ: _T = ...) -> _T: ... | ||
|
|
||
|
|
There was a problem hiding this comment.
Like above -- remove second empty line.
| def Arg(typ: _T = ..., name: Optional[str] = ...) -> _T: ... | ||
|
|
||
| def DefaultArg(typ: _T = ..., name: Optional[str] = ...) -> _T: ... | ||
|
|
There was a problem hiding this comment.
Another style nit: remove empty lines between functions (this is a typeshed convention).
…thing you can do (#2607) Implements an experimental feature to allow Callable to have any kind of signature an actual function definition does. This should enable better typing of callbacks &c. Initial discussion: python/typing#239 Proposal, v. similar to this impl: python/typing#264 Relevant typeshed PR: python/typeshed#793
|
@sixolet Ping -- this still needs to get in before we can advertise the new callable syntax. |
|
Cool. Making sure all the needful is done is on the docket for this afternoon.
… On May 2, 2017, at 9:06 AM, Jukka Lehtosalo ***@***.***> wrote:
@sixolet Ping -- this still needs to get in before we can advertise the new callable syntax.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
I think ready now. |
This is the typeshed for the constructors for the Arg types that we'll now be able to pass to Callable. They really just return their type arguments.
…thing you can do (#2607) Implements an experimental feature to allow Callable to have any kind of signature an actual function definition does. This should enable better typing of callbacks &c. Initial discussion: python/typing#239 Proposal, v. similar to this impl: python/typing#264 Relevant typeshed PR: python/typeshed#793
This is the typeshed for the constructors for the Arg types that we'll now be able to pass to Callable. They really just return their type arguments.
It's a dependency for python/mypy#2607.