MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / main

Function main

tools/python-3.11.9-amd64/Lib/ast.py:1727–1749  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1725
1726
1727def main():
1728 import argparse
1729
1730 parser = argparse.ArgumentParser(prog='python -m ast')
1731 parser.add_argument('infile', type=argparse.FileType(mode='rb'), nargs='?',
1732 default='-',
1733 help='the file to parse; defaults to stdin')
1734 parser.add_argument('-m', '--mode', default='exec',
1735 choices=('exec', 'single', 'eval', 'func_type'),
1736 help='specify what kind of code must be parsed')
1737 parser.add_argument('--no-type-comments', default=True, action='store_false',
1738 help="don't add information about type comments")
1739 parser.add_argument('-a', '--include-attributes', action='store_true',
1740 help='include attributes such as line numbers and '
1741 'column offsets')
1742 parser.add_argument('-i', '--indent', type=int, default=3,
1743 help='indentation of nodes (number of spaces)')
1744 args = parser.parse_args()
1745
1746 with args.infile as infile:
1747 source = infile.read()
1748 tree = parse(source, args.infile.name, args.mode, type_comments=args.no_type_comments)
1749 print(dump(tree, include_attributes=args.include_attributes, indent=args.indent))
1750
1751if __name__ == '__main__':
1752 main()

Callers 1

ast.pyFile · 0.70

Calls 6

parse_argsMethod · 0.95
parseFunction · 0.70
dumpFunction · 0.70
printFunction · 0.50
add_argumentMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected