summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2012-12-10 00:39:04 +0900
committerINADA Naoki <inada-n@klab.com>2012-12-10 00:39:04 +0900
commit4480227e066e66fd771dc1702adf4929dede453d (patch)
tree6057166b16d5ae998a9f3e4a05dae97ad006e309
parentc7161e9403ce15c4bbea99cb482ea37a74311b45 (diff)
downloadmsgpack-python-4480227e066e66fd771dc1702adf4929dede453d.tar.gz
Improve docstrings.
-rw-r--r--msgpack/_msgpack.pyx27
1 files changed, 23 insertions, 4 deletions
diff --git a/msgpack/_msgpack.pyx b/msgpack/_msgpack.pyx
index da70f0d..2c81cb4 100644
--- a/msgpack/_msgpack.pyx
+++ b/msgpack/_msgpack.pyx
@@ -426,6 +426,7 @@ cdef class Unpacker(object):
init_ctx(&self.ctx, object_hook, object_pairs_hook, list_hook, use_list, cenc, cerr)
def feed(self, object next_bytes):
+ """Append `next_bytes` to internal buffer."""
cdef char* buf
cdef Py_ssize_t buf_len
if self.file_like is not None:
@@ -523,7 +524,11 @@ cdef class Unpacker(object):
"""
unpack one object
- If write_bytes is not None, it will be called with parts of the raw message as it is unpacked.
+ If write_bytes is not None, it will be called with parts of the raw
+ message as it is unpacked.
+
+ When there are not enough bytes for unpacking, `unpack()` raises
+ `OutOfData` Exception.
"""
return self._unpack(template_construct, write_bytes)
@@ -531,16 +536,30 @@ cdef class Unpacker(object):
"""
read and ignore one object, returning None
- If write_bytes is not None, it will be called with parts of the raw message as it is unpacked.
+ If write_bytes is not None, it will be called with parts of the raw
+ message as it is unpacked.
+
+ When there are not enough bytes for unpacking, `unpack()` raises
+ `OutOfData` Exception.
"""
return self._unpack(template_skip, write_bytes)
def read_array_header(self, object write_bytes=None):
- """assuming the next object is an array, return its size n, such that the next n unpack() calls will iterate over its contents."""
+ """assuming the next object is an array, return its size n, such that
+ the next n unpack() calls will iterate over its contents.
+
+ When there are not enough bytes for unpacking, `unpack()` raises
+ `OutOfData` Exception.
+ """
return self._unpack(read_array_header, write_bytes)
def read_map_header(self, object write_bytes=None):
- """assuming the next object is a map, return its size n, such that the next n * 2 unpack() calls will iterate over its key-value pairs."""
+ """assuming the next object is a map, return its size n, such that the
+ next n * 2 unpack() calls will iterate over its key-value pairs.
+
+ When there are not enough bytes for unpacking, `unpack()` raises
+ `OutOfData` Exception.
+ """
return self._unpack(read_map_header, write_bytes)
def __iter__(self):