No project description provided
Project description
Validation Decorators
Simple and fast type-checking and parameter validation.
Do you want to remove visual clutter in your python function? Do you want to check types fast without a lot of boilerplate?
Then this package is right for you.
Not convinced? Check out the following:
# classic
def foo(bar: int, message: str, some_additional_info: dict):
if not isinstance(bar, int):
raise TypeError(...)
if not isinstance(message, str):
raise TypeError(...)
if not isinstance(some_additional_info, dict):
raise TypeError(...)
# now begin to code...
# now
@validate_types(bar=(int,), message=(str,), some_additional_info=(dict,))
def foo(bar: int, message: str):
# begin to code
Do you want to convert your input-types fast and without clutter?
def from_dict(dict_: dict):
return (dict_.get('bar'), dict_.get('message'), dict_.get('some_additional_info')), {}
@convert_with(from_dict)
def foo(bar: int, message:str, some_additional_info: dict):
...
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
Built Distribution
Close
Hashes for decorator_validation-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9881212056bb91d513af4c15465dc44f9431187e55e02e6029414adc2cc6ff40 |
|
MD5 | 5bb9acf32a0978112be824f9087e6914 |
|
BLAKE2b-256 | 26a06615328f46fdf9fc1e94436b00b92dbacc6a81a40a0098666dc310d48502 |
Close
Hashes for decorator_validation-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f95e2d969b8f306b8752513fb4473915f5a8a7c652c9e8e73a491c41cfe07fc |
|
MD5 | ae89c773652e4bfe1a406cf5e2fcc28c |
|
BLAKE2b-256 | 253208c3e3788aeaedadffe1031b61111a90f492aa30ec69ef3d35469727e400 |