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

Method init_xz

crates/stdlib/src/lzma.rs:737–752  ·  view source on GitHub ↗
(
            check: i32,
            preset: u32,
            filters: Option<Vec<PyObjectRef>>,
            vm: &VirtualMachine,
        )

Source from the content-addressed store, hash-verified

735
736 impl LZMACompressor {
737 fn init_xz(
738 check: i32,
739 preset: u32,
740 filters: Option<Vec<PyObjectRef>>,
741 vm: &VirtualMachine,
742 ) -> PyResult<Stream> {
743 let real_check =
744 int_to_check(check).ok_or_else(|| vm.new_value_error("Invalid check value"))?;
745 if let Some(filter_specs) = filters {
746 let filters = parse_filter_chain_spec(filter_specs, vm)?;
747 Stream::new_stream_encoder(&filters, real_check)
748 .map_err(|e| catch_lzma_error(e, vm))
749 } else {
750 Stream::new_easy_encoder(preset, real_check).map_err(|e| catch_lzma_error(e, vm))
751 }
752 }
753
754 fn init_alone(
755 preset: u32,

Callers

nothing calls this directly

Calls 4

int_to_checkFunction · 0.85
parse_filter_chain_specFunction · 0.85
catch_lzma_errorFunction · 0.85
ok_or_elseMethod · 0.80

Tested by

no test coverage detected