Skip to content
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

Args for "flexible callable" experimental mypy feature. #793

Merged
merged 9 commits into from
May 2, 2017
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion third_party/2and3/mypy_extensions.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
from typing import Dict, Type, TypeVar, Union
from typing import Dict, Type, TypeVar, Optional, Union

_T = TypeVar('_T')

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove second empty line (in typeshed we tend to use a single empty line between different sorts of things).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am a smartass and put this as a separate diff because it is unrelated: #1237


def Arg(typ: _T = ..., name: Optional[str] = ...) -> _T: ...
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename typ to type for consistency with python/mypy#2607.

Copy link
Member

@JelleZijlstra JelleZijlstra Apr 25, 2017

Choose a reason for hiding this comment

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

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.


def DefaultArg(typ: _T = ..., name: Optional[str] = ...) -> _T: ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Another style nit: remove empty lines between functions (this is a typeshed convention).

def NamedArg(typ: _T = ..., name: Optional[str] = ...) -> _T: ...

def DefaultNamedArg(typ: _T = ..., name: Optional[str] = ...) -> _T: ...

def VarArg(typ: _T = ...) -> _T: ...

def KwArg(typ: _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.

Like above -- remove second empty line.

def TypedDict(typename: str, fields: Dict[str, Type[_T]]) -> Type[dict]: ...

# Return type that indicates a function does not return.
Expand Down