A simple attribution checker implemented as a decorator
Project description
attrcheck: attribution checker
This module provides a simple attribution checker implemented as a decorator. All functionality are provided as keyword arguments of the decorator.
Sample example of usage is following:
>>> from attrcheck import attrcheck >>> @attrcheck(x=['real'], y=['index', 'strip'], z=dir(list)) ... def foo(x, y, z=[]): passThe code above means the following:
>>> def foo(x, y, z=[]): ... if not hasattr(x, 'real'): ... raise AttributeError ... if not hasattr(y, 'index'): ... raise AttributeError ... if not hasattr(y, 'strip'): ... raise AttributeError ... for name in dir(list): ... if not hasattr(z, name): ... raise AttributeErrorIn addition, attrcheck can check default argument values. Thus, the following code throws AttributeError.
>>> @attrcheck(y=dir(str)) ... def bar(x, y=[]): pass
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 Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file attrcheck-0.1.2.tar.gz.
File metadata
- Download URL: attrcheck-0.1.2.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a18d733ecf7def34fbc3e0066ccdf7b996ed54c5213e19788c73ac0075e72ab
|
|
| MD5 |
26b660ce2971ea1f3aee8a438e02e2a9
|
|
| BLAKE2b-256 |
1bef5a2aecc3573a6029ee6437e0506ac73ba7b94a8dc986b2f15b62977138c7
|
File details
Details for the file attrcheck-0.1.2-py3.2.egg.
File metadata
- Download URL: attrcheck-0.1.2-py3.2.egg
- Upload date:
- Size: 5.8 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9a63ed68b24324973909aaa209e35ffa452c6547d5a036b761fb1960ac31be6
|
|
| MD5 |
5b93a559d2a58839b2c7787d80032056
|
|
| BLAKE2b-256 |
f4533cc21083cc56575b37ed050f5a9644a42829391801eac2c81d998958d82c
|
File details
Details for the file attrcheck-0.1.2-py2.7.egg.
File metadata
- Download URL: attrcheck-0.1.2-py2.7.egg
- Upload date:
- Size: 5.8 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0031c61b6d3996ebcb0d5a000641156508efbf51e6c65da79aeaca4adacf09a9
|
|
| MD5 |
148d4c006e54d1ad6cf8ec43dd853ace
|
|
| BLAKE2b-256 |
ff18ab0e75ff85b0cae037ecfb8f82b60a306d5205b6205d3507227f1b2954c1
|