MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / docroutine

Method docroutine

tools/python-3.11.9-amd64/Lib/pydoc.py:1518–1595  ·  view source on GitHub ↗

Produce text documentation for a function or method object.

(self, object, name=None, mod=None, cl=None, homecls=None)

Source from the content-addressed store, hash-verified

1516 return '=' + self.repr(object)
1517
1518 def docroutine(self, object, name=None, mod=None, cl=None, homecls=None):
1519 """Produce text documentation for a function or method object."""
1520 realname = object.__name__
1521 name = name or realname
1522 if homecls is None:
1523 homecls = cl
1524 note = ''
1525 skipdocs = False
1526 imfunc = None
1527 if _is_bound_method(object):
1528 imself = object.__self__
1529 if imself is cl:
1530 imfunc = getattr(object, '__func__', None)
1531 elif inspect.isclass(imself):
1532 note = ' class method of %s' % classname(imself, mod)
1533 else:
1534 note = ' method of %s instance' % classname(
1535 imself.__class__, mod)
1536 elif (inspect.ismethoddescriptor(object) or
1537 inspect.ismethodwrapper(object)):
1538 try:
1539 objclass = object.__objclass__
1540 except AttributeError:
1541 pass
1542 else:
1543 if cl is None:
1544 note = ' unbound %s method' % classname(objclass, mod)
1545 elif objclass is not homecls:
1546 note = ' from ' + classname(objclass, mod)
1547 else:
1548 imfunc = object
1549 if inspect.isfunction(imfunc) and homecls is not None and (
1550 imfunc.__module__ != homecls.__module__ or
1551 imfunc.__qualname__ != homecls.__qualname__ + '.' + realname):
1552 pname = parentname(imfunc, mod)
1553 if pname:
1554 note = ' from %s' % pname
1555
1556 if (inspect.iscoroutinefunction(object) or
1557 inspect.isasyncgenfunction(object)):
1558 asyncqualifier = 'async '
1559 else:
1560 asyncqualifier = ''
1561
1562 if name == realname:
1563 title = self.bold(realname)
1564 else:
1565 if (cl is not None and
1566 inspect.getattr_static(cl, realname, []) is object):
1567 skipdocs = True
1568 if note.startswith(' from '):
1569 note = ''
1570 title = self.bold(name) + ' = ' + realname
1571 argspec = None
1572
1573 if inspect.isroutine(object):
1574 try:
1575 signature = inspect.signature(object)

Callers

nothing calls this directly

Calls 10

boldMethod · 0.95
indentMethod · 0.95
_is_bound_methodFunction · 0.85
classnameFunction · 0.85
parentnameFunction · 0.85
strFunction · 0.85
startswithMethod · 0.80
signatureMethod · 0.80
getdocFunction · 0.70
rstripMethod · 0.45

Tested by

no test coverage detected