Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.msgpack.fallback Namespace Reference

Data Structures

class  Packer
 
class  StringIO
 
class  Unpacker
 

Functions

 dict_iteritems (d)
 
 _is_recursionerror (e)
 
 _check_type_strict (obj, t, type=type, tuple=tuple)
 
 _get_data_from_buffer (obj)
 
 unpackb (packed, **kwargs)
 
 _unpack_from (f, b, o=0)
 

Variables

int PY2 = 2
 
tuple int_types = (int, long)
 
 unicode = str
 
 xrange = range
 
 RecursionError = RuntimeError
 
bool USING_STRINGBUILDER = True
 
 newlist_hint = lambda size: []
 
int EX_SKIP = 0
 
int EX_CONSTRUCT = 1
 
int EX_READ_ARRAY_HEADER = 2
 
int EX_READ_MAP_HEADER = 3
 
int TYPE_IMMEDIATE = 0
 
int TYPE_ARRAY = 1
 
int TYPE_MAP = 2
 
int TYPE_RAW = 3
 
int TYPE_BIN = 4
 
int TYPE_EXT = 5
 
int DEFAULT_RECURSE_LIMIT = 511
 
 _unpack_from = struct.unpack_from
 
str _NO_FORMAT_USED = ""
 
dict _MSGPACK_HEADERS
 

Detailed Description

Fallback pure Python implementation of msgpack

Function Documentation

◆ _check_type_strict()

_check_type_strict (   obj,
  t,
  type = type,
  tuple = tuple 
)
protected

Definition at line 96 of file fallback.py.

96def _check_type_strict(obj, t, type=type, tuple=tuple):
97 if type(t) is tuple:
98 return type(obj) in t
99 else:
100 return type(obj) is t
101
102

◆ _get_data_from_buffer()

_get_data_from_buffer (   obj)
protected

Definition at line 103 of file fallback.py.

103def _get_data_from_buffer(obj):
104 view = memoryview(obj)
105 if view.itemsize != 1:
106 raise ValueError("cannot unpack from multi-byte object")
107 return view
108
109
for i

References i.

Referenced by Unpacker.feed().

Here is the caller graph for this function:

◆ _is_recursionerror()

_is_recursionerror (   e)
protected

Definition at line 27 of file fallback.py.

27 def _is_recursionerror(e):
28 return (
29 len(e.args) == 1
30 and isinstance(e.args[0], str)
31 and e.args[0].startswith("maximum recursion depth exceeded")
32 )
33

References i.

Referenced by pip._vendor.msgpack.fallback.unpackb().

Here is the caller graph for this function:

◆ _unpack_from()

_unpack_from (   f,
  b,
  o = 0 
)
protected
Explicit type cast for legacy struct.unpack_from

Definition at line 139 of file fallback.py.

139 def _unpack_from(f, b, o=0):
140 """Explicit type cast for legacy struct.unpack_from"""
141 return struct.unpack_from(f, bytes(b), o)
142

References i.

◆ dict_iteritems()

dict_iteritems (   d)

Definition at line 11 of file fallback.py.

11 def dict_iteritems(d):
12 return d.iteritems()
13

References i.

Referenced by Packer._pack().

Here is the caller graph for this function:

◆ unpackb()

unpackb (   packed,
**  kwargs 
)
Unpack an object from `packed`.

Raises ``ExtraData`` when *packed* contains extra bytes.
Raises ``ValueError`` when *packed* is incomplete.
Raises ``FormatError`` when *packed* is not valid msgpack.
Raises ``StackError`` when *packed* contains too nested.
Other exceptions can be raised during unpacking.

See :class:`Unpacker` for options.

Definition at line 110 of file fallback.py.

110def unpackb(packed, **kwargs):
111 """
112 Unpack an object from `packed`.
113
114 Raises ``ExtraData`` when *packed* contains extra bytes.
115 Raises ``ValueError`` when *packed* is incomplete.
116 Raises ``FormatError`` when *packed* is not valid msgpack.
117 Raises ``StackError`` when *packed* contains too nested.
118 Other exceptions can be raised during unpacking.
119
120 See :class:`Unpacker` for options.
121 """
122 unpacker = Unpacker(None, max_buffer_size=len(packed), **kwargs)
123 unpacker.feed(packed)
124 try:
125 ret = unpacker._unpack()
126 except OutOfData:
127 raise ValueError("Unpack failed: incomplete input")
128 except RecursionError as e:
129 if _is_recursionerror(e):
130 raise StackError
131 raise
133 raise ExtraData(ret, unpacker._get_extradata())
134 return ret
135
136

References pip._vendor.msgpack.fallback._is_recursionerror(), and i.

Here is the call graph for this function:

Variable Documentation

◆ _MSGPACK_HEADERS

dict _MSGPACK_HEADERS
protected
Initial value:
1= {
2 0xC4: (1, _NO_FORMAT_USED, TYPE_BIN),
3 0xC5: (2, ">H", TYPE_BIN),
4 0xC6: (4, ">I", TYPE_BIN),
5 0xC7: (2, "Bb", TYPE_EXT),
6 0xC8: (3, ">Hb", TYPE_EXT),
7 0xC9: (5, ">Ib", TYPE_EXT),
8 0xCA: (4, ">f"),
9 0xCB: (8, ">d"),
10 0xCC: (1, _NO_FORMAT_USED),
11 0xCD: (2, ">H"),
12 0xCE: (4, ">I"),
13 0xCF: (8, ">Q"),
14 0xD0: (1, "b"),
15 0xD1: (2, ">h"),
16 0xD2: (4, ">i"),
17 0xD3: (8, ">q"),
18 0xD4: (1, "b1s", TYPE_EXT),
19 0xD5: (2, "b2s", TYPE_EXT),
20 0xD6: (4, "b4s", TYPE_EXT),
21 0xD7: (8, "b8s", TYPE_EXT),
22 0xD8: (16, "b16s", TYPE_EXT),
23 0xD9: (1, _NO_FORMAT_USED, TYPE_RAW),
24 0xDA: (2, ">H", TYPE_RAW),
25 0xDB: (4, ">I", TYPE_RAW),
26 0xDC: (2, ">H", TYPE_ARRAY),
27 0xDD: (4, ">I", TYPE_ARRAY),
28 0xDE: (2, ">H", TYPE_MAP),
29 0xDF: (4, ">I", TYPE_MAP),
30}

Definition at line 147 of file fallback.py.

◆ _NO_FORMAT_USED

str _NO_FORMAT_USED = ""
protected

Definition at line 146 of file fallback.py.

◆ _unpack_from

_unpack_from = struct.unpack_from
protected

Definition at line 144 of file fallback.py.

Referenced by Unpacker._read_header().

◆ DEFAULT_RECURSE_LIMIT

int DEFAULT_RECURSE_LIMIT = 511

Definition at line 93 of file fallback.py.

◆ EX_CONSTRUCT

int EX_CONSTRUCT = 1

Definition at line 82 of file fallback.py.

◆ EX_READ_ARRAY_HEADER

int EX_READ_ARRAY_HEADER = 2

Definition at line 83 of file fallback.py.

◆ EX_READ_MAP_HEADER

int EX_READ_MAP_HEADER = 3

Definition at line 84 of file fallback.py.

◆ EX_SKIP

int EX_SKIP = 0

Definition at line 81 of file fallback.py.

◆ int_types

int_types = (int, long)

Definition at line 9 of file fallback.py.

◆ newlist_hint

newlist_hint = lambda size: []

Definition at line 73 of file fallback.py.

◆ PY2

int PY2 = 2

Definition at line 7 of file fallback.py.

◆ RecursionError

RecursionError = RuntimeError

Definition at line 25 of file fallback.py.

◆ TYPE_ARRAY

int TYPE_ARRAY = 1

Definition at line 87 of file fallback.py.

◆ TYPE_BIN

int TYPE_BIN = 4

Definition at line 90 of file fallback.py.

◆ TYPE_EXT

int TYPE_EXT = 5

Definition at line 91 of file fallback.py.

◆ TYPE_IMMEDIATE

int TYPE_IMMEDIATE = 0

Definition at line 86 of file fallback.py.

◆ TYPE_MAP

int TYPE_MAP = 2

Definition at line 88 of file fallback.py.

◆ TYPE_RAW

int TYPE_RAW = 3

Definition at line 89 of file fallback.py.

◆ unicode

unicode = str

Definition at line 16 of file fallback.py.

◆ USING_STRINGBUILDER

USING_STRINGBUILDER = True

Definition at line 49 of file fallback.py.

◆ xrange

xrange = range

Definition at line 17 of file fallback.py.

Referenced by Packer._pack(), and Unpacker._unpack().