|
41 | 41 | //|
|
42 | 42 | //| Not implemented: 64-bit int, uint, float.
|
43 | 43 | //|
|
44 |
| -//| Example 1: |
| 44 | +//| Example 1:: |
| 45 | +//| |
45 | 46 | //| import msgpack
|
46 | 47 | //| from io import BytesIO
|
47 | 48 | //|
|
|
50 | 51 | //| b.seek(0)
|
51 | 52 | //| print(msgpack.unpack(b))
|
52 | 53 | //|
|
53 |
| -//| Example 2: handling objects |
| 54 | +//| Example 2: handling objects:: |
54 | 55 | //|
|
55 | 56 | //| from msgpack import pack, unpack, ExtType
|
56 | 57 | //| from io import BytesIO
|
|
78 | 79 | //| buffer.seek(0)
|
79 | 80 | //| decoded = unpack(buffer, ext_hook=decoder)
|
80 | 81 | //| print(f"{data} -> {buffer.getvalue()} -> {decoded}")
|
| 82 | +//| |
81 | 83 | //| """
|
82 | 84 | //|
|
83 | 85 |
|
84 | 86 | //| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None], None] = None) -> None:
|
85 | 87 | //| """Ouput object to buffer in msgpack format.
|
| 88 | +//| |
86 | 89 | //| :param object obj: Object to convert to msgpack format.
|
87 | 90 | //| :param ~_typing.WriteableBuffer buffer: buffer to write into
|
88 | 91 | //| :param Optional[~_typing.Callable[[object], None]] default:
|
@@ -114,10 +117,12 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack);
|
114 | 117 |
|
115 | 118 | //| def unpack(buffer: ReadableBuffer, *, ext_hook: Union[Callable[[int, bytes], object], None] = None, use_list: bool=True) -> object:
|
116 | 119 | //| """Unpack and return one object from buffer.
|
| 120 | +//| |
117 | 121 | //| :param ~_typing.ReadableBuffer buffer: buffer to read from
|
118 | 122 | //| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in
|
119 | 123 | //| msgpack ext format.
|
120 | 124 | //| :param Optional[bool] use_list: return array as list or tuple (use_list=False).
|
| 125 | +//| |
121 | 126 | //| :return object: object read from buffer.
|
122 | 127 | //| """
|
123 | 128 | //| ...
|
|
0 commit comments