hyped.core.features.session module¶
Module for managing lightweight session-based contextual data.
- class hyped.core.features.session.ValidationSession[source]¶
Bases:
objectA lightweight session context manager for managing key-value contextual data.
This class provides a simple way to store, retrieve, and clear context during a specific scope of execution. Contexts are stored as key-value pairs in an internal dictionary, which is cleared automatically when the top-level session ends.
- clear_context(key: None | Hashable = None) None[source]¶
Clear one or all contexts.
- Parameters:
key (None | Hashable) – The key of the context entry to clear. If None, all contexts are cleared. Defaults to None.
- get_context(key: Hashable) Any[source]¶
Retrieve the context value associated with a specific key.
- Parameters:
key (Hashable) – The key for the context entry to retrieve.
- Returns:
The value associated with the key, or None if the key is not found.
- Return type:
Any