Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rj_type_hint_checker-0.0.0.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

rj_type_hint_checker-0.0.0-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page