@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
Usage
>>> from accepts import accepts
>>> @accepts(arg1type,arg2type,...)
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,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-0.0.104.tar.gz
(2.6 kB
view details)
File details
Details for the file accepts-0.0.104.tar.gz.
File metadata
- Download URL: accepts-0.0.104.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4541d6e2aaf2d6a1978ce5a007da474f130fade2a6e3341ec2ac0ee9ed6328d2
|
|
| MD5 |
0046ba7ff298856c306c33637ce70661
|
|
| BLAKE2b-256 |
fe7a6c0079615cabc2f398829ad179badb4ee8bd38a4ef6096253419719ca6d8
|