Skip to main content

"Runtime type-checking of method parameters."

Project description

pyguardian

Description

pyguardian is a type-checker for method parameters. Methods are type-checked at runtime via the guard decorator:

from pyguardian import guard

@guard(int, int)
def add(a, b):
    return a+b

# Successful call
>>> add(1,2)
3

# Unsccessful call ("2" is not an integer!)
>>> add(1,"2")
InvalidArgumentTypeError: 'add' expects value of type 'int' for parameter 'b' but got 'str'

Installation

pip install pyguardian

Documentation

See DOCUMENTATION.md

License

pyguardian is licensed under the MIT License.

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

pyguardian-0.0.3.tar.gz (8.9 kB view hashes)

Uploaded Source

Built Distribution

pyguardian-0.0.3-py3-none-any.whl (9.5 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