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

Method parentlink

Lib/pydoc.py:735–752  ·  view source on GitHub ↗

Make a link for the enclosing class or module.

(self, object, modname)

Source from the content-addressed store, hash-verified

733 return classname(object, modname)
734
735 def parentlink(self, object, modname):
736 """Make a link for the enclosing class or module."""
737 link = None
738 name, module = object.__name__, sys.modules.get(object.__module__)
739 if hasattr(module, name) and getattr(module, name) is object:
740 if '.' in object.__qualname__:
741 name = object.__qualname__.rpartition('.')[0]
742 if object.__module__ != modname:
743 link = '%s.html#%s' % (module.__name__, name)
744 else:
745 link = '#%s' % name
746 else:
747 if object.__module__ != modname:
748 link = '%s.html' % module.__name__
749 if link:
750 return '<a href="%s">%s</a>' % (link, parentname(object, modname))
751 else:
752 return parentname(object, modname)
753
754 def modulelink(self, object):
755 """Make a link for a module."""

Callers 1

docroutineMethod · 0.95

Calls 5

hasattrFunction · 0.85
getattrFunction · 0.85
parentnameFunction · 0.85
getMethod · 0.45
rpartitionMethod · 0.45

Tested by

no test coverage detected