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

Function listrepl

numpy/distutils/from_template.py:136–147  ·  view source on GitHub ↗
(mobj)

Source from the content-addressed store, hash-verified

134 substr = named_re.sub(r"<\1>", substr) # get rid of definition templates
135
136 def listrepl(mobj):
137 thelist = conv(mobj.group(1).replace(r'\,', '@comma@'))
138 if template_name_re.match(thelist):
139 return "<%s>" % (thelist)
140 name = None
141 for key in lnames.keys(): # see if list is already in dictionary
142 if lnames[key] == thelist:
143 name = key
144 if name is None: # this list is not in the dictionary yet
145 name = unique_key(lnames)
146 lnames[name] = thelist
147 return "<%s>" % name
148
149 substr = list_re.sub(listrepl, substr) # convert all lists to named templates
150 # 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