EnvironmentState#

class brainstate.environ.EnvironmentState(settings=<factory>, contexts=<factory>, functions=<factory>, locks=<factory>)[source]#

Thread-local storage for environment configuration.

This class maintains separate configuration states for different threads, ensuring thread-safe environment management in concurrent applications.

settings#

Global default environment settings.

Type:

Dict[Hashable, Any]

contexts#

Stack of context-specific settings for nested contexts.

Type:

defaultdict[Hashable, List[Any]]

functions#

Registered callback functions for environment changes.

Type:

Dict[Hashable, Callable]

locks#

Thread locks for synchronized access to critical sections.

Type:

Dict[str, threading.Lock]