-
Notifications
You must be signed in to change notification settings - Fork 150
Open
Description
Stub files can be added to the project to provide static type information that can be used by tools like mypy.
I believe that the simplest way to add this functionality to funcy is to provide stub files along with their respective modules. That is, for example, a stub file colls.pyi corresponding to the contents of colls.py; a funcs.pyi corresponding to funcs.py and so on. Corresponding snippets from funcs.py and funcs.pyi would look like:
funcs.py
def identity(x):
return x
def constantly(x):
return lambda *a, **kw: x
def caller(*a, **kw):
return lambda f: f(*a, **kw)funcs.pyi
from typing import Any, Callable, TypeVar
T = TypeVar('T')
def identity(x: T) -> T: ...
def constantly(x: T) -> Callable[..., T]: ...
def caller(*a: Any, **kw: Any) -> Callable[[Callable[..., T]], T]: ...Take a look at more-itertools to see how this looks like when fully implemented.
If you are interested in this functionality, I could perhaps submit a draft PR by the end of the week.
iainelder, lucasteles, beskep, iilj and thesofakillerslucasteles, kinow and thesofakillers
Metadata
Metadata
Assignees
Labels
No labels