Add type_info.JsonDumpable.

This commit is contained in:
Dave Shawley 2021-10-27 14:30:39 -04:00
parent e01bc1889d
commit 680f4d8a45
No known key found for this signature in database
GPG key ID: F41A8A99298F8EED
2 changed files with 5 additions and 1 deletions

View file

@ -88,7 +88,7 @@ class JSONTranscoder(handlers.TextContentHandler):
json.loads(str_repr, **self.load_options))
def dump_object(self,
obj: type_info.Serializable) -> typing.Union[str, float]:
obj: type_info.Serializable) -> type_info.JsonDumpable:
"""
Called to encode unrecognized object.

View file

@ -77,6 +77,10 @@ MsgPackable = typing.Union[None, bool, bytes, typing.Dict[typing.Any,
int, typing.List[typing.Any], str]
"""Set of types that the underlying msgpack library can serialize."""
JsonDumpable = typing.Union[None, bool, typing.Mapping[typing.Any, typing.Any],
float, int, typing.Sequence[typing.Any], str, None]
"""Set of types that the underlying msgpack library can serialize."""
class Transcoder(Protocol):
"""Object that transforms objects to bytes and back again.