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 hashes)
Built Distribution
Close
Hashes for accumulate-2.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3b21b9e6774a616678dafc7cadd7d8dd9c3d2ea80d2bb91ae82497b3a1b57dd |
|
MD5 | e706d1494b259171696a127453849b34 |
|
BLAKE2b-256 | 70752ef749e0d16282e2aa4295810f5e5d242341248477f7d73eb22625ad8783 |