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

Public Member Functions

 __init__ (self, default=None, use_single_float=False, autoreset=True, use_bin_type=True, strict_types=False, datetime=False, unicode_errors=None)
 
 pack (self, obj)
 
 pack_map_pairs (self, pairs)
 
 pack_array_header (self, n)
 
 pack_map_header (self, n)
 
 pack_ext_type (self, typecode, data)
 
 bytes (self)
 
 reset (self)
 
 getbuffer (self)
 

Protected Member Functions

 _pack (self, obj, nest_limit=DEFAULT_RECURSE_LIMIT, check=isinstance, check_type_strict=_check_type_strict)
 
 _pack_array_header (self, n)
 
 _pack_map_header (self, n)
 
 _pack_map_pairs (self, n, pairs, nest_limit=DEFAULT_RECURSE_LIMIT)
 
 _pack_raw_header (self, n)
 
 _pack_bin_header (self, n)
 

Protected Attributes

 _strict_types
 
 _use_float
 
 _autoreset
 
 _use_bin_type
 
 _buffer
 
 _datetime
 
 _unicode_errors
 
 _default
 

Detailed Description

MessagePack Packer

Usage::

    packer = Packer()
    astream.write(packer.pack(a))
    astream.write(packer.pack(b))

Packer's constructor has some keyword arguments:

:param callable default:
    Convert user type to builtin type that Packer supports.
    See also simplejson's document.

:param bool use_single_float:
    Use single precision float type for float. (default: False)

:param bool autoreset:
    Reset buffer after each pack and return its content as `bytes`. (default: True).
    If set this to false, use `bytes()` to get content and `.reset()` to clear buffer.

:param bool use_bin_type:
    Use bin type introduced in msgpack spec 2.0 for bytes.
    It also enables str8 type for unicode. (default: True)

:param bool strict_types:
    If set to true, types will be checked to be exact. Derived classes
    from serializable types will not be serialized and will be
    treated as unsupported type and forwarded to default.
    Additionally tuples will not be serialized as lists.
    This is useful when trying to implement accurate serialization
    for python types.

:param bool datetime:
    If set to true, datetime with tzinfo is packed into Timestamp type.
    Note that the tzinfo is stripped in the timestamp.
    You can get UTC datetime with `timestamp=3` option of the Unpacker.
    (Python 2 is not supported).

:param str unicode_errors:
    The error handler for encoding unicode. (default: 'strict')
    DO NOT USE THIS!!  This option is kept for very specific usage.

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

◆ bytes()

pip._vendor.msgpack.fallback.Packer.bytes (   self)
Return internal buffer contents as bytes object

◆ getbuffer()

pip._vendor.msgpack.fallback.Packer.getbuffer (   self)
Return view of internal buffer.

◆ reset()

pip._vendor.msgpack.fallback.Packer.reset (   self)
Reset internal buffer.

This method is useful only when autoreset=False.

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