Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions packages/polywrap-client/polywrap_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
3 changes: 2 additions & 1 deletion packages/polywrap-core/polywrap_core/types/uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
8 changes: 4 additions & 4 deletions packages/polywrap-core/polywrap_core/utils/init_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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