Skip to content

Commit 1e03c9d

Browse files
committed
changed msgpack to use ByteStream type annotations
1 parent 40b430e commit 1e03c9d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

shared-bindings/msgpack/__init__.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@
8383
//| """
8484
//|
8585

86-
//| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None], None] = None) -> None:
87-
//| """Ouput object to buffer in msgpack format.
86+
//| def pack(obj: object, stream: ByteStream, *, default: Union[Callable[[object], None], None] = None) -> None:
87+
//| """Output object to stream in msgpack format.
8888
//|
8989
//| :param object obj: Object to convert to msgpack format.
90-
//| :param ~circuitpython_typing.WriteableBuffer buffer: buffer to write into
90+
//| :param ~circuitpython_typing.ByteStream stream: stream to write to
9191
//| :param Optional[~circuitpython_typing.Callable[[object], None]] default:
9292
//| function called for python objects that do not have
9393
//| a representation in msgpack format.
@@ -98,7 +98,7 @@ STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map
9898
enum { ARG_obj, ARG_buffer, ARG_default };
9999
STATIC const mp_arg_t allowed_args[] = {
100100
{ MP_QSTR_obj, MP_ARG_REQUIRED | MP_ARG_OBJ },
101-
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ },
101+
{ MP_QSTR_stream, MP_ARG_REQUIRED | MP_ARG_OBJ },
102102
{ MP_QSTR_default, MP_ARG_KW_ONLY | MP_ARG_OBJ, { .u_obj = mp_const_none } },
103103
};
104104
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
@@ -115,22 +115,22 @@ STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map
115115
MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 0, mod_msgpack_pack);
116116

117117

118-
//| def unpack(buffer: ReadableBuffer, *, ext_hook: Union[Callable[[int, bytes], object], None] = None, use_list: bool=True) -> object:
119-
//| """Unpack and return one object from buffer.
118+
//| def unpack(stream: ByteStream, *, ext_hook: Union[Callable[[int, bytes], object], None] = None, use_list: bool=True) -> object:
119+
//| """Unpack and return one object from stream.
120120
//|
121-
//| :param ~circuitpython_typing.ReadableBuffer buffer: buffer to read from
121+
//| :param ~circuitpython_typing.ByteStream stream: stream to read from
122122
//| :param Optional[~circuitpython_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in
123123
//| msgpack ext format.
124124
//| :param Optional[bool] use_list: return array as list or tuple (use_list=False).
125125
//|
126-
//| :return object: object read from buffer.
126+
//| :return object: object read from stream.
127127
//| """
128128
//| ...
129129
//|
130130
STATIC mp_obj_t mod_msgpack_unpack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
131131
enum { ARG_buffer, ARG_ext_hook, ARG_use_list };
132132
STATIC const mp_arg_t allowed_args[] = {
133-
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, },
133+
{ MP_QSTR_stream, MP_ARG_REQUIRED | MP_ARG_OBJ, },
134134
{ MP_QSTR_ext_hook, MP_ARG_KW_ONLY | MP_ARG_OBJ, { .u_obj = mp_const_none } },
135135
{ MP_QSTR_use_list, MP_ARG_KW_ONLY | MP_ARG_BOOL, { .u_bool = true } },
136136
};

0 commit comments

Comments
 (0)