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.0.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.0.tar.gz.
File metadata
- Download URL: type_analyzer-0.1.0.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 |
37b419a1da5199fceb99c5a59688ce2081d881d2f21b144849fd38614a010efa
|
|
| MD5 |
b91f3b3828dd21fa4988d36bff6c58d0
|
|
| BLAKE2b-256 |
42cf80d1859b0438c1c844088c3fc4f74a53348de54da7d76e7928ec526d1a5e
|
File details
Details for the file type_analyzer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: type_analyzer-0.1.0-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 |
e36e0ccfb4be26ece9a832a194be8b689be5b9e7361493b06bbbc0d6ba66992e
|
|
| MD5 |
1e2c35a177a2b4aa830c900881e3ebf9
|
|
| BLAKE2b-256 |
28c2eba125f357066048068a2073f158dfaf47e3a8a8175e645ab3fc43be80e0
|