Every line of 'python main args' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
16 def main(argv): 17 pnacl_driver.env.set('IS_CXX', '1') 18 return pnacl_driver.main(argv)
16 def main(argv): 17 pnacl_driver.env.set('IS_CXX', '0') 18 return pnacl_driver.main(argv)
153 def main(): 154 parser = get_parser() 155 156 if len(sys.argv) == 1: 157 parser.print_help(sys.stderr) 158 sys.exit(1) 159 160 parser.parse_args()
11 def main(args): 12 replace_in_file('setup.py', "setup_requires=['pytest-runner'],", '') 13 python_build() 14 python_install()
66 def main(): 67 parser = argparse.ArgumentParser( 68 description='Run codechecks and optionally reformat the code.') 69 parser.add_argument( 70 '--reformat', 71 dest='reformat', 72 action='store_true', 73 default=False, 74 help='Reformat the code.') 75 args = parser.parse_args() 76 77 # Get a list of all the files in this repository: 78 files = _decode_terminal_output( 79 subprocess.check_output(['git', 'ls-files'])).split('\n') 80 81 # Ignore files taken and modified from llvm/clang as reformatting makes 82 # upstreaming changes hard. 83 ignored_directories = [os.path.join('ffig', 'clang')] 84 files = [f for f in files if os.path.dirname(f) not in ignored_directories] 85 86 # Collect the result of each stage. 87 results = [] 88 89 # Run language-specific checks on subsets of the file list: 90 results.append( 91 python_checks( 92 filter( 93 is_python_file, 94 files), 95 reformat=args.reformat)) 96 97 if False in results: 98 log.error('Checks failed') 99 sys.exit(1) 100 else: 101 log.info('Checks passed') 102 sys.exit(0)
434 def main(): 435 """Main function""" 436 # Create command line argument parser 437 parser = argparse.ArgumentParser( 438 description=USAGE, 439 formatter_class=argparse.RawTextHelpFormatter, 440 ) 441 parser.add_argument( 442 'section', nargs="+", 443 help='one or more sections to run, see possible values above', 444 ) 445 args = parser.parse_args() 446 447 # Form the list of sections to run 448 sections = [] 449 for section in args.section: 450 if section == 'all': 451 sections += ALL 452 else: 453 sections.append(section) 454 455 # Run the sections 456 results = [] 457 for section in sections: 458 if section not in ALL_AVAILABLE_SECTIONS: 459 message = ('The sections "{}" is not the set of ' 460 'ALL_AVAILABLE_SECTIONS'.format(section)) 461 logging.error('ERROR ' + message) 462 raise RuntimeError(message) 463 function = globals()[section] 464 results.append((section, function())) 465 466 # Print out a summary 467 echo('\n######## SUMMARY ########') 468 for section, section_results in results: 469 echo() 470 echo("SECTION: " + section) 471 for section_result in section_results: 472 echo("{:.<20} {}".format(*section_result)) 473 echo('\n######## SUMMARY END ####')
12 def main(): 13 args = parse_argv() 14 remaining = args.count 15 while remaining: 16 chunk = stdin.read(1024) 17 if not chunk: 18 break 19 output = chunk[:remaining] if remaining < len(chunk) else chunk 20 remaining -= len(output) 21 stdout.write(output)
281 def main(argv): 282 parser = argparse.ArgumentParser() 283 284 parser.add_argument('output_file', nargs='?', default=None) 285 parser.add_argument('--html', dest='use_html', action='store_true') 286 parser.set_defaults(func=pathtree_argparse) 287 288 args = parser.parse_args(argv) 289 args.func(args)
25 def main(): 26 parser = argparse.ArgumentParser(prog='python -m pybind11') 27 parser.add_argument('--includes', action='store_true', 28 help='Include flags for both pybind11 and Python headers.') 29 args = parser.parse_args() 30 if not sys.argv[1:]: 31 parser.print_help() 32 if args.includes: 33 print_includes()
81 def main(): 82 # parse command line 83 args = get_options() 84 85 print(PyQtConfig('PyQt%d' % args.version)) 86 return 0