MCPcopy Index your code
hub / github.com/python/cpython / parentname

Function parentname

Lib/pydoc.py:179–190  ·  view source on GitHub ↗

Get a name of the enclosing class (qualified it with a module name if necessary) or module.

(object, modname)

Source from the content-addressed store, hash-verified

177 return name
178
179def parentname(object, modname):
180 """Get a name of the enclosing class (qualified it with a module name
181 if necessary) or module."""
182 if '.' in object.__qualname__:
183 name = object.__qualname__.rpartition('.')[0]
184 if object.__module__ != modname and object.__module__ is not None:
185 return object.__module__ + '.' + name
186 else:
187 return name
188 else:
189 if object.__module__ != modname:
190 return object.__module__
191
192def isdata(object):
193 """Check if an object is of a type that probably means it's data."""

Callers 2

parentlinkMethod · 0.85
docroutineMethod · 0.85

Calls 1

rpartitionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…