Simple decorator to set attributes of target function or class in a DRY way.
Project description
Usage example:
# Django proposes: def my_calculated_field(... my_calculated_field.short_description = 'Field' my_calculated_field.admin_order_field = 'real_field' # DRY: @attr(short_description='Field', admin_order_field='real_field') def my_calculated_field(...
Get it:
sudo pip install attr from attr import attr
New popular attrs.org used by pytest.org defines another “attr” package that shadows this “attr” module.
Please use “dry_attr” alias to unshadow it:
from dry_attr import attr from dry_attr import dry_attr
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
attr-0.3.0.tar.gz
(1.7 kB
view details)
Built Distribution
attr-0.3.0-py2-none-any.whl
(3.6 kB
view details)
File details
Details for the file attr-0.3.0.tar.gz
.
File metadata
- Download URL: attr-0.3.0.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 503a9f2b609a558bb4ad94eb81311f9085e288137d0799069737823f9fc2e794 |
|
MD5 | 749e34c112eb48fb3a1fe8319705f926 |
|
BLAKE2b-256 | 5f8fe6a2ff9741b4d50245dfaeaa0c590c501ea708158dc15aa5a39e7acaf9a1 |
File details
Details for the file attr-0.3.0-py2-none-any.whl
.
File metadata
- Download URL: attr-0.3.0-py2-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb739b842e1269c8ac0b5a31662f4dfcb0a02018f20ec26c897a46ed377d8db5 |
|
MD5 | 3327b782002d50a2c44a32ee36830881 |
|
BLAKE2b-256 | 424d81af81145c002f0469ace081b179bd0e6033f97cbd6f0e1e2ffbd8f51b7c |