Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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
def parse_event(env, sig, signode):
m = event_sig_re.match(sig)
if not m:
signode += addnodes.desc_name(sig, sig)
return sig
name, args = m.groups()
signode += addnodes.desc_name(name, name)
plist = addnodes.desc_parameterlist()
for arg in args.split(','):
arg = arg.strip()
plist += addnodes.desc_parameter(arg, arg)
signode += plist
return name
def parse_opcode_signature(env, sig, signode):
"""Transform an opcode signature into RST nodes."""
m = opcode_sig_re.match(sig)
if m is None:
raise ValueError
opname, arglist = m.groups()
signode += addnodes.desc_name(opname, opname)
paramlist = addnodes.desc_parameterlist()
signode += paramlist
paramlist += addnodes.desc_parameter(arglist, arglist)
return opname.strip()
def attach_name(self, node, name):
owner, name = name.split_owner()
varname = unicode(name)
if owner is not None:
owner = unicode(owner) + '::'
node += addnodes.desc_addname(owner, owner)
node += addnodes.desc_name(varname, varname)
def handle_signature(self, sig, signode):
# type: (str, addnodes.desc_signature) -> str
name, args = parse_directive(sig)
desc_name = '.. %s::' % name
signode += addnodes.desc_name(desc_name, desc_name)
if len(args) > 0:
signode += addnodes.desc_addname(args, args)
return name
def handle_signature(self, sig, signode):
m = py_sig_re.match(sig)
if m is None:
raise ValueError
name_prefix, name, arglist, retann = m.groups()
classname, fullname = (name_prefix.rstrip('.'), name_prefix + name) if name_prefix else ('', name)
signode['class'] = classname
signode['fullname'] = fullname
if name_prefix:
signode += addnodes.desc_addname(name_prefix, name_prefix)
signode += addnodes.desc_name(name, name)
if not arglist:
if self.needs_arglist():
signode += addnodes.desc_parameterlist()
return fullname, name_prefix
_pseudo_parse_arglist(signode, arglist)
return fullname, name_prefix
def handle_signature(self, sig, signode):
# type: (str, addnodes.desc_signature) -> str
signode += addnodes.desc_name(':%s:' % sig, ':%s:' % sig)
return sig
def make_signature(self):
"""
:rtype: List[nodes.Node]
"""
return [addnodes.desc_name(self.item.name, self.item.name)]