当前位置: 首页>>代码示例>>Python>>正文


Python addnodes.desc_annotation方法代码示例

本文整理汇总了Python中sphinx.addnodes.desc_annotation方法的典型用法代码示例。如果您正苦于以下问题:Python addnodes.desc_annotation方法的具体用法?Python addnodes.desc_annotation怎么用?Python addnodes.desc_annotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sphinx.addnodes的用法示例。


在下文中一共展示了addnodes.desc_annotation方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def handle_signature(self,sig,signode):
    sig = sig.strip()
    type_name, name, arglist = protobuf_sig_regex.match(sig).groups()

    if self.prefix:
      signode += addnodes.desc_annotation(self.prefix+' ', self.prefix+' ')

    if type_name:
      signode += addnodes.desc_type(type_name, type_name)

    if name:
      signode += addnodes.desc_name(name,name)

    if arglist:
      paramlist = addnodes.desc_parameterlist()
      for arg in arglist.split(','):
        argtype, argname = arg.split(None,1)
        param = addnodes.desc_parameter(noemph=True)
        param += nodes.Text(argtype,argtype)
        param += nodes.emphasis(' '+argname,' '+argname)
        paramlist += param
      signode += paramlist

    return name 
开发者ID:ga4gh,项目名称:ga4gh-schemas,代码行数:26,代码来源:protobufdomain.py

示例2: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def handle_signature(self, sig, signode):
        if '::' in sig:
            mod, name = sig.strip().split('::')
        else:
            name = sig.strip()
            mod = 'std'

        display = name.replace('-', ' ')
        if mod != 'std':
            display = f'{mod}::{display}'

        signode['eql-module'] = mod
        signode['eql-name'] = name
        signode['eql-fullname'] = fullname = f'{mod}::{name}'

        signode += s_nodes.desc_annotation('type', 'type')
        signode += d_nodes.Text(' ')
        signode += s_nodes.desc_name(display, display)
        return fullname 
开发者ID:edgedb,项目名称:edgedb,代码行数:21,代码来源:eql.py

示例3: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def handle_signature(self, sig, signode):
        modifiers, typ, name, getter, setter = parse_property_signature(sig)
        self.append_modifiers(signode, modifiers)
        self.append_type(signode, typ)
        signode += nodes.Text(' ')
        signode += addnodes.desc_name(name, name)
        signode += nodes.Text(' { ')
        extra = []
        if getter:
            extra.append('get;')
        if setter:
            extra.append('set;')
        extra_str = ' '.join(extra)
        signode += addnodes.desc_annotation(extra_str, extra_str)
        signode += nodes.Text(' }')
        return self.get_fullname(name) 
开发者ID:djungelorm,项目名称:sphinx-csharp,代码行数:18,代码来源:csharp.py

示例4: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def handle_signature(self, sig, signode):
        fullname = sig
        signode += addnodes.desc_annotation('config ', 'config ')
        signode += addnodes.desc_name(sig, '', nodes.Text(sig))
        return fullname 
开发者ID:tenpy,项目名称:tenpy,代码行数:7,代码来源:sphinx_cfg_options.py

示例5: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def handle_signature(self, sig: str, signode: addnodes.desc) -> str:
        """Transform signature into RST nodes"""
        signode += addnodes.desc_annotation(self.typename, self.typename + " ")
        signode += addnodes.desc_name(sig, sig)

        if 'badges' in self.options:
            badges = addnodes.desc_annotation()
            badges['classes'] += ['badges']
            content = StringList([self.options['badges']])
            self.state.nested_parse(content, 0, badges)
            signode += badges


        if 'replaces_section_title' in self.options:
            section = self.state.parent
            if isinstance(section, nodes.section):
                title = section[-1]
                if isinstance(title, nodes.title):
                    section.remove(title)
                else:
                    signode += self.state.document.reporter.warning(
                        "%s:%s:: must follow section directly to replace section title"
                        % (self.domain, self.objtype), line = self.lineno
                    )
            else:
                signode += self.state.document.reporter.warning(
                    "%s:%s:: must be in section to replace section title"
                    % (self.domain, self.objtype), line = self.lineno
                )

        return sig 
开发者ID:bioconda,项目名称:bioconda-utils,代码行数:33,代码来源:sphinxext.py

示例6: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def handle_signature(self, sig, signode):
        fullname, prefix = super().handle_signature(sig, signode)

        if 'staticmethod' in self.options:
            signode.insert(
                0, s_nodes.desc_annotation('static method', 'static method'))

        return fullname, prefix 
开发者ID:edgedb,项目名称:edgedb,代码行数:10,代码来源:js.py

示例7: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def handle_signature(self, sig, signode):
        method = self.method.upper() + ' '
        signode += addnodes.desc_name(method, method)
        offset = 0
        path = None
        for match in http_sig_param_re.finditer(sig):
            path = sig[offset:match.start()]
            signode += addnodes.desc_name(path, path)
            params = addnodes.desc_parameterlist()
            typ = match.group('type')
            if typ:
                typ += ': '
                params += addnodes.desc_annotation(typ, typ)
            name = match.group('name')
            params += addnodes.desc_parameter(name, name)
            signode += params
            offset = match.end()
        if offset < len(sig):
            path = sig[offset:len(sig)]
            signode += addnodes.desc_name(path, path)
        assert path is not None, 'no matches for sig: %s' % sig
        fullname = self.method.upper() + ' ' + path
        signode['method'] = self.method
        signode['path'] = sig
        signode['fullname'] = fullname
        return (fullname, self.method, sig) 
开发者ID:preems,项目名称:nltk-server,代码行数:28,代码来源:httpdomain.py

示例8: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def handle_signature(self, sig, signode):
        method = self.method.upper() + " "
        signode += addnodes.desc_name(method, method)
        offset = 0
        path = None
        for match in http_sig_param_re.finditer(sig):
            path = sig[offset : match.start()]
            signode += addnodes.desc_name(path, path)
            params = addnodes.desc_parameterlist()
            typ = match.group("type")
            if typ:
                typ += ": "
                params += addnodes.desc_annotation(typ, typ)
            name = match.group("name")
            params += addnodes.desc_parameter(name, name)
            signode += params
            offset = match.end()
        if offset < len(sig):
            path = sig[offset : len(sig)]
            signode += addnodes.desc_name(path, path)
        if path is None:
            assert False, "no matches for sig: %s" % sig
        fullname = self.method.upper() + " " + path
        signode["method"] = self.method
        signode["path"] = sig
        signode["fullname"] = fullname
        return (fullname, self.method, sig) 
开发者ID:apache,项目名称:couchdb-documentation,代码行数:29,代码来源:httpdomain.py

示例9: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def handle_signature(self, sig, signode):
        ret = super(PyCoroutineMixin, self).handle_signature(sig, signode)
        signode.insert(0, addnodes.desc_annotation('coroutine ', 'coroutine '))
        return ret 
开发者ID:aio-libs,项目名称:aiohttp-security,代码行数:6,代码来源:aiohttp_doctools.py

示例10: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def handle_signature(self, sig, signode):
        signode += addnodes.desc_annotation('REST type ', 'REST type ')
        signode += addnodes.desc_name(sig, sig) 
开发者ID:mozilla,项目名称:build-relengapi,代码行数:5,代码来源:apidoc.py

示例11: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def handle_signature(self, sig, signode):
        ret = super().handle_signature(sig, signode)
        signode.insert(0, addnodes.desc_annotation("coroutine ", "coroutine "))
        return ret 
开发者ID:brettcannon,项目名称:gidgethub,代码行数:6,代码来源:customization.py

示例12: make_process_header

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_annotation [as 别名]
def make_process_header(self, slug, typ, version, source_uri, description, inputs):
        """Generate a process definition header.

        :param str slug: process' slug
        :param str typ: process' type
        :param str version:  process' version
        :param str source_uri: url to the process definition
        :param str description: process' description
        :param dict inputs: process' inputs

        """
        node = addnodes.desc()
        signode = addnodes.desc_signature(slug, "")
        node.append(signode)

        node["objtype"] = node["desctype"] = typ

        signode += addnodes.desc_annotation(typ, typ, classes=["process-type"])
        signode += addnodes.desc_addname("", "")
        signode += addnodes.desc_name(slug + " ", slug + " ")

        paramlist = addnodes.desc_parameterlist()

        for field_schema, _, _ in iterate_schema({}, inputs, ""):
            field_type = field_schema["type"]
            field_name = field_schema["name"]

            field_default = field_schema.get("default", None)
            field_default = "" if field_default is None else "={}".format(field_default)

            param = addnodes.desc_parameter("", "", noemph=True)
            param += nodes.emphasis(field_type, field_type, classes=["process-type"])
            # separate by non-breaking space in the output
            param += nodes.strong(text="\xa0\xa0" + field_name)

            paramlist += param

        signode += paramlist
        signode += nodes.reference(
            "",
            nodes.Text("[Source: v{}]".format(version)),
            refuri=source_uri,
            classes=["viewcode-link"],
        )

        desc = nodes.paragraph()
        desc += nodes.Text(description, description)

        return [node, desc] 
开发者ID:genialis,项目名称:resolwe,代码行数:51,代码来源:autoprocess.py


注:本文中的sphinx.addnodes.desc_annotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。