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)
| 777 | |
| 778 | |
| 779 | def _unpack2(fp, **options): |
| 780 | """ |
| 781 | Deserialize MessagePack bytes into a Python object. |
| 782 | |
| 783 | Args: |
| 784 | fp: a .read()-supporting file-like object |
| 785 | |
| 786 | Kwargs: |
| 787 | ext_handlers (dict): dictionary of Ext handlers, mapping integer Ext |
| 788 | type to a callable that unpacks an instance of |
| 789 | Ext into an object |
| 790 | use_ordered_dict (bool): unpack maps into OrderedDict, instead of |
| 791 | unordered dict (default False) |
| 792 | allow_invalid_utf8 (bool): unpack invalid strings into instances of |
| 793 | InvalidString, for access to the bytes |
| 794 | (default False) |
| 795 | |
| 796 | Returns: |
| 797 | A Python object. |
| 798 | |
| 799 | Raises: |
| 800 | InsufficientDataException(UnpackException): |
| 801 | Insufficient data to unpack the serialized object. |
| 802 | InvalidStringException(UnpackException): |
| 803 | Invalid UTF-8 string encountered during unpacking. |
| 804 | ReservedCodeException(UnpackException): |
| 805 | Reserved code encountered during unpacking. |
| 806 | UnhashableKeyException(UnpackException): |
| 807 | Unhashable key encountered during map unpacking. |
| 808 | The serialized map cannot be deserialized into a Python dictionary. |
| 809 | DuplicateKeyException(UnpackException): |
| 810 | Duplicate key encountered during map unpacking. |
| 811 | |
| 812 | Example: |
| 813 | >>> f = open('test.bin', 'rb') |
| 814 | >>> umsgpack.unpackb(f) |
| 815 | {u'compact': True, u'schema': 0} |
| 816 | >>> |
| 817 | """ |
| 818 | return _unpack(fp, options) |
| 819 | |
| 820 | |
| 821 | def _unpack3(fp, **options): |