Skip to main content

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.

none_throws

Function to make assumptions about Optionals explicit. The function will raise an assertion error if passed None and return the value otherwise.

ParameterSpecification

ParameterSpecifications are a special kind of type variable that captures callable parameter specifications (known as argspecs in the runtime and inspect library) 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 ParameterSpecification
Tparams = ParameterSpecification("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


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.10.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

pyre_extensions-0.0.10-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pyre-extensions-0.0.10.tar.gz.

File metadata

  • Download URL: pyre-extensions-0.0.10.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3rc1+

File hashes

Hashes for pyre-extensions-0.0.10.tar.gz
Algorithm Hash digest
SHA256 22db75d62947c1a4d06f05f3cba75789257ea643a1e7015c2e91795d4f3b2811
MD5 1ba446337303263fdf792cacdbe3058d
BLAKE2b-256 863c5b53f2c94af15ca2944e08336753aed5467140435a2e108578e64e0ad37f

See more details on using hashes here.

Provenance

File details

Details for the file pyre_extensions-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: pyre_extensions-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3rc1+

File hashes

Hashes for pyre_extensions-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 94c8271ddeab3ccc25f867a7911fe1b8007cb72d859e4c95cd62946100c55c2d
MD5 fce96199667cacf48868afbf7017d454
BLAKE2b-256 6b026458554dc519a1a7838e21eaa8aa831a83b898f530b8b1271aad72906e25

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page