(self, object, name=None, mod=None,
                   funcs={}, classes={}, methods={}, cl=None)
Produce HTML documentation for a function or method object.
Produce HTML documentation for a function or method object.
Produce HTML documentation for a function or method object .
def docroutine(self, object, name=None, mod=None,
                   funcs={}, classes={}, methods={}, cl=None):
        """Produce HTML documentation for a function or method object."""
        realname = object.__name__
        name = name or realname
        anchor = (cl and cl.__name__ or '') + '-' + name
        note = ''
        skipdocs = 0
        if _is_bound_method(object):
            imclass = object.__self__.__class__
            if cl:
                if imclass is not cl:
                    note = ' from ' + self.classlink(imclass, mod)
            else:
                if object.__self__ is not None:
                    note = ' method of %s instance' % self.classlink(
                        object.__self__.__class__, mod)
                else:
                    note = ' unbound %s method' % self.classlink(imclass,mod)

        if (inspect.iscoroutinefunction(object) or
                inspect.isasyncgenfunction(object)):
            asyncqualifier = 'async '
        else:
            asyncqualifier = ''

        if name == realname:
            title = '<a name="%s"><strong>%s</strong></a>' % (anchor, realname)
        else:
            if cl and inspect.getattr_static(cl, realname, []) is object:
                reallink = '<a href="#%s">%s</a>' % (
                    cl.__name__ + '-' + realname, realname)
                skipdocs = 1
            else:
                reallink = realname
            title = '<a name="%s"><strong>%s</strong></a> = %s' % (
                anchor, name, reallink)
        argspec = None
        if inspect.isroutine(object):
            try:
                signature = inspect.signature(object)
            except (ValueError, TypeError):
                signature = None
            if signature:
                argspec = str(signature)
                if realname == '<lambda>':
                    title = '<strong>%s</strong> <em>lambda</em> ' % name
                    # XXX lambda's won't usually have func_annotations['return']
                    # since the syntax doesn't support but it is possible.
                    # So removing parentheses isn't truly safe.
                    argspec = argspec[1:-1] # remove parentheses
        if not argspec:
            argspec = '(...)'

        decl = asyncqualifier + title + self.escape(argspec) + (note and
               self.grey('<font face="helvetica, arial">%s</font>' % note))

        if skipdocs:
            return '<dl><dt>%s</dt></dl>\n' % decl
        else:
            doc = self.markup(
                getdoc(object), self.preformat, funcs, classes, methods)
            doc = doc and '<dd><tt>%s</tt></dd>' % doc
            return '<dl><dt>%s</dt>%s</dl>\n' % (decl, doc)
def docroutine ( self , object , name = None , mod = None , funcs = { } , classes = { } , methods = { } , cl = None ) : realname = object . __name__ name = name or realname anchor = ( cl and cl . __name__ or '' ) + '-' + name note = '' skipdocs = 0 if _is_bound_method ( object ) : imclass = object . __self__ . __class__ if cl : if imclass is not cl : note = ' from ' + self . classlink ( imclass , mod ) else : if object . __self__ is not None : note = ' method of %s instance' % self . classlink ( object . __self__ . __class__ , mod ) else : note = ' unbound %s method' % self . classlink ( imclass , mod ) if ( inspect . iscoroutinefunction ( object ) or inspect . isasyncgenfunction ( object ) ) : asyncqualifier = 'async ' else : asyncqualifier = '' if name == realname : title = '<a name="%s"><strong>%s</strong></a>' % ( anchor , realname ) else : if cl and inspect . getattr_static ( cl , realname , [ ] ) is object : reallink = '<a href="#%s">%s</a>' % ( cl . __name__ + '-' + realname , realname ) skipdocs = 1 else : reallink = realname title = '<a name="%s"><strong>%s</strong></a> = %s' % ( anchor , name , reallink ) argspec = None if inspect . isroutine ( object ) : try : signature = inspect . signature ( object ) except ( ValueError , TypeError ) : signature = None if signature : argspec = str ( signature ) if realname == '<lambda>' : title = '<strong>%s</strong> <em>lambda</em> ' % name # XXX lambda's won't usually have func_annotations['return'] # since the syntax doesn't support but it is possible. # So removing parentheses isn't truly safe. argspec = argspec [ 1 : - 1 ] # remove parentheses if not argspec : argspec = '(...)' decl = asyncqualifier + title + self . escape ( argspec ) + ( note and self . grey ( '<font face="helvetica, arial">%s</font>' % note ) ) if skipdocs : return '<dl><dt>%s</dt></dl>\n' % decl else : doc = self . markup ( getdoc ( object ) , self . preformat , funcs , classes , methods ) doc = doc and '<dd><tt>%s</tt></dd>' % doc return '<dl><dt>%s</dt>%s</dl>\n' % ( decl , doc )