Fixes invalid module names in pdoc Sphinx objects.inv output.
<%def name="show_var(v, is_nested=False)">
<%
return_type = get_annotation(v.type_annotation)
- if return_type == "":
parent = v.cls.obj if v.cls is not None else v.module.obj
+ if return_type == "":
if hasattr(parent, "mro"):
for cls in parent.mro():
if value:
return_type += f" = {value}"
+ if hasattr(parent, "mro"):
+ name = f"{parent.__module__}.{parent.__qualname__}.{v.name}"
+ else:
+ name = f"{parent.__name__}.{v.qualname}"
+
project_inventory.objects.append(
sphobjinv.DataObjStr(
- name = f"{v.module.name}.{v.qualname}",
+ name = name,
domain = "py",
role = "var",
uri = v.url(),
if not redirect:
project_inventory.objects.append(
sphobjinv.DataObjStr(
- name = f"{f.module.name}.{f.qualname}",
+ name = f.obj.__module__ + "." + f.obj.__qualname__,
domain = "py",
role = "func",
uri = f.url(),
if not redirect:
project_inventory.objects.append(
sphobjinv.DataObjStr(
- name = f"{c.module.name}.{c.qualname}",
+ name = c.obj.__module__ + "." + c.obj.__qualname__,
domain = "py",
role = "class",
uri = c.url(),
