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 details)
Built Distribution
File details
Details for the file typing-compat-0.1.0.tar.gz
.
File metadata
- Download URL: typing-compat-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7159db80406de342bc128ab315fae3afe1ddc87cbc2df7a023763090fdfe5d2 |
|
MD5 | 1fac5aa404f16a71bfc76a04058f34e5 |
|
BLAKE2b-256 | c8f347e8f5d02b190aa1d47ad0311f55873121b7a0728c30423ce56bf790232c |
File details
Details for the file typing_compat-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: typing_compat-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8b94eb34c95982fbd34b8daa46fd78c43db33c075b98c79b6e1d77e8f7dd4d5 |
|
MD5 | b115d3d13ca3d0b73aaeb47fe89dc076 |
|
BLAKE2b-256 | ca38837105d59d0b72eebf843dee6eda0c084aba4b6b4f64dd0251435eb86930 |