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.2.tar.gz
(2.6 kB
view details)
Built Distribution
File details
Details for the file attr-0.3.2.tar.gz
.
File metadata
- Download URL: attr-0.3.2.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ceebca768181cdcce9827611b1d728e592be5d293911539ea3d0b0bfa1146f4 |
|
MD5 | c032c90f50d21029b4d2178ff2d9025f |
|
BLAKE2b-256 | e4d2d0a5e36049ec6f72f4951b7f843b359d21e5a208b120618686187234dd1d |
File details
Details for the file attr-0.3.2-py2.py3-none-any.whl
.
File metadata
- Download URL: attr-0.3.2-py2.py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f4bffeea8c27387bde446675a7ac24f3b8fea1075f12d849b5f5c5181fc8336 |
|
MD5 | 5f6f3a7286158b1400343403de204c2e |
|
BLAKE2b-256 | 68ebe96c25f5accb24b151c5a559961f29af2ef089725b547efb185985c73e10 |