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


Python addnodes.desc_parameter方法代码示例

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


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

示例1: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_parameter [as 别名]
def handle_signature(self, sig, signode):
		m = re.match(r'([a-zA-Z0-9_/\(\):]+)\(([a-zA-Z0-9,\'"_= ]*)\)', sig)
		if not m:
			signode += addnodes.desc_name(sig, sig)
			return sig
		uri_path, args = m.groups()
		signode += addnodes.desc_name(uri_path, uri_path)
		plist = DescRPCArgumentList()
		args = args.split(',')
		for pos, arg in enumerate(args):
			arg = arg.strip()
			if pos < len(args) - 1:
				arg += ','
			x = DescRPCArgument()
			x += addnodes.desc_parameter(arg, arg)
			plist += x
		signode += plist
		return uri_path 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:20,代码来源:rpc.py

示例2: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_parameter [as 别名]
def handle_signature(self, sig, signode):
		match = re.match(r'(?P<name>[a-zA-Z0-9]+)(\((?P<arguments>[a-z_0-9]+(, +[a-z_0-9]+)*)\))?', sig)
		field_name = match.group('name')
		if 'gql:object' in self.env.ref_context:
			full_name = self.env.ref_context['gql:object'] + '.' + field_name
		else:
			full_name = field_name
		signode += addnodes.desc_name(field_name, field_name)
		arguments = match.group('arguments')
		if arguments:
			plist = DescGraphQLFieldArgumentList()
			arguments = arguments.split(',')
			for pos, arg in enumerate(arguments):
				arg = arg.strip()
				if pos < len(arguments) - 1:
					arg += ','
				x = DescGraphQLFieldArgument()
				x += addnodes.desc_parameter(arg, arg)
				plist += x
			signode += plist
		return full_name 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:23,代码来源:graphql.py

示例3: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_parameter [as 别名]
def handle_signature(self, sig, signode):
		match = re.match(r'(?P<name>[a-z0-9_]+)(\((?P<arguments>[a-z_0-9]+(, +[a-z_0-9]+)*)\))?', sig)
		field_name = match.group('name')
		if 'db:table' in self.env.ref_context:
			full_name = self.env.ref_context['db:table'] + '.' + field_name
		else:
			full_name = field_name
		signode += addnodes.desc_name(field_name, field_name)
		arguments = match.group('arguments')
		if arguments:
			plist = DescDatabaseFieldArgumentList()
			arguments = arguments.split(',')
			for pos, arg in enumerate(arguments):
				arg = arg.strip()
				if pos < len(arguments) - 1:
					arg += ','
				x = DescDatabaseFieldArgument()
				x += addnodes.desc_parameter(arg, arg)
				plist += x
			signode += plist
		return full_name 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:23,代码来源:database.py

示例4: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_parameter [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

示例5: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_parameter [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

示例6: handle_signature

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_parameter [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

示例7: append_parameters

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_parameter [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

示例8: visit_desc_parameterlist

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_parameter [as 别名]
def visit_desc_parameterlist(self, node):
        self.body.append('(')  # by default sphinx puts <big> around the "("
        self.first_param = 1
        self.optional_param_level = 0
        self.param_separator = node.child_text_separator
        self.required_params_left = sum([isinstance(c, addnodes.desc_parameter)
                                         for c in node.children]) 
开发者ID:nitmir,项目名称:django-cas-server,代码行数:9,代码来源:djangodocs.py

示例9: make_process_header

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_parameter [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

示例10: _parse_arglist

# 需要导入模块: from sphinx import addnodes [as 别名]
# 或者: from sphinx.addnodes import desc_parameter [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_parameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。