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

Method resolve_mro

crates/vm/src/builtins/type.rs:561–575  ·  view source on GitHub ↗
(bases: &[PyRef<Self>])

Source from the content-addressed store, hash-verified

559 }
560
561 fn resolve_mro(bases: &[PyRef<Self>]) -> Result<Vec<PyTypeRef>, String> {
562 // Check for duplicates in bases.
563 let mut unique_bases = HashSet::new();
564 for base in bases {
565 if !unique_bases.insert(base.get_id()) {
566 return Err(format!("duplicate base class {}", base.name()));
567 }
568 }
569
570 let mros = bases
571 .iter()
572 .map(|base| base.mro_map_collect(|t| t.to_owned()))
573 .collect();
574 linearise_mro(mros)
575 }
576
577 /// Inherit SEQUENCE and MAPPING flags from base classes
578 /// Check all bases in order and inherit the first SEQUENCE or MAPPING flag found

Callers

nothing calls this directly

Calls 10

newFunction · 0.85
linearise_mroFunction · 0.85
collectMethod · 0.80
mro_map_collectMethod · 0.80
ErrClass · 0.50
insertMethod · 0.45
get_idMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected