Skip to content

Commit

Permalink
fixed serialization of output
Browse files Browse the repository at this point in the history
  • Loading branch information
kessler-frost committed Dec 14, 2023
1 parent 87bd260 commit ff0d7f5
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions covalent/_serialize/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ def deserialize_asset(data: bytes, data_type: AssetType) -> Any:
elif data_type == AssetType.JSONABLE:
return json.loads(data.decode("utf-8"))
elif data_type == AssetType.TEXT:
try:
return data.decode("utf-8")
except UnicodeDecodeError:
return cloudpickle.loads(data)
return data.decode("utf-8")
elif data_type == AssetType.BYTES:
return data
else:
Expand Down Expand Up @@ -173,9 +170,6 @@ def load_asset(asset_meta: AssetSchema, data_type: AssetType) -> Any:

path = uri[len(scheme_prefix) :] if uri.startswith(scheme_prefix) else uri

try:
with open(path, "rb") as f:
data = f.read()
except FileNotFoundError:
data = "".encode("utf-8")
with open(path, "rb") as f:
data = f.read()
return deserialize_asset(data, data_type)

0 comments on commit ff0d7f5

Please sign in to comment.