No project description provided
Project description
Parent Aware
A decorator to make objects aware of their parent objects. Particularly useful with dataclasses!
Example
import dataclasses
from parent_aware import parent_aware
@parent_aware
@dataclasses.dataclass
class Child:
num: int
@parent_aware
@dataclasses.dataclass
class Parent:
child: Child
c = Child(2)
p = Parent(child=c)
# Automatically a .parents was added on the child!
assert c.parents == [p]
# If you didn't want .parents, use @parent_aware(parents_name='give_a_name_here')
Installation
pip install parent_aware
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
parent_aware-0.0.1.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file parent_aware-0.0.1.tar.gz
.
File metadata
- Download URL: parent_aware-0.0.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8de0087c563e6f3c76db195c31c508f2e1ba807b918f14671e6aa45090c14f6c |
|
MD5 | 3fea1aabd40951046f343bd7e565d135 |
|
BLAKE2b-256 | 37d19734f94373727677050c07fb8f36f3206d6a96e428b0d07dc141eb6781e4 |
File details
Details for the file parent_aware-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: parent_aware-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b7263be816ec10deed2bb46f9e9ed4a898a7e54270715ae7cfd349bc14f670d |
|
MD5 | 77f4740a078e2b14ac61122a30ab3290 |
|
BLAKE2b-256 | d8b96f79ed56d6766988f5fd91090b80351b88c690e0835a2145046db0d46fa3 |