ISaveContext#
- class ansys.tools.variableinterop.isave_context.ISaveContext#
Bases:
contextlib.AbstractContextManager,abc.ABCDefines an abstraction for a save medium.
This interface was defined to separate the concerns of being able to save large associated content in other transfer mediums. It allows out-of-bound data to be transferred. Examples include saving to a ZIP file or using an SCP side-channel on an SSH connection to send files or other large data objects.
Overview#
Import detail#
from ansys.tools.variableinterop.isave_context import ISaveContext
Method detail#
- ISaveContext.__exit__(__exc_type: Type[BaseException] | None, __exc_value: BaseException | None, __traceback: types.TracebackType | None) bool | None#
Magic method exit.
- abstract ISaveContext.save_file(source: os.PathLike | str, content_id: str | None = None) str#
Save a file to the save medium.
It is up to the
ISaveContextimplementation to decide how or when to send the actual data. SomeISaveContextimplementations may merely collect metadata as part of this call and send the data on flush.- Parameters:
- source
Union[PathLike,str] File on disk to send or include in the save.
- content_id
Optional[str],optional Unique ID for the file. The default value is
None, in which case an ID is automatically generated and returned. This ID can be used with an equivalentILoadContextinstance to load the contents on deserialization.
- source
- Returns:
strID, either the one provided or the one otherwise generated.