Skip to content

Commit

Permalink
Fix: Solve mypy issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nesitor committed Sep 25, 2024
1 parent ea48118 commit 55162cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/aleph/toolkit/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ def load(fp: IO) -> Any:
def loads(s: Union[bytes, str]) -> Any:
try:
return orjson.loads(s)
except TypeError as e:
except:
return json.loads(s)


def dump(fp: IO, obj: Any) -> None:
raise NotImplementedError("orjson does not provide dump")


def dumps(obj: Any) -> SerializedJson:
def dumps(obj: Any) -> bytes:
try:
return orjson.dumps(obj)
except TypeError as e:
return bytes(json.dumps(obj))
except:
return json.dumps(obj).encode()

0 comments on commit 55162cb

Please sign in to comment.