Add stub for first (#2141)

Reviewed by author in https://github.com/hynek/first/pull/22
This commit is contained in:
Ilya Konstantinov authored and Jelle Zijlstra committed 2018-06-11 19:50:56 -07:00
1 parent 52c02a2364
commit 978c0913c8
1 file changed
+13
+13
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]: ...