graflo.architecture.base¶
Base model for Graflo configuration classes with YAML support.
Classes¶
ConfigBaseModel
¶
Bases: BaseModel
Base model for all Graflo configuration classes.
Provides YAML serialization/deserialization and standard configuration for all Pydantic models in the system.
Source code in graflo/architecture/base.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
Attributes¶
model_config = ConfigDict(populate_by_name=True, extra='forbid', use_enum_values=True, validate_assignment=True)
class-attribute
instance-attribute
¶
Methods:¶
from_dict(data)
classmethod
¶
from_yaml(path)
classmethod
¶
from_yaml_list(path)
classmethod
¶
Load a list of instances from a YAML file.
Source code in graflo/architecture/base.py
to_dict(**kwargs)
¶
Convert instance to a dictionary.
Supports skip_defaults=True (mapped to exclude_defaults) for backward compatibility with dataclass-wizard style APIs.
Source code in graflo/architecture/base.py
to_minimal_canonical_dict(**kwargs)
¶
Convert instance to minimal canonical dictionary form.
Minimal canonical form is intentionally compact:
- excludes values equal to defaults
- excludes None values
- uses aliases for stable external contract
Source code in graflo/architecture/base.py
to_yaml(path, **kwargs)
¶
Save instance to a YAML file; a value that can't be written leaves the file as it was.
to_yaml_str(**kwargs)
¶
Convert instance to a YAML string.
update(other)
¶
Update this instance with values from another instance of the same type.
Performs in-place merge: lists are concatenated, dicts/sets are merged, nested ConfigBaseModel instances are updated recursively. None values in other do not overwrite existing values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Self
|
Another instance of the same type to copy from |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If other is not an instance of the same type |