當前位置: 首頁>>代碼示例>>Python>>正文


Python addnodes.desc_parameterlist方法代碼示例

本文整理匯總了Python中sphinx.addnodes.desc_parameterlist方法的典型用法代碼示例。如果您正苦於以下問題:Python addnodes.desc_parameterlist方法的具體用法?Python addnodes.desc_parameterlist怎麽用?Python addnodes.desc_parameterlist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sphinx.addnodes的用法示例。


在下文中一共展示了addnodes.desc_parameterlist方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: handle_signature

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_parameterlist [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_parameterlist [as 別名]
def handle_signature(self, sig, signode):
        """Transform a PicoBlaze signature into RST nodes."""
        
        m = pb_sig_re.match(sig)
        if m is None:
            raise ValueError('no match')
        name, arglist = m.groups()
        
        signode += addnodes.desc_name(name, name)

        if not arglist:
            if self.objtype in ('function', 'macro'):
                # for functions and macros, add an empty parameter list
                signode += addnodes.desc_parameterlist()
                self.env.domains['pb'].data['has_params'][name] = False
            return name

        _parse_arglist(signode, arglist)
        
        self.env.domains['pb'].data['has_params'][name] = True
        
        return name 
開發者ID:kevinpt,項目名稱:opbasm,代碼行數:24,代碼來源:pbDomain.py

示例3: handle_signature

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_parameterlist [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

示例4: handle_signature

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_parameterlist [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

示例5: append_parameters

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_parameterlist [as 別名]
def append_parameters(self, node, params):
        pnodes = addnodes.desc_parameterlist()
        for param in params:
            pnode = addnodes.desc_parameter('', '', noemph=True)

            self.append_modifiers(pnode, param.modifiers)

            self.append_type(pnode, param.typ)
            pnode += nodes.Text(u' ')
            pnode += nodes.emphasis(param.name, param.name)
            if param.default is not None:
                default = u' = ' + param.default
                pnode += nodes.emphasis(default, default)
            pnodes += pnode
        node += pnodes 
開發者ID:djungelorm,項目名稱:sphinx-csharp,代碼行數:17,代碼來源:csharp.py

示例6: make_process_header

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_parameterlist [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

示例7: _parse_arglist

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_parameterlist [as 別名]
def _parse_arglist(signode, arglist):
    """"Parse" a list of arguments separated by commas.

    Arguments can have "optional" annotations given by enclosing them in
    brackets.  Currently, this will split at any comma, even if it's inside a
    string literal (e.g. default argument value).
    """
    paramlist = addnodes.desc_parameterlist()
    stack = [paramlist]
    try:
        for argument in arglist.split(','):
            argument = argument.strip()
            ends_open = ends_close = 0
            while argument.startswith('['):
                stack.append(addnodes.desc_optional())
                stack[-2] += stack[-1]
                argument = argument[1:].strip()
            while argument.startswith(']'):
                stack.pop()
                argument = argument[1:].strip()
            while argument.endswith(']') and not argument.endswith('[]'):
                ends_close += 1
                argument = argument[:-1].strip()
            while argument.endswith('['):
                ends_open += 1
                argument = argument[:-1].strip()
            if argument:
                stack[-1] += addnodes.desc_parameter(argument, argument)
            while ends_open:
                stack.append(addnodes.desc_optional())
                stack[-2] += stack[-1]
                ends_open -= 1
            while ends_close:
                stack.pop()
                ends_close -= 1
        if len(stack) != 1:
            raise IndexError
    except IndexError:
        # if there are too few or too many elements on the stack, just give up
        # and treat the whole argument list as one argument, discarding the
        # already partially populated paramlist node
        signode += addnodes.desc_parameterlist()
        signode[-1] += addnodes.desc_parameter(arglist, arglist)
    else:
        signode += paramlist 
開發者ID:kevinpt,項目名稱:opbasm,代碼行數:47,代碼來源:pbDomain.py


注:本文中的sphinx.addnodes.desc_parameterlist方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。