Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load(fp, **kwargs):
"""
Deserialize an object from an open file.
:param fp:
the input file (any file-like object)
:param kwargs:
keyword arguments passed to :class:`CBORDecoder`
:return:
the deserialized object
"""
return CBORDecoder(fp, **kwargs).decode()
def loads(s, **kwargs):
"""
Deserialize an object from a bytestring.
:param bytes s:
the bytestring to deserialize
:param kwargs:
keyword arguments passed to :class:`CBORDecoder`
:return:
the deserialized object
"""
with BytesIO(s) as fp:
return CBORDecoder(fp, **kwargs).decode()