Skip to content

Commit 4480227

Browse files
committed
Improve docstrings.
1 parent c7161e9 commit 4480227

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

msgpack/_msgpack.pyx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ cdef class Unpacker(object):
426426
init_ctx(&self.ctx, object_hook, object_pairs_hook, list_hook, use_list, cenc, cerr)
427427

428428
def feed(self, object next_bytes):
429+
"""Append `next_bytes` to internal buffer."""
429430
cdef char* buf
430431
cdef Py_ssize_t buf_len
431432
if self.file_like is not None:
@@ -523,24 +524,42 @@ cdef class Unpacker(object):
523524
"""
524525
unpack one object
525526
526-
If write_bytes is not None, it will be called with parts of the raw message as it is unpacked.
527+
If write_bytes is not None, it will be called with parts of the raw
528+
message as it is unpacked.
529+
530+
When there are not enough bytes for unpacking, `unpack()` raises
531+
`OutOfData` Exception.
527532
"""
528533
return self._unpack(template_construct, write_bytes)
529534

530535
def skip(self, object write_bytes=None):
531536
"""
532537
read and ignore one object, returning None
533538
534-
If write_bytes is not None, it will be called with parts of the raw message as it is unpacked.
539+
If write_bytes is not None, it will be called with parts of the raw
540+
message as it is unpacked.
541+
542+
When there are not enough bytes for unpacking, `unpack()` raises
543+
`OutOfData` Exception.
535544
"""
536545
return self._unpack(template_skip, write_bytes)
537546

538547
def read_array_header(self, object write_bytes=None):
539-
"""assuming the next object is an array, return its size n, such that the next n unpack() calls will iterate over its contents."""
548+
"""assuming the next object is an array, return its size n, such that
549+
the next n unpack() calls will iterate over its contents.
550+
551+
When there are not enough bytes for unpacking, `unpack()` raises
552+
`OutOfData` Exception.
553+
"""
540554
return self._unpack(read_array_header, write_bytes)
541555

542556
def read_map_header(self, object write_bytes=None):
543-
"""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."""
557+
"""assuming the next object is a map, return its size n, such that the
558+
next n * 2 unpack() calls will iterate over its key-value pairs.
559+
560+
When there are not enough bytes for unpacking, `unpack()` raises
561+
`OutOfData` Exception.
562+
"""
544563
return self._unpack(read_map_header, write_bytes)
545564

546565
def __iter__(self):

0 commit comments

Comments
 (0)