self.path = path
self.value = value
self.force_log = force_log
- for cls in [cls for cls in locals().values()
- if isinstance(cls, type)
- and issubclass(cls, _UpdatingNode)
- and cls is not type(value)
- and issubclass(cls, type(value))]:
- self.value = cls()
- self.value.copy_annotated_attrs(value)
@property
def key(self) -> str:
def _make_attr(self, cls: Callable, key: str):
return cls()
- def copy_annotated_attrs(self, original) -> None:
- 'From original copy those of its attributes annotated for self.'
- for key in [k for k in self._deep_annotations()
- if hasattr(original, k)]:
- setattr(self, key, getattr(original, key))
-
@classmethod
def _scope(cls, key: str) -> LogScope:
scopes: dict[str, LogScope] = {}