MCPcopy Index your code
hub / github.com/RustPython/RustPython / flush

Method flush

crates/stdlib/src/zlib.rs:315–334  ·  view source on GitHub ↗
(&self, length: OptionalArg<ArgSize>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

313
314 #[pymethod]
315 fn flush(&self, length: OptionalArg<ArgSize>, vm: &VirtualMachine) -> PyResult<Vec<u8>> {
316 let length = match length {
317 OptionalArg::Present(ArgSize { value }) if value <= 0 => {
318 return Err(vm.new_value_error("length must be greater than zero"));
319 }
320 OptionalArg::Present(ArgSize { value }) => value as usize,
321 OptionalArg::Missing => DEF_BUF_SIZE,
322 };
323
324 let inner = &mut *self.inner.lock();
325 let data = core::mem::replace(&mut inner.unconsumed_tail, vm.ctx.empty_bytes.clone());
326
327 let (ret, _) = Self::decompress_inner(inner, &data, length, None, true, vm)?;
328
329 if inner.eof {
330 inner.decompress = None;
331 }
332
333 ret
334 }
335 }
336
337 #[derive(FromArgs)]

Callers

nothing calls this directly

Calls 5

new_zlib_errorFunction · 0.85
ErrClass · 0.50
replaceFunction · 0.50
lockMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected