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

Method into_option

crates/vm/src/stdlib/posix.rs:703–716  ·  view source on GitHub ↗
(
                arg: OptionalArg<PyObjectRef>,
                vm: &VirtualMachine,
            )

Source from the content-addressed store, hash-verified

701 Option<PyObjectRef>,
702 )> {
703 fn into_option(
704 arg: OptionalArg<PyObjectRef>,
705 vm: &VirtualMachine,
706 ) -> PyResult<Option<PyObjectRef>> {
707 match arg {
708 OptionalArg::Present(obj) => {
709 if !obj.is_callable() {
710 return Err(vm.new_type_error("Args must be callable"));
711 }
712 Ok(Some(obj))
713 }
714 OptionalArg::Missing => Ok(None),
715 }
716 }
717 let before = into_option(self.before, vm)?;
718 let after_in_parent = into_option(self.after_in_parent, vm)?;
719 let after_in_child = into_option(self.after_in_child, vm)?;

Callers 15

getMethod · 0.80
slot_newMethod · 0.80
splitFunction · 0.80
splitMethod · 0.80
groupsMethod · 0.80
handle_defaultFunction · 0.80
raw_max_lengthMethod · 0.80
max_lengthMethod · 0.80
resolve_dataFunction · 0.80
hmac_newFunction · 0.80
pbkdf2_hmacFunction · 0.80
decompressobjFunction · 0.80

Calls 3

is_callableMethod · 0.80
ErrClass · 0.50
SomeClass · 0.50

Tested by

no test coverage detected