ILoadContext#

class ansys.tools.variableinterop.isave_context.ILoadContext#

Bases: contextlib.AbstractContextManager, abc.ABC

Defines an abstraction for a load 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#

load_file

Load a file from the load medium.

flush

Flush any changes in the context to the underlying stream or file.

close

Close the context.

__exit__

Raise any exception triggered within the runtime context.

Import detail#

from ansys.tools.variableinterop.isave_context import ILoadContext

Method detail#

ILoadContext.__exit__(__exc_type: Type[BaseException] | None, __exc_value: BaseException | None, __traceback: types.TracebackType | None) bool | None#

Raise any exception triggered within the runtime context.

abstract ILoadContext.load_file(content_id: str | None) os.PathLike | None#

Load a file from the load medium.

The ILoadContext implementation decides how or when to send the actual data. Some ILoadContexts implementations may merely collect metadata as part of this call and send the data on flush.

Parameters:
content_idOptional[str]

ID generated by an equivalent ISaveContext instance to save a file into this context.

Returns:
Optional[PathLike]

Path to the loaded file.

abstract ILoadContext.flush() None#

Flush any changes in the context to the underlying stream or file.

abstract ILoadContext.close() None#

Close the context.