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

Function main

Lib/trace.py:604–746  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

602 callers=self._callers)
603
604def main():
605 import argparse
606
607 parser = argparse.ArgumentParser(color=True)
608 parser.add_argument('--version', action='version', version='trace 2.0')
609
610 grp = parser.add_argument_group('Main options',
611 'One of these (or --report) must be given')
612
613 grp.add_argument('-c', '--count', action='store_true',
614 help='Count the number of times each line is executed and write '
615 'the counts to <module>.cover for each module executed, in '
616 'the module\'s directory. See also --coverdir, --file, &#x27;
617 '--no-report below.')
618 grp.add_argument('-t', '--trace', action='store_true',
619 help='Print each line to sys.stdout before it is executed')
620 grp.add_argument('-l', '--listfuncs', action='store_true',
621 help='Keep track of which functions are executed at least once '
622 'and write the results to sys.stdout after the program exits. '
623 'Cannot be specified alongside --trace or --count.')
624 grp.add_argument('-T', '--trackcalls', action='store_true',
625 help='Keep track of caller/called pairs and write the results to '
626 'sys.stdout after the program exits.')
627
628 grp = parser.add_argument_group('Modifiers')
629
630 _grp = grp.add_mutually_exclusive_group()
631 _grp.add_argument('-r', '--report', action='store_true',
632 help='Generate a report from a counts file; does not execute any '
633 'code. --file must specify the results file to read, which '
634 'must have been created in a previous run with --count '
635 '--file=FILE')
636 _grp.add_argument('-R', '--no-report', action='store_true',
637 help='Do not generate the coverage report files. '
638 'Useful if you want to accumulate over several runs.')
639
640 grp.add_argument('-f', '--file',
641 help='File to accumulate counts over several runs')
642 grp.add_argument('-C', '--coverdir',
643 help='Directory where the report files go. The coverage report '
644 'for <package>.<module> will be written to file '
645 '<dir>/<package>/<module>.cover')
646 grp.add_argument('-m', '--missing', action='store_true',
647 help='Annotate executable lines that were not executed with '
648 '">>>>>> "')
649 grp.add_argument('-s', '--summary', action='store_true',
650 help='Write a brief summary for each file to sys.stdout. '
651 'Can only be used with --count or --report')
652 grp.add_argument('-g', '--timing', action='store_true',
653 help='Prefix each line with the time since the program started. '
654 'Only used while tracing')
655
656 grp = parser.add_argument_group('Filters',
657 'Can be specified multiple times')
658 grp.add_argument('--ignore-module', action='append', default=[],
659 help='Ignore the given module(s) and its submodules '
660 '(if it is a package). Accepts comma separated list of '
661 'module names.')

Callers 1

trace.pyFile · 0.70

Calls 15

parse_argsMethod · 0.95
errorMethod · 0.95
write_resultsMethod · 0.95
runctxMethod · 0.95
resultsMethod · 0.95
parse_ignore_dirFunction · 0.85
CoverageResultsClass · 0.85
anyFunction · 0.70
TraceClass · 0.70
compileFunction · 0.70
add_argumentMethod · 0.45
add_argument_groupMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…