mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Add stub for first (#2141)
Reviewed by author in https://github.com/hynek/first/pull/22
This commit is contained in:
committed by
Jelle Zijlstra
parent
52c02a2364
commit
978c0913c8
13
third_party/2and3/first.pyi
vendored
Normal file
13
third_party/2and3/first.pyi
vendored
Normal 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]: ...
|
||||
Reference in New Issue
Block a user