Add stub for first (#2141)

Reviewed by author in https://github.com/hynek/first/pull/22
This commit is contained in:
Ilya Konstantinov
2018-06-11 19:50:56 -07:00
committed by Jelle Zijlstra
parent 52c02a2364
commit 978c0913c8

13
third_party/2and3/first.pyi vendored Normal file
View File

@@ -0,0 +1,13 @@
from typing import Any, Callable, Iterable, Optional, overload, TypeVar, Union
_T = TypeVar('_T')
_S = TypeVar('_S')
@overload
def first(iterable: Iterable[_T]) -> Optional[_T]: ...
@overload
def first(iterable: Iterable[_T], default: _S) -> Union[_T, _S]: ...
@overload
def first(iterable: Iterable[_T], default: _S, key: Optional[Callable[[_T], Any]]) -> Union[_T, _S]: ...
@overload
def first(iterable: Iterable[_T], *, key: Optional[Callable[[_T], Any]]) -> Optional[_T]: ...