Python typing compatibility library
Project description
typing-compat
Python typing compatibility library
In Python >=3.8 the typing.get_origin
and typing.get_args
functions are
provided. This library aims to bring the identical behaviour of these functions
to other versions of Python.
Getting started
pip install typing-compat
Usage
>>> from typing import List, Tuple, TypeVar
>>> from typing_compat import get_args, get_origin
>>> T = TypeVar('T')
>>> tp = List[Tuple[T, T]][int]
>>> get_args(tp)
(typing.Tuple[int, int],)
>>> get_origin(tp)
<class 'list'>
License
This library is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
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
typing-compat-0.1.0.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for typing_compat-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8b94eb34c95982fbd34b8daa46fd78c43db33c075b98c79b6e1d77e8f7dd4d5 |
|
MD5 | b115d3d13ca3d0b73aaeb47fe89dc076 |
|
BLAKE2b-256 | ca38837105d59d0b72eebf843dee6eda0c084aba4b6b4f64dd0251435eb86930 |