Provide the program's entry point when directly executed.
198626
def main():
    """"""
    if len(sys.argv) < 2:
        print("Usage: {} SCOPE...".format(sys.argv[0]))
        return 1

    authenticator = prawcore.TrustedAuthenticator(
        prawcore.Requestor("prawcore_refresh_token_example"),
        os.environ["PRAWCORE_CLIENT_ID"],
        os.environ["PRAWCORE_CLIENT_SECRET"],
        os.environ["PRAWCORE_REDIRECT_URI"],
    )

    state = str(random.randint(0, 65000))
    url = authenticator.authorize_url("permanent", sys.argv[1:], state)
    print(url)

    client = receive_connection()
    data = client.recv(1024).decode("utf-8")
    param_tokens = data.split(" ", 2)[1].split("?", 1)[1].split("&")
    params = {
        key: value
        for (key, value) in [token.split("=") for token in param_tokens]
    }

    if state != params["state"]:
        send_message(
            client,
            "State mismatch. Expected: {} Received: {}".format(
                state, params["state"]
            ),
        )
        return 1
    elif "error" in params:
        send_message(client, params["error"])
        return 1

    authorizer = prawcore.Authorizer(authenticator)
    authorizer.authorize(params["code"])

    send_message(client, "Refresh token: {}".format(authorizer.refresh_token))
    return 0
440399
def main():
    """"""
    options = docopt(__doc__, version=__version__)
    if options['segment']:
        segment(
            options['<file>'],
            options['--output'],
            options['--target-duration'],
            options['--mpegts'],
        )
267010
def run(entry_point, drivers, loop = None):
    ''' 
    '''
    program = setup(entry_point, drivers)
    dispose = program.run()
    if loop == None:
        loop = asyncio.get_event_loop()

    loop.run_forever()
    dispose()
649620
def _execute(self, args, log=True):
        """"""
        if not self._ready:
            self.open_or_create()
        output = ''
        error = ''
        try:
            proc = subprocess.Popen(args, cwd=self.path, env=self.env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            output, error = proc.communicate()
            returncode = proc.returncode
            if returncode:
                raise subprocess.CalledProcessError(returncode, proc, (output, error))
            return to_text(output)
        except OSError as e:
            # raise a more meaningful error with the program name
            prog = args[0]
            if prog[0] != os.sep:
                prog = os.path.join(self.path, prog)
            raise OSError('%s: %s' % (prog, six.u(str(e))))
        except subprocess.CalledProcessError as e:
            output, error = e.output
            e.output = output
            raise e
        finally:
            if log:
                try:
                    self._write_to_log(to_text(output))
                    self._write_to_error(to_text(error))
                except NameError:
                    pass
1084108
def start(self, program, start=None, stop=None, resolution=None,
              max_delay=None):
        """"""
        params = self._get_params(start=start, stop=stop,
                                  resolution=resolution,
                                  maxDelay=max_delay)
        self._transport.start(program, params)
1261709
def p_start(self, p):
        ''''''
        p[0] = ast.Program(headers=p[1], definitions=p[2])
175868
def OnInit(self, profile=None, memoryProfile=None):
        """"""
        wx.Image.AddHandler(self.handler)
        frame = MainFrame( config_parser = load_config())
        frame.Show(True)
        self.SetTopWindow(frame)
        if profile:
            wx.CallAfter(frame.load, *[profile])
        elif sys.argv[1:]:
            if sys.argv[1] == '-m':
                if sys.argv[2:]:
                    wx.CallAfter( frame.load_memory, sys.argv[2] )
                else:
                    log.warn( 'No memory file specified' )
            else:
                wx.CallAfter(frame.load, *sys.argv[1:])
        return True
138534
def make_entry_point(patches, original_entry_point):
    
    def entry(argv=None):
        argv = argv if argv is not None else sys.argv[1:]
        return main(
            tuple(patches) + ('--', original_entry_point) + tuple(argv)
        )

    return entry
545419
def onStart(self, *args, **kwarg):
        
        with transactUI(self):
            config = self.navbar.getActiveConfig()
            config.resetErrors()
            if config.isValid():
                self.clientRunner.run(self.buildCliString())
                self.showConsole()
            else:
                config.displayErrors()
                self.Layout()
210032
def main():
        
        app = QApplication(sys.argv)
        rlbot_icon = QtGui.QIcon(os.path.join(get_rlbot_directory(), 'img', 'rlbot_icon.png'))
        app.setWindowIcon(rlbot_icon)
        window = RLBotQTGui()
        window.show()
        app.exec_()
938596
def main(_):
  """"""
  utility.set_up_logging()
  if not FLAGS.logdir or not FLAGS.outdir:
    raise KeyError('You must specify logging and outdirs directories.')
  FLAGS.logdir = os.path.expanduser(FLAGS.logdir)
  FLAGS.outdir = os.path.expanduser(FLAGS.outdir)
  visualize(
      FLAGS.logdir, FLAGS.outdir, FLAGS.num_agents, FLAGS.num_episodes,
      FLAGS.checkpoint, FLAGS.env_processes)
857913
def start_program(linker = nil)
      initialize(linker || @linker)
      init = @linker.cpu_init
      set_state(:running)
      set_pc( Position.get(init).at )
    end
252459
def main(filepath, in_debug_mode):
    """"""

    with open(filepath) as file:

        try:

            # Lexical analysis
            lexer = Lexer(file.read())

            # Syntax analysis
            parser = Parser(lexer)
            tree = parser.parse()

            # Sementic analysis
            symtab_builder = SymbolTableBuilder(tree)
            symtab_builder.build()

            # Program evaluation
            interpreter = Interpreter(tree)
            interpreter.interpret()

            # Display internal variables if debug option is enabled
            if in_debug_mode:
                print(f"SYMBOL TABLE: {symtab_builder.table}")
                print(f"GLOBAL MEMORY: {interpreter.memory}")

        except Exception as gibica_exception:

            # Display the full trace if debug option is enabled
            if in_debug_mode:
                raise

            # In classic mode, just display the interpreter trace
            else:
                print(f"{gibica_exception.__class__.__name__}: {gibica_exception}")
48024
def main(manual_args=None):
    """"""
    parser = argparse.ArgumentParser(description=main.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.set_defaults(func=parser.print_help)
    add_debug(parser)
    parser.add_argument(
        '-s',
        '--short-log',
        action='store_const',
        const=SHORT_LOGGING_FORMAT,
        default=LOGGING_FORMAT,
        help='Truncated logging format')
    parser.add_argument('-v', '--version', action='store_true', help=print_version.__doc__)

    subparsers = parser.add_subparsers(title='Commands', description='Available activies')

    add_infra(subparsers)
    add_pipeline(subparsers)
    add_rebuild(subparsers)
    add_autoscaling(subparsers)
    add_validate(subparsers)

    CliArgs = collections.namedtuple('CliArgs', ['parsed', 'extra'])

    parsed, extra = parser.parse_known_args(args=manual_args)
    args = CliArgs(parsed, extra)

    logging.basicConfig(format=args.parsed.short_log)

    package, *_ = __package__.split('.')
    logging.getLogger(package).setLevel(args.parsed.debug)

    LOG.debug('Arguments: %s', args)

    if args.parsed.version:
        args.parsed.func = print_version

    try:
        args.parsed.func(args)
    except (AttributeError, TypeError):
        args.parsed.func()
726752
def available_for_entry_point(self, entry_point):
        """"""
        if self.entry_point == ALL or entry_point == ALL:
            return True

        return entry_point in ensure_sequence(self.entry_point)
1077903
def main():
    
    setup_main_logger(console=True, file_logging=False)
    params = argparse.ArgumentParser(description="Extract specific parameters.")
    arguments.add_extract_args(params)
    args = params.parse_args()
    extract_parameters(args)
1093360
def main():
    """"""

    config = Config()

    # additional options for command line client only
    defaults = vars(config)
    defaults['to_format'] = None
    defaults['output'] = '-'
    defaults['log'] = None
    defaults['debug'] = False

    options, remainingArgs = get_option_parser(defaults).parse_args()
    for key in vars(options):
        if hasattr(config, key):
            setattr(config, key, getattr(options, key))

    # configure logging, messages to stderr by default
    logformat = '%(levelname)s: %(message)s'
    loglevel = logging.INFO
    if options.debug:
        loglevel = logging.DEBUG
    if options.log:
        logging.basicConfig(filename=options.log,
                            format=logformat, level=loglevel)
    else:
        logging.basicConfig(format=logformat, level=loglevel)

    output = options.output
    to_format = options.to_format

    # read config file as defaults and override from command line arguments
    if options.config is not None:
        config.read_and_parse_config_file(options.config)
        options, remainingArgs = get_option_parser(vars(config)).parse_args()
        for key in vars(options):
            if hasattr(config, key):
                setattr(config, key, getattr(options, key))

    if remainingArgs:
        inputfiles = remainingArgs
    else:
        inputfiles = ['-']

    voc = skosify(*inputfiles, **vars(config))
    write_rdf(voc, output, to_format)