Inheritance for iterable attributes.
Project description
accumulate
Inheritance for iterable attributes.
accumulate
eases inheritance of iterable class attributes by accumulating values along the MRO, for example:
from accumulate import accumulate
class Base:
fields = ["id"]
metadata = {"read_only_field": ("id",)}
class User(Base):
fields = accumulate(["name", "password"])
metadata = accumulate(
{
"filter_fields": ("name",),
"hidden_fields": ("password",),
}
)
assert User.fields == ["id", "name", "password"]
assert User.metadata == {
"filter_fields": ("name",),
"hidden_fields": ("password",),
"read_only_field": ("id",),
}
Installation
Install using pip install -U accumulate
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
accumulate-2.0.2.tar.gz
(5.3 kB
view details)
Built Distribution
File details
Details for the file accumulate-2.0.2.tar.gz
.
File metadata
- Download URL: accumulate-2.0.2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bb8b0e21a096521fe30db403a97eb2de25247d713f12241e3e3cd59b1bbdd75 |
|
MD5 | d1b6f71143fb25e2ae5abcddf4813b82 |
|
BLAKE2b-256 | 2a83fa5c062528838cc1f5f053d1358f92da850b31e17d05e9fbc297cc5ef11d |
File details
Details for the file accumulate-2.0.2-py3-none-any.whl
.
File metadata
- Download URL: accumulate-2.0.2-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3b21b9e6774a616678dafc7cadd7d8dd9c3d2ea80d2bb91ae82497b3a1b57dd |
|
MD5 | e706d1494b259171696a127453849b34 |
|
BLAKE2b-256 | 70752ef749e0d16282e2aa4295810f5e5d242341248477f7d73eb22625ad8783 |