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

Function is_unionable

crates/vm/src/builtins/union.rs:196–203  ·  view source on GitHub ↗
(obj: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

194}
195
196fn is_unionable(obj: PyObjectRef, vm: &VirtualMachine) -> bool {
197 let cls = obj.class();
198 cls.is(vm.ctx.types.none_type)
199 || obj.downcastable::<PyType>()
200 || cls.fast_issubclass(vm.ctx.types.generic_alias_type)
201 || cls.is(vm.ctx.types.union_type)
202 || obj.downcast_ref::<TypeAliasType>().is_some()
203}
204
205fn type_check(arg: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
206 // Fast path to avoid calling into typing.py

Callers 2

type_checkFunction · 0.85
or_opFunction · 0.85

Calls 3

isMethod · 0.80
fast_issubclassMethod · 0.80
classMethod · 0.45

Tested by

no test coverage detected