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

Method docclass

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

Produce HTML documentation for a class object.

(self, object, name=None, mod=None, funcs={}, classes={},
                 *ignored)

Source from the content-addressed store, hash-verified

890 return result
891
892 def docclass(self, object, name=None, mod=None, funcs={}, classes={},
893 *ignored):
894 """Produce HTML documentation for a class object."""
895 realname = object.__name__
896 name = name or realname
897 bases = object.__bases__
898
899 contents = []
900 push = contents.append
901
902 # Cute little class to pump out a horizontal rule between sections.
903 class HorizontalRule:
904 def __init__(self):
905 self.needone = 0
906 def maybe(self):
907 if self.needone:
908 push('<hr>\n')
909 self.needone = 1
910 hr = HorizontalRule()
911
912 # List the mro, if non-trivial.
913 mro = deque(inspect.getmro(object))
914 if len(mro) > 2:
915 hr.maybe()
916 push('<dl><dt>Method resolution order:</dt>\n')
917 for base in mro:
918 push('<dd>%s</dd>\n' % self.classlink(base,
919 object.__module__))
920 push('</dl>\n')
921
922 def spill(msg, attrs, predicate):
923 ok, attrs = _split_list(attrs, predicate)
924 if ok:
925 hr.maybe()
926 push(msg)
927 for name, kind, homecls, value in ok:
928 try:
929 value = getattr(object, name)
930 except Exception:
931 # Some descriptors may meet a failure in their __get__.
932 # (bug #1785)
933 push(self.docdata(value, name, mod))
934 else:
935 push(self.document(value, name, mod,
936 funcs, classes, mdict, object, homecls))
937 push('\n')
938 return attrs
939
940 def spilldescriptors(msg, attrs, predicate):
941 ok, attrs = _split_list(attrs, predicate)
942 if ok:
943 hr.maybe()
944 push(msg)
945 for name, kind, homecls, value in ok:
946 push(self.docdata(value, name, mod))
947 return attrs
948
949 def spilldata(msg, attrs, predicate):

Callers 1

documentMethod · 0.45

Calls 15

maybeMethod · 0.95
classlinkMethod · 0.95
markupMethod · 0.95
sectionMethod · 0.95
dequeFunction · 0.85
visiblenameFunction · 0.85
_split_listFunction · 0.85
sort_attributesFunction · 0.85
strFunction · 0.85
signatureMethod · 0.80
HorizontalRuleClass · 0.70
classify_class_attrsFunction · 0.70

Tested by

no test coverage detected