https://github.com/greydevv/pyguardian
Pyguard is a Python library that intends to provide users with a function wrapper that validates parameters.
https://github.com/greydevv/pyguardian
python python-package
Last synced: 3 months ago
JSON representation
Pyguard is a Python library that intends to provide users with a function wrapper that validates parameters.
- Host: GitHub
- URL: https://github.com/greydevv/pyguardian
- Owner: greydevv
- License: mit
- Created: 2020-10-24T00:56:41.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-06T15:43:46.000Z (over 4 years ago)
- Last Synced: 2025-09-24T21:30:50.225Z (5 months ago)
- Topics: python, python-package
- Language: Python
- Homepage: https://pypi.org/project/pyguardian/
- Size: 129 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyguardian
## Description
*pyguardian* is a type-checker for method parameters. Methods are type-checked at runtime via the `guard` decorator:
```python
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
```bash
pip install pyguardian
```
## Documentation
See [DOCUMENTATION.md](https://github.com/greysonDEV/pyguardian/blob/master/DOCUMENTATION.md)
## License
*pyguardian* is licensed under the [MIT](https://github.com/greysonDEV/pyguardian/blob/master/LICENSE) License.