Skip to main content

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=[]): pass

The 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 AttributeError

In addition, attrcheck can check default argument values. Thus, the following code throws AttributeError.

>>> @attrcheck(y=dir(str))
... def bar(x, y=[]): pass

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

attrcheck-0.1.2.tar.gz (2.4 kB view details)

Uploaded Source

Built Distributions

attrcheck-0.1.2-py3.2.egg (5.8 kB view details)

Uploaded Source

attrcheck-0.1.2-py2.7.egg (5.8 kB view details)

Uploaded Source

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

Hashes for attrcheck-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2a18d733ecf7def34fbc3e0066ccdf7b996ed54c5213e19788c73ac0075e72ab
MD5 26b660ce2971ea1f3aee8a438e02e2a9
BLAKE2b-256 1bef5a2aecc3573a6029ee6437e0506ac73ba7b94a8dc986b2f15b62977138c7

See more details on using hashes here.

File details

Details for the file attrcheck-0.1.2-py3.2.egg.

File metadata

File hashes

Hashes for attrcheck-0.1.2-py3.2.egg
Algorithm Hash digest
SHA256 c9a63ed68b24324973909aaa209e35ffa452c6547d5a036b761fb1960ac31be6
MD5 5b93a559d2a58839b2c7787d80032056
BLAKE2b-256 f4533cc21083cc56575b37ed050f5a9644a42829391801eac2c81d998958d82c

See more details on using hashes here.

File details

Details for the file attrcheck-0.1.2-py2.7.egg.

File metadata

File hashes

Hashes for attrcheck-0.1.2-py2.7.egg
Algorithm Hash digest
SHA256 0031c61b6d3996ebcb0d5a000641156508efbf51e6c65da79aeaca4adacf09a9
MD5 148d4c006e54d1ad6cf8ec43dd853ace
BLAKE2b-256 ff18ab0e75ff85b0cae037ecfb8f82b60a306d5205b6205d3507227f1b2954c1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page