/*
The actual base entry point
19820
private void validateResource(List<ValidationMessage> errors, WrapperElement resource, WrapperElement element, StructureDefinition profile, IdStatus idstatus, NodeStack stack) throws FHIRException {
    if (stack == null)
      stack = new NodeStack(element.isXml());
		if (resource == null)
			resource = element;

    // getting going - either we got a profile, or not.
    boolean ok = true;
    if (element.isXml()) {
      ok = rule(errors, IssueType.INVALID, element.line(), element.col(), "/", element.getNamespace().equals(FormatUtilities.FHIR_NS),
          "Namespace mismatch - expected '" + FormatUtilities.FHIR_NS + "', found '" + element.getNamespace() + "'");
    }
    if (ok) {
      String resourceName = element.getResourceType();
      if (profile == null) {
        profile = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName);
        ok = rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), profile != null, "No profile found for resource type '" + resourceName + "'");
      } else {
        String type = profile.hasConstrainedType() ? profile.getConstrainedType() : profile.getName();
        // special case: we have a bundle, and the profile is not for a bundle. We'll try the first entry instead
        if (!type.equals(resourceName) && resourceName.equals("Bundle")) {
          WrapperElement first = getFirstEntry(element);
          if (first != null && first.getResourceType().equals(type)) {
            element = first;
            resourceName = element.getResourceType();
						idstatus = IdStatus.OPTIONAL; // why?
          }
        }
        ok = rule(errors, IssueType.INVALID, -1, -1, stack.addToLiteralPath(resourceName), type.equals(resourceName),
            "Specified profile type was '" + profile.getConstrainedType() + "', but resource type was '" + resourceName + "'");
      }
    }

    if (ok) {
      stack = stack.push(element, -1, profile.getSnapshot().getElement().get(0), profile.getSnapshot().getElement().get(0));
			if (idstatus == IdStatus.REQUIRED && (element.getNamedChild("id") == null))
				rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource requires an id, but none is present");
			else if (idstatus == IdStatus.PROHIBITED && (element.getNamedChild("id") != null))
				rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource has an id, but none is allowed");
			start(errors, resource, element, profile, stack); // root is both definition and type
    }
  }
877759
def entry_point() -> None:
    """"""

    # make sure the path contains the current working directory
    sys.path.insert(0, os.getcwd())

    parser = get_cxflow_arg_parser(True)

    # parse CLI arguments
    known_args, unknown_args = parser.parse_known_args()

    # show help if no subcommand was specified.
    if not hasattr(known_args, 'subcommand'):
        parser.print_help()
        quit(1)

    # set up global logger
    logger = logging.getLogger('')
    logger.setLevel(logging.DEBUG if known_args.verbose else logging.INFO)
    logger.handlers = []  # remove default handlers

    # set up STDERR handler
    stderr_handler = logging.StreamHandler(sys.stderr)
    stderr_handler.setFormatter(logging.Formatter(CXF_LOG_FORMAT, datefmt=CXF_LOG_DATE_FORMAT))
    logger.addHandler(stderr_handler)

    if known_args.subcommand == 'train':
        train(config_path=known_args.config_file, cl_arguments=unknown_args, output_root=known_args.output_root)

    elif known_args.subcommand == 'resume':
        resume(config_path=known_args.config_path, restore_from=known_args.restore_from, cl_arguments=unknown_args,
               output_root=known_args.output_root)

    elif known_args.subcommand == 'predict':
        logging.warning('Predict command is deprecated and will be removed, use ``cxflow eval predict ...`` instead')
        predict(config_path=known_args.config_path, restore_from=known_args.restore_from, cl_arguments=unknown_args,
                output_root=known_args.output_root)

    elif known_args.subcommand == 'eval':
        evaluate(model_path=known_args.model_path, stream_name=known_args.stream_name,
                 config_path=known_args.config, cl_arguments=unknown_args, output_root=known_args.output_root)

    elif known_args.subcommand == 'dataset':
        invoke_dataset_method(config_path=known_args.config_file, method_name=known_args.method,
                              cl_arguments=unknown_args, output_root=known_args.output_root)

    elif known_args.subcommand == 'gridsearch':
        grid_search(script=known_args.script, params=known_args.params, dry_run=known_args.dry_run)

    elif known_args.subcommand == 'ls':
        list_train_dirs(known_args.dir, known_args.recursive, known_args.all, known_args.long, known_args.verbose)

    elif known_args.subcommand == 'prune':
        prune_train_dirs(known_args.dir, known_args.epochs, known_args.subdirs)
1337013
public static void main(String[] args) {
        boolean success = Orchid.getInstance().start(
                StandardModule.builder().args(args).build()
        );
        System.exit((success) ? 0 : 1);
    }
889412
async function main() {
  event.$emit('before-client-render')

  if (globalState.initialData) {
    dataStore.replaceState(globalState.initialData)
  }

  await routerReady(router)

  if (router.getMatchedComponents().length === 0) {
    throw new ReamError(pageNotFound(router.currentRoute.path))
  }
}
302118
def entry_point():
    
    try:
        main("omego", items=[
            (InstallCommand.NAME, InstallCommand),
            (UpgradeCommand.NAME, UpgradeCommand),
            (ConvertCommand.NAME, ConvertCommand),
            (DownloadCommand.NAME, DownloadCommand),
            (DbCommand.NAME, DbCommand),
            (Version.NAME, Version)])
    except Stop, stop:
        if stop.rc != 0:
            print "ERROR:", stop
        else:
            print stop
        sys.exit(stop.rc)
1088359
public function main()
    {

        // Set a default fetchmode if none was specified
        // (We're doing that here to prevent errors loading the class is PDO is not available.)
        if ($this->fetchMode === null) {
            $this->fetchMode = PDO::FETCH_ASSOC;
        }

        // Initialize the formatters here.  This ensures that any parameters passed to the formatter
        // element get passed along to the actual formatter object
        foreach ($this->formatters as $fe) {
            $fe->prepare($this->getLocation());
        }

        $savedTransaction = [];
        for ($i = 0, $size = count($this->transactions); $i < $size; $i++) {
            $savedTransaction[] = clone $this->transactions[$i];
        }

        $savedSqlCommand = $this->sqlCommand;

        $this->sqlCommand = trim($this->sqlCommand);

        try {
            if ($this->srcFile === null && $this->sqlCommand === ""
                && empty($this->filesets) && empty($this->filelists)
                && count($this->transactions) === 0
            ) {
                throw new BuildException(
                    "Source file or fileset/filelist, "
                    . "transactions or sql statement "
                    . "must be set!",
                    $this->getLocation()
                );
            }

            if ($this->srcFile !== null && !$this->srcFile->exists()) {
                throw new BuildException("Source file does not exist!", $this->getLocation());
            }

            // deal with the filesets
            foreach ($this->filesets as $fs) {
                $ds = $fs->getDirectoryScanner($this->project);
                $srcDir = $fs->getDir($this->project);
                $srcFiles = $ds->getIncludedFiles();
                // Make a transaction for each file
                foreach ($srcFiles as $srcFile) {
                    $t = $this->createTransaction();
                    $t->setSrc(new PhingFile($srcDir, $srcFile));
                }
            }

            // process filelists
            foreach ($this->filelists as $fl) {
                $srcDir = $fl->getDir($this->project);
                $srcFiles = $fl->getFiles($this->project);
                // Make a transaction for each file
                foreach ($srcFiles as $srcFile) {
                    $t = $this->createTransaction();
                    $t->setSrc(new PhingFile($srcDir, $srcFile));
                }
            }

            // Make a transaction group for the outer command
            $t = $this->createTransaction();
            if ($this->srcFile) {
                $t->setSrc($this->srcFile);
            }
            $t->addText($this->sqlCommand);
            $this->conn = $this->getConnection();

            try {
                $this->statement = null;

                // Initialize the formatters.
                $this->initFormatters();

                try {
                    // Process all transactions
                    for ($i = 0, $size = count($this->transactions); $i < $size; $i++) {
                        if (!$this->isAutocommit()) {
                            $this->log("Beginning transaction", Project::MSG_VERBOSE);
                            $this->conn->beginTransaction();
                        }
                        $this->transactions[$i]->runTransaction();
                        if (!$this->isAutocommit()) {
                            $this->log("Committing transaction", Project::MSG_VERBOSE);
                            $this->conn->commit();
                        }
                    }
                } catch (Exception $e) {
                    $this->closeConnection();
                    throw $e;
                }
            } catch (IOException $e) {
                if (!$this->isAutocommit() && $this->conn !== null && $this->onError == "abort") {
                    try {
                        $this->conn->rollback();
                    } catch (PDOException $ex) {
                    }
                }
                $this->closeConnection();
                throw new BuildException($e->getMessage(), $this->getLocation());
            } catch (PDOException $e) {
                if (!$this->isAutocommit() && $this->conn !== null && $this->onError == "abort") {
                    try {
                        $this->conn->rollback();
                    } catch (PDOException $ex) {
                    }
                }
                $this->closeConnection();
                throw new BuildException($e->getMessage(), $this->getLocation());
            }

            // Close the formatters.
            $this->closeFormatters();

            $this->log(
                $this->goodSql . " of " . $this->totalSql .
                " SQL statements executed successfully"
            );
        } catch (Exception $e) {
            $this->transactions = $savedTransaction;
            $this->sqlCommand = $savedSqlCommand;
            $this->closeConnection();
            throw $e;
        }
        // finally {
        $this->transactions = $savedTransaction;
        $this->sqlCommand = $savedSqlCommand;
        $this->closeConnection();
    }
213277
function main() {
		var el;

		el = document.querySelector( 'title' );
		cleanTitle( el );

		el = document.querySelectorAll( '.tsd-kind-external-module a' );
		cleanLinks( el );

		el = document.querySelectorAll( '.tsd-is-not-exported a' );
		cleanLinks( el );

		el = document.querySelectorAll( '.tsd-breadcrumb a' );
		cleanLinks( el );

		el = document.querySelectorAll( '.tsd-page-title h1' );
		cleanHeadings( el );

		el = document.querySelectorAll( '.tsd-description .tsd-parameters .tsd-comment p' );
		updateDescriptions( el );

		el = document.querySelectorAll( '.tsd-description .tsd-returns-title + p' );
		updateDescriptions( el );
	}
1034731
async function main() {
  // Initialize the application.
  process.title = 'Which.js';

  // Parse the command line arguments.
  program.name('which')
    .description('Find the instances of an executable in the system path.')
    .version(packageVersion, '-v, --version')
    .option('-a, --all', 'list all instances of executables found (instead of just the first one)')
    .option('-s, --silent', 'silence the output, just return the exit code (0 if any executable is found, otherwise 1)')
    .arguments('<command>').action(command => program.executable = command)
    .parse(process.argv);

  if (!program.executable) {
    program.outputHelp();
    process.exitCode = 64;
    return;
  }

  // Run the program.
  let executables = await which(program.executable, {all: program.all});
  if (!program.silent) {
    if (!Array.isArray(executables)) executables = [executables];
    for (const path of executables) console.log(path);
  }
}
603255
def main():
    """"""
    actions = []
    try:
        # Parse the command line arguments.
        options, arguments = getopt.getopt(sys.argv[1:], 'cdh', [
            'convert', 'to-html', 'demo', 'help',
        ])
        # Map command line options to actions.
        for option, value in options:
            if option in ('-c', '--convert', '--to-html'):
                actions.append(functools.partial(convert_command_output, *arguments))
                arguments = []
            elif option in ('-d', '--demo'):
                actions.append(demonstrate_colored_logging)
            elif option in ('-h', '--help'):
                usage(__doc__)
                return
            else:
                assert False, "Programming error: Unhandled option!"
        if not actions:
            usage(__doc__)
            return
    except Exception as e:
        warning("Error: %s", e)
        sys.exit(1)
    for function in actions:
        function()
1130938
function main() {
  var server = new grpc.Server();
  server.addService(services.GreeterService, {sayHello: sayHello});
  server.bind('0.0.0.0:50051', grpc.ServerCredentials.createInsecure());
  server.start();
}
1252548
function main(options = util.getDefaultOptions()) {
  createLogger(options.debug);
  log.info(`Preparing '${options.sdk}' schemas in version '${options.version || 'latest'}'...`);

  let allLibs = {};

  // do the downloading and encapsulate in Promise
  const dlPromise = new Promise((resolve, reject) => {
    download.allLibsFile(options)
      .then((allLibsJSON) => {
        allLibs = allLibsJSON;
        download.schemas(options, allLibs)
          .then((values) => {
            resolve(values);
          })
          .catch((e) => {
            reject(e);
          });
      })
      .catch((e) => {
        reject(e);
      });
  });


  dlPromise.then(() => {
    log.info('Yay, all schema files were successfully downloaded!');
    if (options.upgrade) {
      upgrade(options, allLibs);
    }
    if (options.link) {
      link(options, allLibs);
    }
  }, (e) => {
    log.error('Damn... Something went all wrong while downloading the schema files!');
    log.error(`Are you sure the version '${options.version}' is still available on '${options.sdk}' download pages?`);
    log.error(e);
  });
}
204985
function main() {
	var project = parseSource( errBuf );

	if ( project && writeDictionary( project, errBuf ) ) {
		console.log( 'localization database correctly built' );
	} // if

	if ( errBuf.length ) {
		commons.outputErrors( errBuf, console.error );
		process.exit( 1 );
	} // if

	process.exit( 0 );
}
1339997
function ElmRunner(filename, baseDir, defaults) {
  var relativePath = path.relative(baseDir, filename);
  var baseName = path.basename(filename, path.extname(filename));

  this.filename = filename;
  this.defaults = defaults || {};

  this.moduleName = resolveModuleName(relativePath);
  this.outputPath = path.join(path.dirname(filename), baseName + ".js");

  var self = this;
  withCheckedPath(this.outputPath, function() {
    try {
      compile.call(self);
      execute.call(self);
      wrap.call(self);
    } catch (e) {
      return e;
    }

    return true;
  });
}
992233
public static void main(String[] args) {
    ProcessEntryPoint entryPoint = ProcessEntryPoint.createForArguments(args);
    Props props = entryPoint.getProps();
    new WebServerProcessLogging().configure(props);
    WebServer server = new WebServer(props);
    entryPoint.launch(server);
  }
1374706
public function main()
    {

        $sec           = 0;
        $target        = $this->getOwningTarget();
        $targetName    = $target->getName();
        $subTargetName = $this->subTarget;
        $allTargets    = $this->project->getTargets();

        $usedTargets   = array_filter(
            $allTargets,
            function ($key) {
                return strrpos($key, ".".$targetName) > 0;
            },
            ARRAY_FILTER_USE_KEY
        );

        // If the target was redefined outside of the starterkit.
        if (!empty($usedTargets)) {
            $sec       = 10;
            $newTarget = $targetName;
            $buildFile = "build.project.xml";
            $target    = $allTargets[$subTargetName];
        } else {
            // If a deprecated target is called without redefinition.
            $sec       = 5;
            $newTarget = $subTargetName;
            $buildFile = $this->project->getProperty("phing.file");
        }

        // Inform user of the deprecated target.
        $this->log(
            "Target '".$targetName."' has been replaced by '".$subTargetName."'.",
            Project::MSG_WARN
        );
        $this->log(
            "A ".$sec." second penalty is assigned usage of this target.",
            Project::MSG_WARN
        );
        $this->log(
            "Please use '".$subTargetName."' instead to avoid the penalty.",
            Project::MSG_WARN
        );
        $this->log(
            "Running PhingCallTask for target '".$subTargetName."'",
            Project::MSG_DEBUG
        );
        sleep($sec);

        if ($this->_callee === null) {
            $this->init();
        }

        if ($this->subTarget === null) {
            throw new BuildException(
                "Attribute target is required.",
                $this->getLocation()
            );
        }

        $this->_callee->setPhingfile($buildFile);
        $this->_callee->setTarget($newTarget);
        $this->_callee->setOwningTarget($target);
        $this->_callee->setInheritAll($this->_inheritAll);
        $this->_callee->setInheritRefs($this->_inheritRefs);
        $this->_callee->main();

    }
102034
public function main()
    {
        try {
            // Log
            $this->log('Started ', $this->loglevel);
            // Initialize //
            $this->prepare();
            $haveExecuted = false;
            // Validate O.S. applicability
            if ($this->isValidOs()) {
                // Build the command //
                $this->buildCommand();
                // Process //
                $totalFiles = 0;
                $totalDirs = 0;
                $fileNames = [];
                // - FileSets
                foreach ($this->filesets as $fs) {
                    $currentType = $this->type;
                    if ($fs instanceof DirSet) {
                        if ($this->type !== self::$types['DIR']) {
                            $this->log(
                                "Found a nested dirset but type is $this->type . "
                                . "Temporarily switching to type=\"dir\" on the"
                                . " assumption that you really did mean"
                                . " <dirset> not <fileset>.",
                                Project::MSG_DEBUG
                            );
                            $currentType = 'dir';
                        }
                    }
                    $base = $fs->getDir($this->project);
                    $ds = $fs->getDirectoryScanner($this->project);
                    if ($currentType !== self::$types['DIR']) {
                        $s = $this->getFiles($base, $ds);
                        foreach ($s as $fileName) {
                            $totalFiles++;
                            $fileNames[] = $fileName;
                            $baseDirs[] = $base;
                        }
                    }
                    if ($currentType !== self::$types['FILE']) {
                        $s = $this->getDirs($base, $ds);
                        foreach ($s as $fileName) {
                            $totalDirs++;
                            $fileNames[] = $fileName;
                            $baseDirs[] = $base;
                        }
                    }
                    if (count($fileNames) === 0 && $this->skipEmpty) {
                        $this->logSkippingFileset($currentType, $ds, $base);
                        continue;
                    }
                    $this->process(
                        $fs->getDirectoryScanner($this->project)->getIncludedFiles(),
                        $fs->getDir($this->project)
                    );
                    $haveExecuted = true;
                }
                unset($this->filesets);
                // - FileLists
                /**
                 * @var FileList $fl
                 */
                foreach ($this->filelists as $fl) {
                    $totalFiles++;
                    $this->process($fl->getFiles($this->project), $fl->getDir($this->project));
                    $haveExecuted = true;
                }
                unset($this->filelists);
            }
            if ($haveExecuted) {
                $this->log(
                    "Applied " . $this->commandline->getExecutable() . " to "
                    . $totalFiles . " file"
                    . ($totalFiles !== 1 ? "s" : "") . " and "
                    . $totalDirs . " director"
                    . ($totalDirs !== 1 ? "ies" : "y") . ".",
                    $this->loglevel
                );
            }
            /// Cleanup //
            $this->cleanup();
            // Log
            $this->log('End ', $this->loglevel);
        } catch (IOException | NullPointerException | UnexpectedValueException $e) {
            throw new BuildException('Execute failed: ' . $e, $e, $this->getLocation());
        }
    }
401026
public static void main(String[] args) throws IOException {
        MDC.put("process", "host controller");


        // Grab copies of our streams.
        final InputStream in = System.in;
        //final PrintStream out = System.out;
        //final PrintStream err = System.err;

        byte[] authKey = new byte[ProcessController.AUTH_BYTES_ENCODED_LENGTH];
        try {
            StreamUtils.readFully(new Base64InputStream(System.in), authKey);
        } catch (IOException e) {
            STDERR.println(HostControllerLogger.ROOT_LOGGER.failedToReadAuthenticationKey(e));
            fail();
            return;
        }

        // Make sure our original stdio is properly captured.
        try {
            Class.forName(ConsoleHandler.class.getName(), true, ConsoleHandler.class.getClassLoader());
        } catch (Throwable ignored) {
        }

        // Install JBoss Stdio to avoid any nasty crosstalk.
        StdioContext.install();
        final StdioContext context = StdioContext.create(
            new NullInputStream(),
            new LoggingOutputStream(Logger.getLogger("stdout"), Level.INFO),
            new LoggingOutputStream(Logger.getLogger("stderr"), Level.ERROR)
        );
        StdioContext.setStdioContextSelector(new SimpleStdioContextSelector(context));

        create(args, new String(authKey, Charset.forName("US-ASCII")));

        while (in.read() != -1) {}
        exit();
    }