"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
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
pyguardian-0.0.2.tar.gz
(8.3 kB
view hashes)
Built Distribution
Close
Hashes for pyguardian-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e53960486bb40701be312dc5760300dbd0983c786523f738fece699f56ed20eb |
|
MD5 | c0445a08ec863202f57bd7436c4adc7d |
|
BLAKE2b-256 | cdf0362744c95110efe8bd44ef293549d08250db577ca3343b10a40821b4554f |