MCPcopy Index your code
hub / github.com/python/cpython / _parse_file

Function _parse_file

Tools/c-analyzer/c_parser/__init__.py:33–52  ·  view source on GitHub ↗
(filename, match_kind, get_file_preprocessor, maxsizes)

Source from the content-addressed store, hash-verified

31
32
33def _parse_file(filename, match_kind, get_file_preprocessor, maxsizes):
34 srckwargs = {}
35 maxsize = _resolve_max_size(filename, maxsizes)
36 if maxsize:
37 srckwargs['maxtext'], srckwargs['maxlines'] = maxsize
38
39 # Preprocess the file.
40 preprocess = get_file_preprocessor(filename)
41 preprocessed = preprocess()
42 if preprocessed is None:
43 return
44
45 # Parse the lines.
46 srclines = ((l.file, l.data) for l in preprocessed if l.kind == 'source')
47 for item in _parse(srclines, **srckwargs):
48 if match_kind is not None and not match_kind(item.kind):
49 continue
50 if not item.filename:
51 raise NotImplementedError(repr(item))
52 yield item
53
54
55def _resolve_max_size(filename, maxsizes):

Callers 3

parse_fileFunction · 0.90
parse_fileFunction · 0.85
parse_filesFunction · 0.85

Calls 5

_parseFunction · 0.90
_resolve_max_sizeFunction · 0.85
get_file_preprocessorFunction · 0.85
match_kindFunction · 0.85
preprocessFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…