findmy.util.session#
Logic related to serializable classes.
Classes#
Allows any Serializable or Closable object. |
|
Only allows a single type of Serializable object. |
Module Contents#
- class findmy.util.session.MixedSessionManager#
Bases:
_BaseSessionManager
[Union
[findmy.util.abc.Serializable
,findmy.util.abc.Closable
]]Allows any Serializable or Closable object.
- new(c_type: type[_SC], path: str | pathlib.Path | None = None, /, *args: Any, **kwargs: Any) _SC #
Add an object to the manager by instantiating it using its constructor.
- add_from_json(c_type: type[_S], path: str | pathlib.Path, /, **kwargs: Any) _S #
Add an object to the manager by deserializing it from its JSON representation.
- add(obj: findmy.util.abc.Serializable | findmy.util.abc.Closable, path: str | pathlib.Path | None = None, /) None #
Add an object to the session manager.
- class findmy.util.session.UniformSessionManager(obj_type: type[_SC])#
Bases:
Generic
[_SC
],_BaseSessionManager
[_SC
]Only allows a single type of Serializable object.
- new(path: str | pathlib.Path | None = None, /, *args: Any, **kwargs: Any) _SC #
Add an object to the manager by instantiating it using its constructor.
- add_from_json(path: str | pathlib.Path, /, **kwargs: Any) _SC #
Add an object to the manager by deserializing it from its JSON representation.
- add(obj: _SC, path: str | pathlib.Path | None = None, /) None #
Add an object to the session manager.