@accepts decorator to check arguments types
Project description
Install
$ [sudo] pip install accepts
Features
- support multiple types argument
- support None argument
- human readable detailed exception message
Examples
>>> @accepts(int)
def inc(value):
return value+1
>>> inc(1) # ok
>>> inc(1.5) # exception
TypeError: ....
# multiple types
>>> @accepts((int,float))
# None
>>> @accepts((int,float,type(None)))
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
accepts-1.0.4.tar.gz
(1.7 kB
view hashes)
Built Distribution
Close
Hashes for accepts-1.0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8c153c38aac5914b0599ab4ab04ea379de82d16a5892689545135aea575f8ef |
|
MD5 | 7faeb12cf0882705f0dbc67f2e695579 |
|
BLAKE2b-256 | 2941fa83b2a81b489be8ece37710b74d399ee662bbffbd55da4d98e9b67c3be3 |