mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-29 00:24:13 +00:00
Use new msgpack spec by default. (#386)
This commit is contained in:
parent
de320488ae
commit
7e9905bdfa
11 changed files with 75 additions and 126 deletions
|
|
@ -158,7 +158,7 @@ else:
|
|||
class Unpacker(object):
|
||||
"""Streaming unpacker.
|
||||
|
||||
arguments:
|
||||
Arguments:
|
||||
|
||||
:param file_like:
|
||||
File-like object having `.read(n)` method.
|
||||
|
|
@ -172,12 +172,8 @@ class Unpacker(object):
|
|||
Otherwise, unpack to Python tuple. (default: True)
|
||||
|
||||
:param bool raw:
|
||||
If true, unpack msgpack raw to Python bytes (default).
|
||||
Otherwise, unpack to Python str (or unicode on Python 2) by decoding
|
||||
with UTF-8 encoding (recommended).
|
||||
Currently, the default is true, but it will be changed to false in
|
||||
near future. So you must specify it explicitly for keeping backward
|
||||
compatibility.
|
||||
If true, unpack msgpack raw to Python bytes.
|
||||
Otherwise, unpack to Python str by decoding with UTF-8 encoding (default).
|
||||
|
||||
:param bool strict_map_key:
|
||||
If true, only str or bytes are accepted for map (dict) keys.
|
||||
|
|
@ -226,13 +222,13 @@ class Unpacker(object):
|
|||
|
||||
Example of streaming deserialize from file-like object::
|
||||
|
||||
unpacker = Unpacker(file_like, raw=False, max_buffer_size=10*1024*1024)
|
||||
unpacker = Unpacker(file_like, max_buffer_size=10*1024*1024)
|
||||
for o in unpacker:
|
||||
process(o)
|
||||
|
||||
Example of streaming deserialize from socket::
|
||||
|
||||
unpacker = Unpacker(raw=False, max_buffer_size=10*1024*1024)
|
||||
unpacker = Unpacker(max_buffer_size=10*1024*1024)
|
||||
while True:
|
||||
buf = sock.recv(1024**2)
|
||||
if not buf:
|
||||
|
|
@ -253,7 +249,7 @@ class Unpacker(object):
|
|||
file_like=None,
|
||||
read_size=0,
|
||||
use_list=True,
|
||||
raw=True,
|
||||
raw=False,
|
||||
strict_map_key=False,
|
||||
object_hook=None,
|
||||
object_pairs_hook=None,
|
||||
|
|
@ -748,7 +744,7 @@ class Packer(object):
|
|||
|
||||
:param bool use_bin_type:
|
||||
Use bin type introduced in msgpack spec 2.0 for bytes.
|
||||
It also enables str8 type for unicode.
|
||||
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
|
||||
|
|
@ -769,7 +765,7 @@ class Packer(object):
|
|||
unicode_errors=None,
|
||||
use_single_float=False,
|
||||
autoreset=True,
|
||||
use_bin_type=False,
|
||||
use_bin_type=True,
|
||||
strict_types=False,
|
||||
):
|
||||
self._strict_types = strict_types
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue