a rough equivilent of isinstance that works with type hints
Project description
Type Hint Checker
a replacement for isinstance that works with type hints
exports are_type_compatible
which can be used as a drop in replacement for isinstance
but works with type hints
are_type_compatible([0, 1, 2], list[int]) # true
are_type_compatible([0, 1, "2"], list[int]) # false
also takes two optional arguments the context which would be the function or class the type hint came from and the namespace which is the namespace to search for types
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
Built Distribution
Close
Hashes for rj_type_hint_checker-0.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41885e45de7bc9cd41e9a0a2e0f6995a3eab6d047e5c7d6e96a88bb9a4324ce8 |
|
MD5 | 207563785b6422c2f595a0e7b98cb6de |
|
BLAKE2b-256 | 7d044b945fdeafd4b14cc6920f52cacc8c7638286d88d48972fbb2e9bbe3226c |
Close
Hashes for rj_type_hint_checker-0.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 265c6ea86ba18ca994b4f09dc73cbf5546c6865c1d374fbbc7bd46b155c9a337 |
|
MD5 | 937d9ffef9da4f7f4c84100c0c7a00df |
|
BLAKE2b-256 | 9fd5cc59a1e3d6892543af5d5784c383307985b07f4b3e8eeec73ab9e6e13d8a |