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

Function decompressobj

crates/stdlib/src/zlib.rs:193–211  ·  view source on GitHub ↗
(args: DecompressobjArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

191
192 #[pyfunction]
193 fn decompressobj(args: DecompressobjArgs, vm: &VirtualMachine) -> PyResult<PyDecompress> {
194 let mut decompress = InitOptions::new(args.wbits.value, vm)?.decompress();
195 let zdict = args.zdict.into_option();
196 if let Some(dict) = &zdict
197 && args.wbits.value < 0
198 {
199 dict.with_ref(|d| decompress.set_dictionary(d))
200 .map_err(|_| new_zlib_error("failed to set dictionary", vm))?;
201 }
202 let inner = PyDecompressInner {
203 decompress: Some(DecompressWithDict { decompress, zdict }),
204 eof: false,
205 unused_data: vm.ctx.empty_bytes.clone(),
206 unconsumed_tail: vm.ctx.empty_bytes.clone(),
207 };
208 Ok(PyDecompress {
209 inner: PyMutex::new(inner),
210 })
211 }
212
213 #[derive(Debug)]
214 struct PyDecompressInner {

Callers

nothing calls this directly

Calls 7

newFunction · 0.85
new_zlib_errorFunction · 0.85
into_optionMethod · 0.80
with_refMethod · 0.80
SomeClass · 0.50
decompressMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected