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

Method init_alone

crates/stdlib/src/lzma.rs:754–771  ·  view source on GitHub ↗
(
            preset: u32,
            filter_specs: Option<Vec<PyObjectRef>>,
            vm: &VirtualMachine,
        )

Source from the content-addressed store, hash-verified

752 }
753
754 fn init_alone(
755 preset: u32,
756 filter_specs: Option<Vec<PyObjectRef>>,
757 vm: &VirtualMachine,
758 ) -> PyResult<Stream> {
759 if let Some(_filter_specs) = filter_specs {
760 // TODO: validate single LZMA1 filter and use its options
761 let options = LzmaOptions::new_preset(preset).map_err(|_| {
762 new_lzma_error(format!("Invalid compression preset: {preset}"), vm)
763 })?;
764 Stream::new_lzma_encoder(&options).map_err(|e| catch_lzma_error(e, vm))
765 } else {
766 let options = LzmaOptions::new_preset(preset).map_err(|_| {
767 new_lzma_error(format!("Invalid compression preset: {preset}"), vm)
768 })?;
769 Stream::new_lzma_encoder(&options).map_err(|e| catch_lzma_error(e, vm))
770 }
771 }
772
773 fn init_raw(
774 filter_specs: Option<Vec<PyObjectRef>>,

Callers

nothing calls this directly

Calls 2

new_lzma_errorFunction · 0.85
catch_lzma_errorFunction · 0.85

Tested by

no test coverage detected