Skip to content

Commit

Permalink
Broaden method type definition for preconf orjson converter.
Browse files Browse the repository at this point in the history
`bytes` is not the only input type `orjson.loads` allows.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
  • Loading branch information
PIG208 committed Jul 28, 2023
1 parent 4052f68 commit 211493d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cattrs/preconf/orjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class OrjsonConverter(Converter):
def dumps(self, obj: Any, unstructure_as: Any = None, **kwargs: Any) -> bytes:
return dumps(self.unstructure(obj, unstructure_as=unstructure_as), **kwargs)

def loads(self, data: bytes, cl: Type[T]) -> T:
def loads(self, data: bytes | bytearray | memoryview | str, cl: Type[T]) -> T:
return self.structure(loads(data), cl)


Expand Down

0 comments on commit 211493d

Please sign in to comment.