MCPcopy Create free account
hub / github.com/numpy/numpy / listrepl

Function listrepl

numpy/f2py/_src_pyf.py:132–143  ·  view source on GitHub ↗
(mobj)

Source from the content-addressed store, hash-verified

130 substr = named_re.sub(r"<\1>", substr) # get rid of definition templates
131
132 def listrepl(mobj):
133 thelist = conv(mobj.group(1).replace(r'\,', '@comma@'))
134 if template_name_re.match(thelist):
135 return "<%s>" % (thelist)
136 name = None
137 for key in lnames.keys(): # see if list is already in dictionary
138 if lnames[key] == thelist:
139 name = key
140 if name is None: # this list is not in the dictionary yet
141 name = unique_key(lnames)
142 lnames[name] = thelist
143 return "<%s>" % name
144
145 substr = list_re.sub(listrepl, substr) # convert all lists to named templates
146 # newnames are constructed as needed

Callers

nothing calls this directly

Calls 4

replaceMethod · 0.80
keysMethod · 0.80
convFunction · 0.70
unique_keyFunction · 0.70

Tested by

no test coverage detected