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


Python addnodes.desc_name方法代碼示例

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


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

示例1: handle_signature

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

示例6: handle_signature

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_name [as 別名]
def handle_signature(self, sig, signode):
        if "::" in sig:
            name, descr = map(lambda i: i.strip(), sig.split("::"))
        else:
            name, descr = sig.strip(), ""

        signode["name"] = name
        signode["descr"] = descr

        domain, objtype = self.name.split(":")
        if objtype == "section":
            self.env.temp_data["section"] = signode["name"]
            name = "[%s]" % signode["name"]

        signode += addnodes.desc_name(name, name)

        return signode["name"] 
開發者ID:apache,項目名稱:couchdb-documentation,代碼行數:19,代碼來源:configdomain.py

示例7: handle_signature

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

示例8: handle_signature

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

示例9: handle_signature

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

示例10: handle_signature

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_name [as 別名]
def handle_signature(self, sig, signode):
		signode.clear()
		signode += addnodes.desc_name(sig, sig)
		return ws_re.sub('', sig) 
開發者ID:rsmusllp,項目名稱:king-phisher,代碼行數:6,代碼來源:_exttools.py

示例11: handle_signature

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

示例12: handle_signature

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

示例13: get_sections_and_signature

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_name [as 別名]
def get_sections_and_signature(need_info):
    """Gets the hierarchy of the section nodes as a list starting at the
    section of the current need and then its parent sections"""
    sections = []
    signature = None
    current_node = need_info['target_node']
    while current_node:
        if isinstance(current_node, nodes.section):
            title = current_node.children[0].astext()
            # If using auto-section numbering, then Sphinx inserts
            # multiple non-breaking space unicode characters into the title
            # we'll replace those with a simple space to make them easier to
            # use in filters
            title = NON_BREAKING_SPACE.sub(' ', title)
            sections.append(title)

        # Checking for a signature defined "above" the need.
        # Used and set normally by directives like automodule.
        # Only check as long as we haven't found a signature
        if signature is None and current_node.parent is not None and current_node.parent.children is not None:
            for sibling in current_node.parent.children:
                # We want to check only "above" current node, so no need to check sibling after current_node.
                if sibling == current_node:
                    break
                if isinstance(sibling, desc_signature):
                    # Check the child of the found signature for the text content/node.
                    for desc_child in sibling.children:
                        if isinstance(desc_child, desc_name) and \
                                isinstance(desc_child.children[0], nodes.Text):
                            signature = desc_child.children[0]
                if signature is not None:
                    break

        current_node = getattr(current_node, 'parent', None)
    return sections, signature 
開發者ID:useblocks,項目名稱:sphinxcontrib-needs,代碼行數:37,代碼來源:need.py

示例14: handle_signature

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

示例15: parse_django_admin_node

# 需要導入模塊: from sphinx import addnodes [as 別名]
# 或者: from sphinx.addnodes import desc_name [as 別名]
def parse_django_admin_node(env, sig, signode):
    command = sig.split(' ')[0]
    env.ref_context['std:program'] = command
    title = "django-admin %s" % sig
    signode += addnodes.desc_name(title, title)
    return command 
開發者ID:nitmir,項目名稱:django-cas-server,代碼行數:8,代碼來源:djangodocs.py


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