mirror of
https://github.com/fmtr/haco.git
synced 2026-12-03 13:20:18 -05:00
Add prototype doc
This commit is contained in:
parent
8dc96d708d
commit
f42becceb0
24 changed files with 657 additions and 51 deletions
11
haco/base.py
11
haco/base.py
|
|
@ -6,9 +6,20 @@ from typing import Any
|
|||
|
||||
@dataclass(kw_only=True)
|
||||
class Base:
|
||||
"""
|
||||
|
||||
Base class for haco objects. Provides model dumping functionality.
|
||||
|
||||
"""
|
||||
|
||||
DATA = dict()
|
||||
|
||||
def model_dump(self) -> dict[str, Any]:
|
||||
"""
|
||||
|
||||
Dump the object to a dictionary, excluding fields marked with `exclude=True` in metadata.
|
||||
|
||||
"""
|
||||
data = {} | self.DATA
|
||||
for fld in fields(self):
|
||||
meta = fld.metadata
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue