The main method.
184251
def main(argv=sys.argv[1:]):
    """"""

    global ext_lang

    parser = argparse.ArgumentParser(description=description,
                                     epilog=epilog)
    parser.add_argument('files', metavar='FILES', nargs='*',
                        help='the files to process')
    parser.add_argument('--version', action='version', version=version)
    parser.add_argument('-i', '--in-place', action='store_true',
                        help='modify files inplace')
    parser.add_argument('--print-langs', action='store_true',
                        help='print out all the supported languages')
    parser.add_argument('--lang', action='store', default='auto',
                        help='use the language with given extention')
    args = parser.parse_args(argv)

    # Print the current set of working languages.
    if args.print_langs:
        parser.print_usage()
        sys.stdout.write('\n')
        sys.stdout.write(textwrap.fill(textwrap.dedent("""\
        The following languages are supported:
        """)) + '\n')
        for cls in sorted({getattr(langs, nm) for nm in langs.__all__}):
            l = cls.__name__
            out = cls.__doc__.split('\n\n')[0]
            out = out + ' (' + ', '.join(cls.ext) + ')'

            prefix2 = ' '.join([''] * 20)
            prefix1 = prefix2[:2] + l + prefix2[2 + len(l):]

            wrapped = textwrap.fill(out, initial_indent=prefix1,
                                    subsequent_indent=prefix2)

            sys.stdout.write(wrapped + '\n')

        parser.exit(0)          # Exit once we're done

    if not args.files:
        parser.print_usage()

    for fname in args.files:
        # load the file
        with open(fname) as f:
            text = f.read()

        # generate the new output according to the language
        if args.lang == 'auto':
            l = language(fname)
        else:
            l = language(args.lang, True)
        text = l.gen(text)

        # emit the output
        if args.in_place:
            with open(fname, 'w') as f:
                f.write(text)
        else:
            sys.stdout.write(text)
547916
def main(self):
        
        self.loop = urwid.MainLoop(self.top, self.palettes[self.palette_names[0]], screen=self.tui,
                                   handle_mouse=False, input_filter=self.handle_keys,
                                   unhandled_input=self.unhandled)
        self.loop.run()
741767
public function main()
    {
        // Check if all required data is present.
        $this->checkRequirements();

        if ($this->_drushDir == '/sites/all/drush') {
            $drushDir = $this->_siteRoot.$this->_drushDir;
        } else {
            $drushDir = $this->_drushDir;
        }

        $aliasesFile = $drushDir.'/aliases.drushrc.php';

        $aliases = array(
            'default' => array(
                'uri'  => $this->_siteUrl,
                'root' => $this->_siteRoot,
            ),
            'docker' => array(
                'uri'  => $this->_siteUrl,
                'root' => $this->_siteRoot,
            ),
        );

        if (empty($this->_aliasName)) {
            $sites = new Finder();
            $sites
                ->directories()
                ->depth('== 0')
                ->exclude('all')
                ->in($this->_siteRoot.'/sites');

            foreach ($sites as $site) {
                $aliases[$site->getBasename()] = array(
                   'uri'  => $this->_siteUrl,
                   'root' => $aliases['default']['root'],
                );
            }
        } else {
            $aliases += $this->loadAliases($aliasesFile);
            $aliases[$this->_aliasName] = array(
                'uri'  => $this->_siteUrl,
                'root' => $aliases['default']['root'],
            );
        }//end if

        $aliasesArray = "<?php \n\n\$aliases = ".var_export($aliases, true).";";

        if (file_put_contents($aliasesFile, $aliasesArray)) {
            $this->log(
                "Succesfully wrote aliases to file '".$aliasesFile."'",
                Project::MSG_INFO
            );
        } else {
            $this->log(
                "Was unable to write aliases to file '".$aliasesFile."'",
                Project::MSG_WARN
            );
        }
    }
1083958
def main(self, main):
    
    if not main or not isinstance(main, string_types):
      raise ValueError('The main entry must be a non-empty string')
    self._main = main
953748
private void handleMainMethodIfPresent(List methods) {
        boolean found = false;
        for (Iterator iter = methods.iterator(); iter.hasNext();) {
            MethodNode node = (MethodNode) iter.next();
            if(node.getName().equals("main")) {
                if (node.isStatic() && node.getParameters().length == 1) {
                    boolean retTypeMatches, argTypeMatches;
                    ClassNode argType = node.getParameters()[0].getType();
                    ClassNode retType = node.getReturnType();

                    argTypeMatches = (argType.equals(ClassHelper.OBJECT_TYPE) || argType.getName().contains("String[]"));
                    retTypeMatches = (retType == ClassHelper.VOID_TYPE || retType == ClassHelper.OBJECT_TYPE);
                    
                    if(retTypeMatches && argTypeMatches) {
                        if(found) {
                            throw new RuntimeException("Repetitive main method found.");
                        } else {
                            found = true;
                        }
                        // if script has both loose statements as well as main(), then main() is ignored
                        if(statementBlock.isEmpty()) {
                            addStatement(node.getCode());
                        }
                        iter.remove();
                    }
                }
            }
        }
    }
1276699
public function main()
	{
		$this->addProperty('yii.version',$this->getYiiVersion());
		$this->addProperty('yii.revision',$this->getYiiRevision());
		$this->addProperty('yii.winbuild', substr(PHP_OS, 0, 3) == 'WIN' ? 'true' : 'false');
		$this->addProperty('yii.release',$this->getYiiRelease());
		$this->addProperty('yii.date',date('M j, Y'));
	}
1253083
public function main()
    {
        $this->setup();
        while (!$this->eos()) {
            $p = $this->pos();
            $state = $this->stateName();

            $this->loadTransitions();
            list($nextPatternData, $nextPatternIndex, $nextPatternMatches) = $this->nextStartData();
            list($endIndex, $endMatches) = $this->nextEndData();

            if (($nextPatternIndex <= $endIndex || $endIndex === -1) && $nextPatternIndex !== -1) {
                // we're pushing a new state
                if ($p < $nextPatternIndex) {
                    $this->recordRange($p, $nextPatternIndex);
                }
                $newPos = $nextPatternIndex;
                $this->pos($newPos);
                $tok = $nextPatternData[0];
                if (isset($this->overrides[$tok])) {
                    // call override
                    $ret = call_user_func($this->overrides[$tok], $nextPatternMatches);
                    if ($ret === true) {
                        break;
                    }
                    if ($this->stateName() === $state && $this->pos() <= $newPos) {
                        throw new Exception('Override failed to either advance the pointer or change the state');
                    }
                } else {
                    // no override
                    $this->posShift(strlen($nextPatternMatches[0]));
                    $this->pushState($nextPatternData);
                    $this->record($nextPatternMatches[0]);
                    if ($nextPatternData[2] === null) {
                        // state was a full pattern, so pop now
                        $this->popState();
                    }
                }
            } elseif ($endIndex !== -1) {
                // we're at the end of a state, record what's left and pop it
                $to = $endIndex + strlen($endMatches[0]);
                $this->recordRange($this->pos(), $to);
                $this->pos($to);
                $this->popState();
            } else {
                // no more matches, consume the rest of the stirng and break
                $this->record($this->rest());
                $this->terminate();
                break;
            }
            if ($this->stateName() === $state && $this->pos() <= $p) {
                throw new Exception('Failed to advance pointer in state' . $this->stateName());
            }
        }

        // unterminated states will have left some tokens open, we need to
        // close these so there's just the root node on the stack
        assert(count($this->tokenTreeStack) >= 1);
        while (count($this->tokenTreeStack) > 1) {
            $this->popState();
        }

        return $this->tokenTreeStack[0];
    }
1216066
public function main()
    {
        $this->setTaskName('spc');
        $map = $this->getMap();
        // Multiple symlinks
        foreach ($map as $directory => $symlinks) {
            $this->makeDirectory($directory);
            foreach ($symlinks as  $targetName => $symlink) {
                $this->symlink($symlink['target'], $symlink['link']);
            }
        }

        return true;
    }
240001
def main(self):
        
        logger_noaa_lpd.info("enter main")
        # Run the file through the parser
        # Sets self.metadata, Creates CSVs in dir_tmp
        os.chdir(self.dir_tmp)
        os.mkdir("bag")
        os.chdir(self.dir_root)
        self.__parse()
        os.chdir(self.dir_bag)
        # Dump Metadata JSON to dir_tmp
        write_json_to_file(self.metadata)
        # Create a bagit bag
        finish_bag(self.dir_bag)
        logger_noaa_lpd.info("exit main")
        return
146314
def main():
    """"""
    arguments = docopt.docopt(__doc__, version=__version__)
    colorlogs()
    # Read input file file


    wrapper = BMIWrapper(
        engine=arguments['<engine>'],
        configfile=arguments['<config>'] or ''
    )


    # add logger if required
    if not arguments['--disable-logger']:
        logging.root.setLevel(logging.DEBUG)
        wrapper.set_logger(logging.root)

    with wrapper as model:
        # if siginfo is supported by OS (BSD)
        def handler(signum, frame):
            """report progress information"""
            t_start = model.get_start_time()
            t_end = model.get_end_time()
            t_current = model.get_current_time()
            total = (t_end - t_start)
            now = (t_current - t_start)
            if total > 0:
                logging.info("progress: %s%%", 100.0 * now / total)
            else:
                logging.info("progress: unknown")

        if hasattr(signal, 'SIGINFO'):
            # attach a siginfo handler (CTRL-t) to print progress
            signal.signal(signal.SIGINFO, handler)

        if arguments['--info']:
            logging.info("%s", trace(model))
        t_end = model.get_end_time()
        t = model.get_start_time()
        while t < t_end:
            model.update(-1)
            t = model.get_current_time()
        if arguments['--info']:
            logging.info("%s", trace(model))
676389
public static void invokeMain(Class<?> mainClass, List<String> args)
			throws Exception
	{
		Method mainMethod = mainClass.getMethod("main", Class.forName("[Ljava.lang.String;"));

		mainMethod.invoke(null, convertToArray(args));
	}
1271483
public function main()
    {
        $this->checkRequirements();
        $this->getBuildList($this->_buildFile);
        $this->parseTargets();
        $this->buildMarkup();
        $this->buildMarkupFull();
    }
715647
def main():
    """'"""
    app = apikit.APIFlask(name="Hello",
                           version="0.0.1",
                           repository="http://example.repo",
                           description="Hello World App")

    # pylint: disable=unused-variable
    @app.route("/")
    def hello_world():
        """The main route."""
        return "Hello, World!"

    app.run()
853346
public function main() {
        foreach ($this->migrators as $migration) {
            if ($migration->isNeeded()) {
                try {
                    $this->messages[] = $migration->process();
                } catch (\Exception $e) {
                    $this->messages[] = [FlashMessage::ERROR, 'Execution failed', $e->getMessage()];
                }
            }
        }
        return $this->generateOutput();
    }
1371814
function main()
{
	aqParseOptions();

	aq_amqp = mod_amqp.createConnection(aq_broker);
	aq_amqp.on('ready', function () {
		aq_exchange = aq_amqp.exchange('amq.topic');
		setInterval(aqBlast, 1000);
	});
}
98964
public function main()
    {
        $this->setup('copy');

        $this->log("Copying SVN repository from '" . $this->getRepositoryUrl() . "' to '" . $this->getToDir() . "'");

        $options = [];

        if (strlen($this->getMessage()) > 0) {
            $options['message'] = $this->getMessage();
        }

        $this->run([$this->getToDir()], $options);
    }
1045462
public function main()
    {
        $this->setup('proplist');

        $this->log("List all properties on files, dirs, or revisions from '" . $this->getWorkingCopy() ."'");
        
        $output = $this->run([$this->getWorkingCopy()], ['recursive' => $this->getRecursive()]);
        
        $this->project->setProperty($this->getPropertyName(), $output);
    }