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

Function cmd_data

Tools/c-analyzer/c_analyzer/__main__.py:435–468  ·  view source on GitHub ↗
(datacmd, filenames, known=None, *,
             _analyze=_analyze,
             formats=FORMATS,
             extracolumns=None,
             relroot=fsutil.USE_CWD,
             track_progress=None,
             **kwargs
             )

Source from the content-addressed store, hash-verified

433
434
435def cmd_data(datacmd, filenames, known=None, *,
436 _analyze=_analyze,
437 formats=FORMATS,
438 extracolumns=None,
439 relroot=fsutil.USE_CWD,
440 track_progress=None,
441 **kwargs
442 ):
443 kwargs.pop('verbosity', None)
444 usestdout = kwargs.pop('show', None)
445 if datacmd == 'show':
446 do_fmt = formats['summary']
447 if isinstance(known, str):
448 known, _ = _datafiles.get_known(known, extracolumns, relroot)
449 for line in do_fmt(known):
450 print(line)
451 elif datacmd == 'dump':
452 filenames, relroot = fsutil.fix_filenames(filenames, relroot=relroot)
453 if track_progress:
454 filenames = track_progress(filenames)
455 analyzed = _analyze(filenames, **kwargs)
456 analyzed.fix_filenames(relroot, normalize=False)
457 if known is None or usestdout:
458 outfile = io.StringIO()
459 _datafiles.write_known(analyzed, outfile, extracolumns,
460 relroot=relroot)
461 print(outfile.getvalue())
462 else:
463 _datafiles.write_known(analyzed, known, extracolumns,
464 relroot=relroot)
465 elif datacmd == 'check':
466 raise NotImplementedError(datacmd)
467 else:
468 raise ValueError(f'unsupported data command {datacmd!r}')
469
470
471COMMANDS = {

Callers

nothing calls this directly

Calls 3

getvalueMethod · 0.95
fix_filenamesMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…