Functions for introspecting Python type hints.
Project description
type-analyzer
Installation
⚠️ Requires Python 3.12 or higher
pip install type-analyzer
Quick start
matching_types
from type_analyzer import MatchingTypesConfig, matching_types
# ----- Union type -----
matching_types(str | int)
# => (str, int)
# ----- Generic type alias -----
type StringOr[T] = str | T
config = MatchingTypesConfig(with_type_alias_value=True)
matching_types(StringOr[int], config)
# => (StringOr[int], str, int)
# ----- Generic classes -----
class A[T]:
...
class B[T]:
...
class C[T1, T2](A[T1], B[T2]):
...
config = MatchingTypesConfig(with_bases=True)
matching_types(C[str, int], config)
# => (C[str, int], A[str], B[int])
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
type_analyzer-0.1.1.tar.gz
(6.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file type_analyzer-0.1.1.tar.gz.
File metadata
- Download URL: type_analyzer-0.1.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40f545bc177f77fac7c1f64b898261a3173e2ae44e5bfc5c1513c071c93550ce
|
|
| MD5 |
af83ff925879973c72099e53d23f0b48
|
|
| BLAKE2b-256 |
59269eaa266d0e9ab6185f85c7e49525313bb4ff5fb22db32eb8e74a7bec5b58
|
File details
Details for the file type_analyzer-0.1.1-py3-none-any.whl.
File metadata
- Download URL: type_analyzer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6277e8d4336d7b2e08bbe3a5449fdcf69f0c9de66b03e24398b44ba39e0cd151
|
|
| MD5 |
1d079712d462fa448d209d16d13076da
|
|
| BLAKE2b-256 |
415f369c45c3bdeb30352e9ce2b98b0fa57929ae3883752fc3a8667106682c9b
|