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

Function collect_stats

tools/c_coverage/c_coverage_report.py:116–139  ·  view source on GitHub ↗
(files, fd, pattern)

Source from the content-addressed store, hash-verified

114
115
116def collect_stats(files, fd, pattern):
117 # TODO: Handle compressed callgrind files
118 line_regexs = [
119 re.compile(r"(?P<lineno>[0-9]+)(\s[0-9]+)+"),
120 re.compile(r"((jump)|(jcnd))=([0-9]+)\s(?P<lineno>[0-9]+)")
121 ]
122
123 current_file = None
124 current_function = None
125 for line in fd:
126 if re.match(r"f[lie]=.+", line):
127 path = line.split('=', 2)[1].strip()
128 if os.path.exists(path) and re.search(pattern, path):
129 current_file = files.get_file(path)
130 else:
131 current_file = None
132 elif re.match(r"fn=.+", line):
133 current_function = line.split('=', 2)[1].strip()
134 elif current_file is not None:
135 for regex in line_regexs:
136 match = regex.match(line)
137 if match:
138 lineno = int(match.group('lineno'))
139 current_file.mark_line(lineno, current_function)
140
141
142if __name__ == '__main__':

Callers 1

Calls 6

stripMethod · 0.80
splitMethod · 0.80
get_fileMethod · 0.80
mark_lineMethod · 0.80
compileMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…