"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.3.tar.gz
(8.9 kB
view hashes)
Built Distribution
Close
Hashes for pyguardian-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ce96060d3b0eb4e7633dd682c5abaab85dcf3505cae89eb41a70a06f9142306 |
|
MD5 | 659babe620079d08624275d880a9724e |
|
BLAKE2b-256 | b5324c7216b2d34ef30e968561ebfef37310fc65196df02bf0f661d52a2bcb8d |