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

Function get_file_preprocessor

Tools/c-analyzer/c_parser/preprocessor/__init__.py:107–134  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

105 ignore_exc = (lambda exc, _ig=ignore_exc: _ig)
106
107 def get_file_preprocessor(filename):
108 filename = filename.strip()
109 if file_macros:
110 macros = list(_resolve_file_values(filename, file_macros))
111 if file_includes:
112 # There's a small chance we could need to filter out any
113 # includes that import "filename". It isn't clear that it's
114 # a problem any longer. If we do end up filtering then
115 # it may make sense to use c_common.fsutil.match_path_tail().
116 includes = [i for i, in _resolve_file_values(filename, file_includes)]
117 if file_incldirs:
118 incldirs = [v for v, in _resolve_file_values(filename, file_incldirs)]
119 if file_same:
120 samefiles = _resolve_samefiles(filename, file_same)
121
122 def preprocess(**kwargs):
123 if file_macros and 'macros' not in kwargs:
124 kwargs['macros'] = macros
125 if file_includes and 'includes' not in kwargs:
126 kwargs['includes'] = includes
127 if file_incldirs and 'incldirs' not in kwargs:
128 kwargs['incldirs'] = incldirs
129 if file_same and 'samefiles' not in kwargs:
130 kwargs['samefiles'] = samefiles
131 kwargs.setdefault('filename', filename)
132 with handling_errors(ignore_exc, log_err=log_err):
133 return _preprocess(filename, **kwargs)
134 return preprocess
135 return get_file_preprocessor
136
137

Callers 1

_parse_fileFunction · 0.85

Calls 4

listClass · 0.85
_resolve_file_valuesFunction · 0.85
_resolve_samefilesFunction · 0.85
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…