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

Function parse_values

numpy/distutils/conv_template.py:142–151  ·  view source on GitHub ↗
(astr)

Source from the content-addressed store, hash-verified

140parenrep = re.compile(r"\(([^)]*)\)\*(\d+)")
141plainrep = re.compile(r"([^*]+)\*(\d+)")
142def parse_values(astr):
143 # replaces all occurrences of '(a,b,c)*4' in astr
144 # with 'a,b,c,a,b,c,a,b,c,a,b,c'. Empty braces generate
145 # empty values, i.e., ()*4 yields ',,,'. The result is
146 # split at ',' and a list of values returned.
147 astr = parenrep.sub(paren_repl, astr)
148 # replaces occurrences of xxx*3 with xxx, xxx, xxx
149 astr = ','.join([plainrep.sub(paren_repl, x.strip())
150 for x in astr.split(',')])
151 return astr.split(',')
152
153
154stripast = re.compile(r"\n\s*\*?")

Callers 1

parse_loop_headerFunction · 0.85

Calls 3

stripMethod · 0.80
joinMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected