polywrap_plugin.wrapper module
This module contains the PluginWrapper class.
- class polywrap_plugin.wrapper.PluginWrapper(module: PluginModule[TConfig], manifest: WrapManifest)[source]
Bases:
Wrapper,Generic[TConfig]PluginWrapper implements the Wrapper interface for plugin wrappers.
- Parameters:
module (PluginModule[TConfig]) – The plugin module.
manifest (AnyWrapManifest) – The manifest of the plugin.
- get_file(path: str, encoding: str | None = 'utf-8') str | bytes[source]
Get a file from the wrapper.
- Parameters:
path (str) – Path to the file.
encoding (Optional[str]) – Encoding of the file.
- Returns:
The file contents
- Return type:
Union[str, bytes]
- Raises:
NotImplementedError – This method is not implemented for plugins.
- get_manifest() WrapManifest[source]
Get the manifest of the plugin.
- Returns:
the manifest of the plugin.
- Return type:
Result[AnyWrapManifest]
- invoke(uri: Uri, method: str, args: Any | None = None, env: Any | None = None, resolution_context: UriResolutionContext | None = None, client: InvokerClient | None = None) InvocableResult[source]
Invoke the Wrapper based on the provided InvokeOptions.
- Parameters:
uri (Uri) – Uri of the wrapper
method (str) – Method to be executed
args (Optional[Any]) – Arguments for the method, structured as a dictionary
env (Optional[Any]) – Override the client’s config for all invokes within this invoke.
resolution_context (Optional[UriResolutionContext]) – A URI resolution context
client (Optional[Invoker]) – The invoker instance requesting this invocation. This invoker will be used for any subinvocation that may occur.
- Returns:
Result of the invocation.
- Return type:
- Raises:
WrapInvocationError – If the plugin method is not defined or is not callable.
WrapAbortError – If the plugin method raises an exception.
MsgpackDecodeError – If the plugin method returns invalid msgpack.
- manifest: WrapManifest
- module: PluginModule[TConfig]