MCPcopy Create free account
hub / github.com/python/cpython / cmd_data

Function cmd_data

Tools/c-analyzer/cpython/__main__.py:201–254  ·  view source on GitHub ↗
(datacmd, **kwargs)

Source from the content-addressed store, hash-verified

199
200
201def cmd_data(datacmd, **kwargs):
202 formats = dict(c_analyzer.FORMATS)
203 formats['summary'] = fmt_summary
204 filenames = (file
205 for file in _resolve_filenames(None)
206 if file not in _parser.EXCLUDED)
207 kwargs['get_file_preprocessor'] = _parser.get_preprocessor(log_err=print)
208 if datacmd == 'show':
209 types = _analyzer.read_known()
210 results = []
211 for decl, info in types.items():
212 if info is UNKNOWN:
213 if decl.kind in (KIND.STRUCT, KIND.UNION):
214 extra = {'unsupported': ['type unknown'] * len(decl.members)}
215 else:
216 extra = {'unsupported': ['type unknown']}
217 info = (info, extra)
218 results.append((decl, info))
219 if decl.shortkey == 'struct _object':
220 tempinfo = info
221 known = _analyzer.Analysis.from_results(results)
222 analyze = None
223 elif datacmd == 'dump':
224 known = _analyzer.KNOWN_FILE
225 def analyze(files, **kwargs):
226 decls = []
227 for decl in _analyzer.iter_decls(files, **kwargs):
228 if not KIND.is_type_decl(decl.kind):
229 continue
230 if not decl.filename.endswith('.h'):
231 if decl.shortkey not in _analyzer.KNOWN_IN_DOT_C:
232 continue
233 decls.append(decl)
234 results = _c_analyzer.analyze_decls(
235 decls,
236 known={},
237 analyze_resolved=_analyzer.analyze_resolved,
238 )
239 return _analyzer.Analysis.from_results(results)
240 else: # check
241 known = _analyzer.read_known()
242 def analyze(files, **kwargs):
243 return _analyzer.iter_decls(files, **kwargs)
244 extracolumns = None
245 c_analyzer.cmd_data(
246 datacmd,
247 filenames,
248 known,
249 _analyze=analyze,
250 formats=formats,
251 extracolumns=extracolumns,
252 relroot=REPO_ROOT,
253 **kwargs
254 )
255
256
257def _cli_capi(parser):

Callers

nothing calls this directly

Calls 4

_resolve_filenamesFunction · 0.85
from_resultsMethod · 0.80
itemsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…