enforce python type hints
Project description
Type Enforcer
add as a decorator to any python function to enforce type hints, turning python functions from dynamically to statically typed in the runtime.
Enforces python type hints. Parameters and returns that do not have explicit hints will be assumed to have types of typing.Any Supports basic type hinting operations, like Type[], Union[], and GenericAlias objects like dict[] and list[]
Supports recursive type checking in runtime! If you want to check that the contents in a deep nested datastructure match type hints, just enable recursive type checking with "recursive=True". Note that this significantly increases the computation necessary to run functions so it is advisable to only run this during the debugging phase of development. Note that as of now this only works with lists, tuples, sets, and dicts
Overall, best used with debugging
Install
- pip install TypeEnforcer
- from TypeEnforcer.TypeEnforcement.type_enforcer import TypeEnforcer
- @TypeEnforcer.enforcer
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
Built Distribution
File details
Details for the file TypeEnforcer-1.3.0.tar.gz
.
File metadata
- Download URL: TypeEnforcer-1.3.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d5f60619c2bae4727cf5badb8a4a19bc513e094b8f02222958ca7078f7ceb8a |
|
MD5 | fe7fc4d97219bac9f5ed8afe9e7ca9dc |
|
BLAKE2b-256 | b6d1d3a241d2f5ddb3b74abb0547b31233fb2a2b4e8aedbf639bfb6c380b3f39 |
File details
Details for the file TypeEnforcer-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: TypeEnforcer-1.3.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e2c02728029f88efc4c5dda0241d08a215e6d66f7ec645278dad3090befa752 |
|
MD5 | ddf112f2494c4e964f2cc4a369529a0c |
|
BLAKE2b-256 | 91992ab0c5b9f8d647da8fdafb66f8066b90bc326a714cd62f9d7cca9b78aa24 |