Type system extensions for use with the pyre type checker
Project description
Pyre Extensions
This module defines extensions to the standard “typing” module that are supported by the Pyre typechecker.
ArgSpec
ArgSpecs are a special kind of type variable that captures callable parameter specifications
(known as argspecs in the runtime) instead of types, allowing the typing of decorators which
transform the return type of the given callable.
For example:
from typing import TypeVar, Callable, List
from pyre_extensions import ArgSpec
Tparams = ArgSpec("Tparams")
Treturn = TypeVar("Treturn")
def unwrap(f: Callable[Tparams, List[Treturn]) -> Callable[Tparams, Treturn]: ...
@unwrap
def foo(x: int, y: str, z: bool = False) -> List[int]:
return [1, 2, 3]
decorates foo into a callable that returns int, but still has the same parameters, including their names and whether they are required.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyre-extensions-0.0.5.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for pyre_extensions-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6f052bcd654f94f9556faf79ff50761cbccec59a25abb3bf47d8dd125763dd3 |
|
MD5 | 2577011ba7ab4697d86622710a9534ec |
|
BLAKE2b-256 | 8ea76b44ac7d1232878eab98461cbdf8896ba0627516f749c0efec88142b4077 |