ISaveContext#
- class ISaveContext#
Bases: contextlib.AbstractContextManager
, abc.ABC
Defines an abstraction for a save medium.
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
ISaveContext
implementation to decide how or when to send the actual data. SomeISaveContext
implementations 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 equivalentILoadContext
instance to load the contents on deserialization.
- source
- Returns:
str
ID, either the one provided or the one otherwise generated.