Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
pip._vendor.msgpack.fallback.Unpacker Class Reference
Inheritance diagram for pip._vendor.msgpack.fallback.Unpacker:
Inheritance graph
[legend]
Collaboration diagram for pip._vendor.msgpack.fallback.Unpacker:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, file_like=None, read_size=0, use_list=True, raw=False, timestamp=0, strict_map_key=True, object_hook=None, object_pairs_hook=None, list_hook=None, unicode_errors=None, max_buffer_size=100 *1024 *1024, ext_hook=ExtType, max_str_len=-1, max_bin_len=-1, max_array_len=-1, max_map_len=-1, max_ext_len=-1)
 
 feed (self, next_bytes)
 
 read_bytes (self, n)
 
 __iter__ (self)
 
 __next__ (self)
 
 skip (self)
 
 unpack (self)
 
 read_array_header (self)
 
 read_map_header (self)
 
 tell (self)
 

Public Attributes

 file_like
 

Static Public Attributes

 next = __next__
 

Protected Member Functions

 _consume (self)
 
 _got_extradata (self)
 
 _get_extradata (self)
 
 _read (self, n, raise_outofdata=True)
 
 _reserve (self, n, raise_outofdata=True)
 
 _read_header (self)
 
 _unpack (self, execute=EX_CONSTRUCT)
 

Protected Attributes

 _feeding
 
 _buffer
 
 _buff_i
 
 _buf_checkpoint
 
 _max_buffer_size
 
 _read_size
 
 _raw
 
 _strict_map_key
 
 _unicode_errors
 
 _use_list
 
 _timestamp
 
 _list_hook
 
 _object_hook
 
 _object_pairs_hook
 
 _ext_hook
 
 _max_str_len
 
 _max_bin_len
 
 _max_array_len
 
 _max_map_len
 
 _max_ext_len
 
 _stream_offset
 

Detailed Description

Streaming unpacker.

Arguments:

:param file_like:
    File-like object having `.read(n)` method.
    If specified, unpacker reads serialized data from it and :meth:`feed()` is not usable.

:param int read_size:
    Used as `file_like.read(read_size)`. (default: `min(16*1024, max_buffer_size)`)

:param bool use_list:
    If true, unpack msgpack array to Python list.
    Otherwise, unpack to Python tuple. (default: True)

:param bool raw:
    If true, unpack msgpack raw to Python bytes.
    Otherwise, unpack to Python str by decoding with UTF-8 encoding (default).

:param int timestamp:
    Control how timestamp type is unpacked:

        0 - Timestamp
        1 - float  (Seconds from the EPOCH)
        2 - int  (Nanoseconds from the EPOCH)
        3 - datetime.datetime  (UTC).  Python 2 is not supported.

:param bool strict_map_key:
    If true (default), only str or bytes are accepted for map (dict) keys.

:param callable object_hook:
    When specified, it should be callable.
    Unpacker calls it with a dict argument after unpacking msgpack map.
    (See also simplejson)

:param callable object_pairs_hook:
    When specified, it should be callable.
    Unpacker calls it with a list of key-value pairs after unpacking msgpack map.
    (See also simplejson)

:param str unicode_errors:
    The error handler for decoding unicode. (default: 'strict')
    This option should be used only when you have msgpack data which
    contains invalid UTF-8 string.

:param int max_buffer_size:
    Limits size of data waiting unpacked.  0 means 2**32-1.
    The default value is 100*1024*1024 (100MiB).
    Raises `BufferFull` exception when it is insufficient.
    You should set this parameter when unpacking data from untrusted source.

:param int max_str_len:
    Deprecated, use *max_buffer_size* instead.
    Limits max length of str. (default: max_buffer_size)

:param int max_bin_len:
    Deprecated, use *max_buffer_size* instead.
    Limits max length of bin. (default: max_buffer_size)

:param int max_array_len:
    Limits max length of array.
    (default: max_buffer_size)

:param int max_map_len:
    Limits max length of map.
    (default: max_buffer_size//2)

:param int max_ext_len:
    Deprecated, use *max_buffer_size* instead.
    Limits max size of ext type.  (default: max_buffer_size)

Example of streaming deserialize from file-like object::

    unpacker = Unpacker(file_like)
    for o in unpacker:
        process(o)

Example of streaming deserialize from socket::

    unpacker = Unpacker()
    while True:
        buf = sock.recv(1024**2)
        if not buf:
            break
        unpacker.feed(buf)
        for o in unpacker:
            process(o)

Raises ``ExtraData`` when *packed* contains extra bytes.
Raises ``OutOfData`` 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.

Member Function Documentation

◆ _consume()

pip._vendor.msgpack.fallback.Unpacker._consume (   self)
protected
Gets rid of the used parts of the buffer.

The documentation for this class was generated from the following file: