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.3.tar.gz
(6.3 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.3.tar.gz.
File metadata
- Download URL: type_analyzer-0.1.3.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"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 |
b4d4d815ce97d5b02baa48f24b4352674dad8e50170d4a26fd22ce3534846b5e
|
|
| MD5 |
06fc8e0ba4fa7f57a398ee454512e01e
|
|
| BLAKE2b-256 |
86828cdac5b7559a32ea1b6d052b58eaba59662955ae7307d10eadca4a77fe23
|
File details
Details for the file type_analyzer-0.1.3-py3-none-any.whl.
File metadata
- Download URL: type_analyzer-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"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 |
33b0df7006f071dbf6a72ef124d66d58ee9f81d072d4d5adaa73fe4e2132d69b
|
|
| MD5 |
edd31c600c3aee80072532a5cbd443fd
|
|
| BLAKE2b-256 |
974d9cc2cdc844167e14ee5a3f3e16db7df225499aecd9cfa3a804778f974e23
|