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

Function describe

Lib/pydoc.py:1685–1717  ·  view source on GitHub ↗

Produce a short description of the given thing.

(thing)

Source from the content-addressed store, hash-verified

1683 pager(text, title)
1684
1685def describe(thing):
1686 """Produce a short description of the given thing."""
1687 if inspect.ismodule(thing):
1688 if thing.__name__ in sys.builtin_module_names:
1689 return 'built-in module ' + thing.__name__
1690 if hasattr(thing, '__path__'):
1691 return 'package ' + thing.__name__
1692 else:
1693 return 'module ' + thing.__name__
1694 if inspect.isbuiltin(thing):
1695 return 'built-in function ' + thing.__name__
1696 if inspect.isgetsetdescriptor(thing):
1697 return 'getset descriptor %s.%s.%s' % (
1698 thing.__objclass__.__module__, thing.__objclass__.__name__,
1699 thing.__name__)
1700 if inspect.ismemberdescriptor(thing):
1701 return 'member descriptor %s.%s.%s' % (
1702 thing.__objclass__.__module__, thing.__objclass__.__name__,
1703 thing.__name__)
1704 if inspect.isclass(thing):
1705 return 'class ' + thing.__name__
1706 if inspect.isfunction(thing):
1707 return 'function ' + thing.__name__
1708 if inspect.ismethod(thing):
1709 return 'method ' + thing.__name__
1710 if inspect.ismethodwrapper(thing):
1711 return 'method wrapper ' + thing.__name__
1712 if inspect.ismethoddescriptor(thing):
1713 try:
1714 return 'method descriptor ' + thing.__name__
1715 except AttributeError:
1716 pass
1717 return type(thing).__name__
1718
1719def locate(path, forceload=0):
1720 """Locate an object by name or dotted path, importing as necessary."""

Callers 3

render_docFunction · 0.85
writedocFunction · 0.85
html_getobjFunction · 0.85

Calls 2

hasattrFunction · 0.85
ismethodMethod · 0.80

Tested by

no test coverage detected