{ } Raw JSON

bundles / papyri 0.0.10 / papyri / gen / find_canonical

function

papyri.gen:find_canonical

source: /papyri/gen.py:2281

Signature

def find_canonical(qa: str, aliases: list[str]) → str | None

Summary

Given the fully qualified name and a lit of aliases, try to find the canonical one.

Extended Summary

The canonical name is usually:

  • short (less depth in number of modules)

  • does not contain special chars like <, > for locals

  • none of the part start with _.

  • if there are many names that have the same depth and are shorted than the qa, we bail.

We might want to be careful with dunders.

If we can't find a canonical, there are many, or are identical to the fqa, return None.

Aliases

  • papyri.gen.find_canonical