xnano.state
xnano.state
¶
xnano.state
Lightweight dynamic state container for simple apps (prefer dataclasses or models when you need a fixed schema).
Classes:
-
State–Store application state with optional annotation validation.
State
¶
State(**values: Any)
Store application state with optional annotation validation.
Public attributes are supplied at initialization or assigned later. Subclass annotations validate assignments; use a dataclass when the state has a fixed schema and does not need dynamic attributes.
Attributes:
-
_state_annotations(dict[str, Any]) –Resolved annotations used for validation.
-
**values(dict[str, Any]) –User-defined public state attributes.
Example
state = State(name="John", age=30) state.name 'John' state.address = "123 Main St" state.address '123 Main St'