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

Function cmd_preprocess

Tools/c-analyzer/c_parser/preprocessor/__main__.py:89–116  ·  view source on GitHub ↗
(filenames, *,
                   raw=False,
                   iter_filenames=None,
                   **kwargs
                   )

Source from the content-addressed store, hash-verified

87
88
89def cmd_preprocess(filenames, *,
90 raw=False,
91 iter_filenames=None,
92 **kwargs
93 ):
94 if 'get_file_preprocessor' not in kwargs:
95 kwargs['get_file_preprocessor'] = _get_preprocessor()
96 if raw:
97 def show_file(filename, lines):
98 for line in lines:
99 print(line)
100 #print(line.raw)
101 else:
102 def show_file(filename, lines):
103 for line in lines:
104 linefile = ''
105 if line.filename != filename:
106 linefile = f' ({line.filename})'
107 text = line.data
108 if line.kind == 'comment':
109 text = '/* ' + line.data.splitlines()[0]
110 text += ' */' if '\n' in line.data else r'\n... */'
111 print(f' {line.lno:>4} {line.kind:10} | {text}')
112
113 filenames = main_for_filenames(filenames, iter_filenames)
114 for filename in filenames:
115 lines = _iter_preprocessed(filename, **kwargs)
116 show_file(filename, lines)
117
118
119def _cli_data(parser):

Callers

nothing calls this directly

Calls 4

main_for_filenamesFunction · 0.90
_iter_preprocessedFunction · 0.85
show_fileFunction · 0.85
_get_preprocessorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…