Author: Carl Friedrich Bolz <cfb...@gmx.de>
Branch: py3.5
Changeset: r90828:69340a250c18
Date: 2017-03-28 11:09 +0200
http://bitbucket.org/pypy/pypy/changeset/69340a250c18/

Log:    add docstrings to struct module

diff --git a/pypy/module/struct/interp_struct.py 
b/pypy/module/struct/interp_struct.py
--- a/pypy/module/struct/interp_struct.py
+++ b/pypy/module/struct/interp_struct.py
@@ -40,6 +40,7 @@
         return space.text_w(w_input)
 
 def calcsize(space, w_format):
+    """Return size of C struct described by format string fmt."""
     format = text_or_bytes_w(space, w_format)
     return space.newint(_calcsize(space, format))
 
@@ -60,6 +61,7 @@
 
 
 def pack(space, w_format, args_w):
+    """Return string containing values v1, v2, ... packed according to fmt."""
     format = text_or_bytes_w(space, w_format)
     return do_pack(space, format, args_w)
 
@@ -69,6 +71,9 @@
 
 @unwrap_spec(offset=int)
 def pack_into(space, w_format, w_buffer, offset, args_w):
+    """ Pack the values v1, v2, ... according to fmt.
+Write the packed bytes into the writable buffer buf starting at offset
+    """
     format = text_or_bytes_w(space, w_format)
     return do_pack_into(space, format, w_buffer, offset, args_w)
 
@@ -108,6 +113,8 @@
 
 @unwrap_spec(offset=int)
 def unpack_from(space, w_format, w_buffer, offset=0):
+    """Unpack the buffer, containing packed C structure data, according to
+fmt, starting at offset. Requires len(buffer[offset:]) >= calcsize(fmt)."""
     format = text_or_bytes_w(space, w_format)
     return do_unpack_from(space, format, w_buffer, offset)
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to