diff --git a/packages/polywrap-client/polywrap_client/client.py b/packages/polywrap-client/polywrap_client/client.py index fd5f3ee6..ec575f45 100644 --- a/packages/polywrap-client/polywrap_client/client.py +++ b/packages/polywrap-client/polywrap_client/client.py @@ -40,7 +40,7 @@ def __init__(self, config: Optional[PolywrapClientConfig] = None): resolver=FsUriResolver(file_reader=SimpleFileReader()) ) - def getConfig(self): + def get_config(self): return self._config def get_uri_resolver( @@ -107,15 +107,14 @@ async def invoke(self, options: InvokerOptions) -> InvokeResult: if options.encode_result and not result.encoded: encoded = msgpack_encode(result.result) return InvokeResult(result=encoded, error=None) - elif ( + if ( not options.encode_result and result.encoded and isinstance(result.result, (bytes, bytearray)) ): decoded: Any = msgpack_decode(result.result) return InvokeResult(result=decoded, error=None) - else: - return result + return result - except Exception as e: - return InvokeResult(result=None, error=e) + except Exception as error: + return InvokeResult(result=None, error=error) diff --git a/packages/polywrap-core/polywrap_core/types/uri.py b/packages/polywrap-core/polywrap_core/types/uri.py index 33fad52a..51093a11 100644 --- a/packages/polywrap-core/polywrap_core/types/uri.py +++ b/packages/polywrap-core/polywrap_core/types/uri.py @@ -26,7 +26,8 @@ class Uri: Breaking down the various parts of the URI, as it applies to [the URI standard](https://tools.ietf.org/html/rfc3986#section-3): **wrap://** - URI Scheme: differentiates Polywrap URIs. - **ipfs/** - URI Authority: allows the Polywrap URI resolution algorithm to determine an authoritative URI resolver. + **ipfs/** - URI Authority: allows the Polywrap URI resolution algorithm to determine + an authoritative URI resolver. **sub.domain.eth** - URI Path: tells the Authority where the API resides. """ diff --git a/packages/polywrap-core/polywrap_core/uri_resolution/uri_resolution_result.py b/packages/polywrap-core/polywrap_core/uri_resolution/uri_resolution_result.py index 2479eb1f..0769efff 100644 --- a/packages/polywrap-core/polywrap_core/uri_resolution/uri_resolution_result.py +++ b/packages/polywrap-core/polywrap_core/uri_resolution/uri_resolution_result.py @@ -25,10 +25,9 @@ def ok( ) -> Result[UriPackageOrWrapper, Exception]: if wrapper: return Ok(UriWrapper(uri=uri, wrapper=wrapper)) - elif package: + if package: return Ok(UriPackage(uri=uri, package=package)) - else: - return Ok(uri) + return Ok(uri) @staticmethod def err(error: Exception) -> Result[UriPackageOrWrapper, Exception]: diff --git a/packages/polywrap-core/polywrap_core/utils/init_wrapper.py b/packages/polywrap-core/polywrap_core/utils/init_wrapper.py index 6ca200dc..311b2308 100644 --- a/packages/polywrap-core/polywrap_core/utils/init_wrapper.py +++ b/packages/polywrap-core/polywrap_core/utils/init_wrapper.py @@ -3,7 +3,7 @@ from ..types import Wrapper -async def init_wrapper(packageOrWrapper: Any) -> Wrapper: - if hasattr(packageOrWrapper, "create_wrapper"): - return await packageOrWrapper.createWrapper() - return packageOrWrapper +async def init_wrapper(package_or_wrapper: Any) -> Wrapper: + if hasattr(package_or_wrapper, "create_wrapper"): + return await package_or_wrapper.createWrapper() + return package_or_wrapper