"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 details)
Built Distribution
File details
Details for the file pyguardian-0.0.3.tar.gz
.
File metadata
- Download URL: pyguardian-0.0.3.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d29ae168f93f3f56ebeade9bd608063a0e2a896a6ad238fc09ca34d46019b0a |
|
MD5 | 533b664b414d2e7669617a2719143a5d |
|
BLAKE2b-256 | 39e81fe2896c8507b0f4f066f4966edd0c3c537c26b36179c0636d50462880ac |
File details
Details for the file pyguardian-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: pyguardian-0.0.3-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ce96060d3b0eb4e7633dd682c5abaab85dcf3505cae89eb41a70a06f9142306 |
|
MD5 | 659babe620079d08624275d880a9724e |
|
BLAKE2b-256 | b5324c7216b2d34ef30e968561ebfef37310fc65196df02bf0f661d52a2bcb8d |