python typing tool
Project description
功能
安装
pip install typing_tool
Or
pdm add typing_tool
入门指南
typing_tool 是一个用于增强 Python 类型检查能力的工具库。特别地,它扩展了 isinstance 和 issubclass 函数的能力,使其能够处理更复杂的类型检查需求。
支持类型
like_isinstance
- 基础类型 str/int/...
- 容器泛型 list[T]/dict[K, V]/...
- Union 类型类型
- Type
- TypeVar 类型变量
- 泛型类 Generic[T]
- Annotated/Field 注解类型
- Protocol 协议类型
- Protocol[T] 泛型协议类型
- TypedDict 字典类型
- dataclass 数据类
like_issubclass
- 基础类型 str/int
- 容器泛型 list[T]/dict[K, V]
- Union 类型类型
- NewType 新类型
- Type
- TypeVar 类型变量
- 泛型类 Generic[T]
- Protocol 协议类型
- Protocol[T] 泛型协议类型
注意
- NewType 无法在运行时进行 like_isinstance
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
typing_tool-0.1.0.tar.gz
(9.1 kB
view details)
Built Distribution
File details
Details for the file typing_tool-0.1.0.tar.gz
.
File metadata
- Download URL: typing_tool-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.18.1 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f95107fcf61c0d19fbfc35418a1e1c3ecd78c929d34f6382a9fb26b3ec8ccda |
|
MD5 | c5d2f48bdfb56dfa8cd0eddaca1a7f5d |
|
BLAKE2b-256 | 4bfe10b9e5b1a22d1f6b7416ad3c887bc8c1e33fb0c6ea8dcc32da049490fd25 |
File details
Details for the file typing_tool-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: typing_tool-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.18.1 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 704dc3c025261ba2f383f8180f1b02e4b9c7e7099b90323102eb4f5f979e96dd |
|
MD5 | 87de1f84c4f6391143f3cf72a2bc6607 |
|
BLAKE2b-256 | 56234386e9b8992cc8c60b9f835fd8094c2fa48b18345a374e42f64e74018ec0 |