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.1.tar.gz
(1.7 kB
view details)
Built Distribution
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
attr-0.3.1-py2-none-any.whl
(3.6 kB
view details)
File details
Details for the file attr-0.3.1.tar.gz.
File metadata
- Download URL: attr-0.3.1.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9091548058d17f132596e61fa7518e504f76b9a4c61ca7d86e1f96dbf7d4775d
|
|
| MD5 |
68b9a503991241fb2df28488686b0e1e
|
|
| BLAKE2b-256 |
debeddc7f84d4e087144472a38a373d3e319f51a6faf6e5fc1ae897173675f21
|
File details
Details for the file attr-0.3.1-py2-none-any.whl.
File metadata
- Download URL: attr-0.3.1-py2-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b1aaddb85bd9e9c4bd75092f4440d6616ff40b0df0437f00771871670f7c9fd
|
|
| MD5 |
fe529263be9f20fde90b6362cfe48d59
|
|
| BLAKE2b-256 |
d508de12eaa28f6dfac71bae68e2bf8047a05d4aa71318d1678c95cf57799a01
|