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

Function split_arguments

numpy/core/code_generators/genapi.py:186–214  ·  view source on GitHub ↗
(argstr)

Source from the content-addressed store, hash-verified

184 raise ValueError("no match '%s' for '%s' (%r)" % (lbrac, rbrac, s))
185
186def split_arguments(argstr):
187 arguments = []
188 current_argument = []
189 i = 0
190 def finish_arg():
191 if current_argument:
192 argstr = ''.join(current_argument).strip()
193 m = re.match(r'(.*(\s+|\*))(\w+)$', argstr)
194 if m:
195 typename = m.group(1).strip()
196 name = m.group(3)
197 else:
198 typename = argstr
199 name = ''
200 arguments.append((typename, name))
201 del current_argument[:]
202 while i < len(argstr):
203 c = argstr[i]
204 if c == ',':
205 finish_arg()
206 elif c == '(':
207 p = skip_brackets(argstr[i:], '(', ')')
208 current_argument += argstr[i:i+p]
209 i += p-1
210 else:
211 current_argument += c
212 i += 1
213 finish_arg()
214 return arguments
215
216
217def find_functions(filename, tag='API'):

Callers 1

find_functionsFunction · 0.85

Calls 2

finish_argFunction · 0.85
skip_bracketsFunction · 0.85

Tested by

no test coverage detected