-
Notifications
You must be signed in to change notification settings - Fork 6
refactor: polywrap-plugin package #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
48be658
refactor: polywrap-msgpack package
Niraj-Kamdar a83969a
refactor: polywrap-manifest package
Niraj-Kamdar f8d7853
refactor: polywrap-core package
Niraj-Kamdar 011ebf9
refactor: polywrap-core docs
Niraj-Kamdar 773f10b
refactor: polywrap-wasm package
Niraj-Kamdar c7a6317
refactor: polywrap-plugin package
Niraj-Kamdar 5df78c1
feat: add unit-tests for remaining functions
Niraj-Kamdar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Encode - Decode need to be tested | ||
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,83 +1,84 @@ | ||
| """This module contains the Client interface.""" | ||
| from __future__ import annotations | ||
|
|
||
| from abc import abstractmethod | ||
| from typing import Dict, List, Optional, Union | ||
| from typing import Any, Dict, List, Optional, Protocol, Union | ||
|
|
||
| from polywrap_manifest import AnyWrapManifest | ||
| from polywrap_manifest import AnyWrapManifest, DeserializeManifestOptions | ||
|
|
||
| from .env import Env | ||
| from .invoker_client import InvokerClient | ||
| from .options.file_options import GetFileOptions | ||
| from .options.manifest_options import GetManifestOptions | ||
| from .uri import Uri | ||
| from .uri_package_wrapper import UriPackageOrWrapper | ||
| from .uri_resolver import UriResolver | ||
|
|
||
|
|
||
| class Client(InvokerClient[UriPackageOrWrapper]): | ||
| class Client(InvokerClient, Protocol): | ||
| """Client interface defines core set of functionalities\ | ||
| for interacting with a wrapper.""" | ||
|
|
||
| @abstractmethod | ||
| def get_interfaces(self) -> Dict[Uri, List[Uri]]: | ||
| """Get dictionary of interfaces and their implementations. | ||
|
|
||
| Returns: | ||
| Dict[Uri, List[Uri]]: Dictionary of interfaces and their implementations where\ | ||
| key is interface URI and value is list of implementation uris. | ||
| """ | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| def get_envs(self) -> Dict[Uri, Env]: | ||
| def get_envs(self) -> Dict[Uri, Any]: | ||
| """Get dictionary of environments. | ||
|
|
||
| Returns: | ||
| Dict[Uri, Env]: Dictionary of environments where key is URI and value is env. | ||
| Dict[Uri, Any]: Dictionary of environments where key is URI and value is env. | ||
| """ | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| def get_env_by_uri(self, uri: Uri) -> Union[Env, None]: | ||
| def get_env_by_uri(self, uri: Uri) -> Union[Any, None]: | ||
| """Get environment by URI. | ||
|
|
||
| Args: | ||
| uri (Uri): URI of the Wrapper. | ||
|
|
||
| Returns: | ||
| Union[Env, None]: env if found, otherwise None. | ||
| Union[Any, None]: env if found, otherwise None. | ||
| """ | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| def get_uri_resolver(self) -> UriResolver: | ||
| """Get URI resolver. | ||
|
|
||
| Returns: | ||
| IUriResolver: URI resolver. | ||
| UriResolver: URI resolver. | ||
| """ | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| async def get_file(self, uri: Uri, options: GetFileOptions) -> Union[bytes, str]: | ||
| def get_file( | ||
| self, uri: Uri, path: str, encoding: Optional[str] = "utf-8" | ||
| ) -> Union[bytes, str]: | ||
| """Get file from URI. | ||
|
|
||
| Args: | ||
| uri (Uri): URI of the wrapper. | ||
| options (GetFileOptions): Options for getting file from the wrapper. | ||
| path (str): Path to the file. | ||
| encoding (Optional[str]): Encoding of the file. | ||
|
|
||
| Returns: | ||
| Union[bytes, str]]: file contents. | ||
| """ | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| async def get_manifest( | ||
| self, uri: Uri, options: Optional[GetManifestOptions] = None | ||
| def get_manifest( | ||
| self, uri: Uri, options: Optional[DeserializeManifestOptions] = None | ||
| ) -> AnyWrapManifest: | ||
| """Get manifest from URI. | ||
|
|
||
| Args: | ||
| uri (Uri): URI of the wrapper. | ||
| options (Optional[GetManifestOptions]): \ | ||
| options (Optional[DeserializeManifestOptions]): \ | ||
| Options for getting manifest from the wrapper. | ||
|
|
||
| Returns: | ||
| AnyWrapManifest: Manifest of the wrapper. | ||
| """ | ||
| ... | ||
|
|
||
|
|
||
| __all__ = ["Client"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.