Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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
Release History

Release History

This version
History Node

0.1.2

History Node

0.1.1

History Node

0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
attrcheck-0.1.2-py2.7.egg (5.8 kB) Copy SHA256 Checksum SHA256 2.7 Egg Oct 10, 2011
attrcheck-0.1.2-py3.2.egg (5.8 kB) Copy SHA256 Checksum SHA256 3.2 Egg Oct 10, 2011
attrcheck-0.1.2.tar.gz (2.4 kB) Copy SHA256 Checksum SHA256 Source Oct 10, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting