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

Function or_op

crates/vm/src/builtins/union.rs:222–233  ·  view source on GitHub ↗
(zelf: PyObjectRef, other: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

220}
221
222pub fn or_op(zelf: PyObjectRef, other: PyObjectRef, vm: &VirtualMachine) -> PyResult {
223 if !has_union_operands(zelf.clone(), other.clone(), vm)
224 && (!is_unionable(zelf.clone(), vm) || !is_unionable(other.clone(), vm))
225 {
226 return Ok(vm.ctx.not_implemented());
227 }
228
229 let left = type_check(zelf, vm)?;
230 let right = type_check(other, vm)?;
231 let tuple = PyTuple::new_ref(vec![left, right], &vm.ctx);
232 make_union(&tuple, vm)
233}
234
235fn make_parameters(args: &Py<PyTuple>, vm: &VirtualMachine) -> PyResult<PyTupleRef> {
236 let parameters = genericalias::make_parameters(args, vm);

Callers 1

or_Function · 0.85

Calls 6

has_union_operandsFunction · 0.85
is_unionableFunction · 0.85
make_unionFunction · 0.85
type_checkFunction · 0.70
cloneMethod · 0.45
not_implementedMethod · 0.45

Tested by

no test coverage detected