MCPcopy Create free account
hub / github.com/Bitmessage/PyBitmessage / _unpack3

Function _unpack3

src/fallback/umsgpack/umsgpack.py:821–860  ·  view source on GitHub ↗

Deserialize MessagePack bytes into a Python object. Args: fp: a .read()-supporting file-like object Kwargs: ext_handlers (dict): dictionary of Ext handlers, mapping integer Ext type to a callable that unpacks an instance of

(fp, **options)

Source from the content-addressed store, hash-verified

819
820
821def _unpack3(fp, **options):
822 """
823 Deserialize MessagePack bytes into a Python object.
824
825 Args:
826 fp: a .read()-supporting file-like object
827
828 Kwargs:
829 ext_handlers (dict): dictionary of Ext handlers, mapping integer Ext
830 type to a callable that unpacks an instance of
831 Ext into an object
832 use_ordered_dict (bool): unpack maps into OrderedDict, instead of
833 unordered dict (default False)
834 allow_invalid_utf8 (bool): unpack invalid strings into instances of
835 InvalidString, for access to the bytes
836 (default False)
837
838 Returns:
839 A Python object.
840
841 Raises:
842 InsufficientDataException(UnpackException):
843 Insufficient data to unpack the serialized object.
844 InvalidStringException(UnpackException):
845 Invalid UTF-8 string encountered during unpacking.
846 ReservedCodeException(UnpackException):
847 Reserved code encountered during unpacking.
848 UnhashableKeyException(UnpackException):
849 Unhashable key encountered during map unpacking.
850 The serialized map cannot be deserialized into a Python dictionary.
851 DuplicateKeyException(UnpackException):
852 Duplicate key encountered during map unpacking.
853
854 Example:
855 >>> f = open('test.bin', 'rb')
856 >>> umsgpack.unpackb(f)
857 {'compact': True, 'schema': 0}
858 >>>
859 """
860 return _unpack(fp, options)
861
862
863# For Python 2, expects a str object

Callers

nothing calls this directly

Calls 1

_unpackFunction · 0.85

Tested by

no test coverage detected