MCPcopy Index your code
hub / github.com/numpy/numpy / parse_structure

Function parse_structure

numpy/f2py/_src_pyf.py:55–80  ·  view source on GitHub ↗

Return a list of tuples for each function or subroutine each tuple is the start and end of a subroutine or function to be expanded.

(astr)

Source from the content-addressed store, hash-verified

53function_start_re = re.compile(r'\n (\$|\*)\s*function\b', re.I)
54
55def parse_structure(astr):
56 """ Return a list of tuples for each function or subroutine each
57 tuple is the start and end of a subroutine or function to be
58 expanded.
59 """
60
61 spanlist = []
62 ind = 0
63 while True:
64 m = routine_start_re.search(astr, ind)
65 if m is None:
66 break
67 start = m.start()
68 if function_start_re.match(astr, start, m.end()):
69 while True:
70 i = astr.rfind('\n', ind, start)
71 if i == -1:
72 break
73 start = i
74 if astr[i:i + 7] != '\n $':
75 break
76 start += 1
77 m = routine_end_re.search(astr, m.end())
78 ind = end = (m and m.end() - 1) or len(astr)
79 spanlist.append((start, end))
80 return spanlist
81
82
83template_re = re.compile(r"<\s*(\w[\w\d]*)\s*>")

Callers 1

process_strFunction · 0.70

Calls 1

rfindMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…