Skip to main content

find_obj

Function find_obj 

Source
pub fn find_obj<'a>(
    data: &'a PyDomainData,
    modname: Option<&str>,
    classname: Option<&str>,
    name: &str,
    typ: Option<&str>,
    searchmode: u8,
) -> Vec<(String, &'a PyObjectEntry)>
Expand description

PythonDomain.find_obj (__init__.py:855-928): find candidates for name, perhaps using the given module/class context. Returns (fullname, entry) pairs in match order.

  • The () strip is the FIRST statement (:868), so every caller — resolve_xref’s fallback retries and a future resolve_any_xref — inherits it.
  • searchmode 0 (exact): name → classname.name → modname.name → modname.classname.name, object type NOT checked; a mod role takes only the bare-name match (:913-915) — which may be a non-module object, since the type isn’t checked.
  • searchmode 1 (refspecific): candidates gated on [objtypes_for_role], reversed order modname.classname.name → modname.name → name; only when every exact candidate failed, the fuzzy pass collects each registered object whose fullname ends with .name — iterating PyDomainData::objects in REGISTRATION order, which is what makes the ambiguity warning’s candidate list and the first-match winner reproducible.