Use a more correct method name

This commit is contained in:
Kovid Goyal
2024-07-29 20:17:52 +05:30
parent 4ba9fcaf37
commit 9047df5080
4 changed files with 5 additions and 5 deletions

View File

@@ -281,7 +281,7 @@ class WriteRequest:
def flush_base64_data(self) -> None:
if self.currently_writing_mime:
self.decoder.flush()
self.decoder.reinitialize()
if len(self.decoder):
self.write_base64_data(b'')
start = self.mime_map[self.currently_writing_mime][0]

View File

@@ -163,7 +163,7 @@ static Py_ssize_t
StreamingBase64Decoder_len(PyObject *s) { return ((StreamingBase64Decoder*)s)->output_sz; }
static PyObject*
StreamingBase64Decoder_flush(StreamingBase64Decoder *self, PyObject *args UNUSED) {
StreamingBase64Decoder_reinitialize(StreamingBase64Decoder *self, PyObject *args UNUSED) {
base64_stream_decode_init(&self->state, 0);
Py_RETURN_NONE;
}
@@ -191,7 +191,7 @@ static PyTypeObject StreamingBase64Decoder_Type = {
.tp_doc = "StreamingBase64Decoder",
.tp_methods = (PyMethodDef[]){
{"add", (PyCFunction)StreamingBase64Decoder_add, METH_O, ""},
{"flush", (PyCFunction)StreamingBase64Decoder_flush, METH_NOARGS, ""},
{"reinitialize", (PyCFunction)StreamingBase64Decoder_reinitialize, METH_NOARGS, ""},
{"take_output", (PyCFunction)StreamingBase64Decoder_take_output, METH_NOARGS, ""},
{"copy_output", (PyCFunction)StreamingBase64Decoder_copy_output, METH_NOARGS, ""},
{NULL, NULL, 0, NULL},

View File

@@ -1707,7 +1707,7 @@ def get_mouse_data_for_window(os_window_id: int, tab_id: int, window_id: int) ->
class StreamingBase64Decoder:
def __init__(self, initial_capacity: int = 8 *1024) -> None: ... # set the initial output buffer capacity
def add(self, data: ReadOnlyBuffer) -> int: ... # add the base64 data
def flush(self) -> None: ... # indicate end of base64 data, left over bytes are processed as if they were followed by padding
def reinitialize(self) -> None: ... # reset the state to empty to start decoding a new stream
def take_output(self) -> bytes: ... # take the output so far. The decoder no longer references this output
def copy_output(self) -> bytes: ... # copy the output so far
def __len__(self) -> int: ... # return the length of the current output

View File

@@ -183,7 +183,7 @@ class EncodedDataStore:
self.data_store(self.decoder.take_output())
def flush_encoded_data(self) -> None:
self.decoder.flush()
self.decoder.reinitialize()
if len(self.decoder):
self.data_store(self.decoder.take_output())