Main interface for interacting with Evergreen.
@constructor
180170
function Configurator(){
  // Store reference to the tree/template
  this.__tree = {};
  // Cached instance of the fully rendered tree.
  this.__cachedResolvedTree = null;
  // Configuration for the GraphBuilder
  this.__config = {
   directives: {
     file: new (require('./directives/file.js')),
     http: new (require('./directives/http.js')),
     require: new (require('./directives/require.js'))
   },
   resolvers: {
     absolute: {
       order: 1,
       resolve: Path.resolve(__dirname, './resolvers/absolute.js')
     },
     relative: {
       order: 2,
       resolve: Path.resolve(__dirname, './resolvers/relative.js')
     },
     environment: {
       order: 3,
       resolve: Path.resolve(__dirname, './resolvers/environment.js')
     }
   }
  };
}
1215227
function main() {
  var topWindow = window.top;
  var isTop = window.top === window;

  // Check the top window for options.
  var options = null;
  try {
    var optionsEl = topWindow.document.querySelector('x-wtf-options');
    if (optionsEl) {
      // Options exist in the DOM, use those.
      options = JSON.parse(optionsEl.text);
    }
  } catch (e) {
    // Failed, likely because of cross-domain iframe issues.
  }

  // Grab options - if not found, not injected.
  if (!options) {
    options = fetchOptions(topWindow);
  }
  if (!options) {
    return;
  }

  // Add options to the document for other frames/etc to find.
  if (!optionsEl) {
    try {
      optionsEl = document.createElement('x-wtf-options');
      optionsEl.text = JSON.stringify(options);
      topWindow.document.documentElement.appendChild(optionsEl);
    } catch (e) {
      // Failed, likely because of cross-domain iframe issues.
    }
  }

  if (options['__instrumented__']) {
    // Instrumentation mode.
    if (isTop) {
      // Create a blob that is both the falafel and process scripts.
      // This is used to create the worker.
      var xhr = new XMLHttpRequest();
      xhr.open('GET', chrome.extension.getURL('third_party/falafel.js'), false);
      xhr.send();
      var falafelSource = xhr.responseText;
      xhr = new XMLHttpRequest();
      xhr.open('GET', chrome.extension.getURL('wtf-process.js'), false);
      xhr.send();
      var processSource = xhr.responseText;
      var blob = new Blob([
        falafelSource,
        processSource
      ], {
        type: 'application/javascript'
      });
      var blobUrl = URL.createObjectURL(blob);
      options['wtf.instrumentation.blob'] = blobUrl;

      injectScriptFile(chrome.extension.getURL('third_party/falafel.js'));
      injectScriptFile(chrome.extension.getURL('wtf-process.js'));
      injectScriptFile(chrome.extension.getURL('wtf-call-tracing.js'));
    }
    injectScriptFunction(function(options) {
      // If we are nested in an iframe, protect against cross-origin errors.
      try {
        window.top.wtfi.prepare(options, window);
      } catch (e) {
      }
    }, [
      options
    ]);
  } else {
    // Normal tracing mode.
    // Inject the tracing framework script and the prepare function.
    if (isTop) {
      var traceScriptUrl =
        chrome.extension.getURL('wtf_trace_web_js_compiled.js');
      injectScriptFunction(function(traceScriptUrl) {
        window.WTF_TRACE_SCRIPT_URL = traceScriptUrl;
      }, [traceScriptUrl]);
      injectScriptFile(traceScriptUrl);
    }
    injectScriptFunction(function(options) {
      // If we are nested in an iframe, protect against cross-origin errors.
      try {
        window.top.wtf.trace.prepare(options, window);
      } catch (e) {
      }
    }, [
      options
    ]);

    if (isTop) {
      // Inject addons, if required.
      var addons = injectAddons(options['wtf.addons'] || []);
      // Inject preparation code to start tracing with the desired options.
      injectScriptFunction(startTracing, [
        addons
      ]);
    }
  }

  if (isTop) {
    setupCommunications();
  }
}
785749
static function init() {

		switch( PHP_SAPI ) {
		// Ideally we want to be runnning as CLI
		case 'cli':
			break;
		// Special conditions to ensure CGI runs as CLI
		case 'cgi':
			// Ensure resource constants are defined
			if( ! defined('STDERR') ){
				define( 'STDERR', fopen('php://stderr', 'w') );
			}
			if( ! defined('STDOUT') ){
				define( 'STDOUT', fopen('php://stdout', 'w') );
			}
			break;
		default:
			echo "Command line only\n";
			exit(1);
		}
		
		// Default error logger function
		PLUG::set_error_logger( array(__CLASS__,'format_logline') );
		
		// parse command line arguments from argv global
		global $argv, $argc;
		// first cli arg is always current script. second arg will be script arg passed to shell wrapper
		for( $i = 1; $i < $argc; $i++ ){
			$arg = $argv[ $i ];
			
			// Each command line argument may take following forms:
			//  1. "Any single argument", no point parsing this unless it follows #2 below
			//  2. "-aBCD", one or more switches, parse into 'a'=>true, 'B'=>true, and so on
			//  3. "-a value", flag used with following value, parsed to 'a'=>'value'
			//  4. "--longoption", GNU style long option, parse into 'longoption'=>true
			//  5. "--longoption=value", as above, but parse into 'longoption'=>'value'
			//  6."any variable name = any value" 
			
			$pair = explode( '=', $arg, 2 );
			if( isset($pair[1]) ){
				$name = trim( $pair[0] );
				if( strpos($name,'--') === 0 ){
					// #5. trimming "--" from option, tough luck if you only used one "-"
					$name = trim( $name, '-' );
				}
				// else is #6, any pair
				$name and self::$args[$name] = trim( $pair[1] );
			}
			
			else if( strpos($arg,'--') === 0 ){
				// #4. long option, no value
				$name = trim( $arg, "-\n\r\t " );
				$name and self::$args[ $name ] = true;
			}
			
			else if( $arg && $arg{0} === '-' ){
				$flags = preg_split('//', trim($arg,"-\n\r\t "), -1, PREG_SPLIT_NO_EMPTY );
				foreach( $flags as $flag ){
					self::$args[ $flag ] = true;
				}
				// leave $flag set incase a value follows.
				continue;
			}

			// else is a standard argument. use as value only if it follows a flag, e.g "-a apple"
			else if( isset($flag) ){
				self::$args[ $flag ] = trim( $arg );
			}

			// dispose of last flag
			unset( $flag );
			// next arg 
		}
	}
1096147
function main() {

    const jdlPath = getJDLPath();
    const destPath = pathUtils.resolve(jdlPath, relativeDestPath);
    const sourceCheckoutPath = getSourceCheckoutPath();
    const sourceIconsRoot = sourceCheckoutPath && pathUtils.resolve(sourceCheckoutPath, sourceIconSubdir);

    if (!sourceCheckoutPath) {
        console.log(MESSAGE);
        return;
    }

    let spinner;

    validateSourcePath(sourceCheckoutPath)
        .then(() => {
            spinner = new Spinner('Searching');
            spinner.start();
        })
        .then(() => findSourceFiles(sourceIconsRoot))
        .then(iconFilePaths => iconFilePaths.map(filePath => {
            // Calculate how the absolute path relates back to the root of the icons dir
            const relativePath = pathUtils.relative(sourceIconsRoot, filePath);
            return { filePath, relativePath };
        }))
        .then(iconFiles => {
            spinner.setSpinnerTitle(`Processing ${iconFiles.length} source files`);
            return Promise.all(iconFiles.map(iconFile => processIcon(iconFile, destPath)));
        })
        .then(results => {
            // Copy index.js
            return fs.readFileAsync(pathUtils.resolve(sourceIconsRoot, 'index.js'), { encoding: 'UTF8' })
                .then(contents => fs.writeFileAsync(pathUtils.resolve(destPath, 'index.js'), contents, { encoding: 'UTF8' }))
                .then(() => results);
        })
        .then(results => {
            spinner.stop();

            const errors = results.filter(details => details.error);
            const successful = results.length - errors.length;

            if (successful > 0) {
                console.log('\x1b[32m');
                console.log(`${successful} Icons successfully copied and updated.`);
                console.log('\x1b[m');
            }

            if (errors.length) {
                process.exitCode = -1;
                console.log('\x1b[33m');
                console.error(`${errors.length} Icons had problems:`);
                for (const { relativePath, error } of errors) {
                    console.error(` * ${relativePath} - ${error}`);
                }
                console.error('\x1b[m');
            }
        })
        .catch(e => {
            spinner && spinner.stop();
            throw e;
        });
}
661196
function main() {
    console.log("Will create symlink from " + languageDir + " to " + baseDir);
    let relativeLanguageDir = path.relative(currentDir, languageDir);
    let relativeBaseDir = path.relative(currentDir, baseDir);
    console.log("Using relative paths " + relativeLanguageDir + " to " + relativeBaseDir);
    symlinkOrCopySync(relativeLanguageDir, relativeBaseDir);

    // clean out elm-stuff cache
    glob(path.join(currentDir, "/elm-stuff/**/user/project/*/"+argv.rootModule+"*"), function(er, files) {
        files.forEach(function(file) {
            console.log("clearing out cache at", file);
            fs.removeSync(file);
        });
        if (argv.output) {
            build(argv.output);
        }
    });
}
385362
function _constructor () {
    converterOptions = converterOptions || {};

    for (var gOpt in globalOptions) {
      if (globalOptions.hasOwnProperty(gOpt)) {
        options[gOpt] = globalOptions[gOpt];
      }
    }

    // Merge options
    if (typeof converterOptions === 'object') {
      for (var opt in converterOptions) {
        if (converterOptions.hasOwnProperty(opt)) {
          options[opt] = converterOptions[opt];
        }
      }
    } else {
      throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions +
      ' was passed instead.');
    }

    if (options.extensions) {
      showdown.helper.forEach(options.extensions, _parseExtension);
    }
  }
866285
function MainView() {
    assertFirstConstructorCall(MainView);

    if (hasTouchScreen()) {
      document.body.classList.add('touch');
    }

    // This must be initialized before the tabs, so they can register as
    // observers.
    g_browser = BrowserBridge.getInstance();

    // This must be the first constants observer, so other constants observers
    // can safely use the globals, rather than depending on walking through
    // the constants themselves.
    g_browser.addConstantsObserver(new ConstantsObserver());

    // Create the tab switcher.
    this.initTabs_();

    // Cut out a small vertical strip at the top of the window, to display
    // a high level status (i.e. if we are displaying a log file or not).
    // Below it we will position the main tabs and their content area.
    this.topBarView_ = TopBarView.getInstance(this);
    const verticalSplitView =
        new VerticalSplitView(this.topBarView_, this.tabSwitcher_);

    superClass.call(this, verticalSplitView);

    // Trigger initial layout.
    this.resetGeometry();

    window.onhashchange = this.onUrlHashChange_.bind(this);

    // Select the initial view based on the current URL.
    window.onhashchange();

    // No log file loaded yet so set the status bar to that state.
    this.topBarView_.switchToSubView('loaded').setFileName(
        'No log to display.');

    // TODO(rayraymond): Follow-up is to completely remove all code from
    // g_browser that interacts with sending/receiving messages from
    // browser.
    g_browser.disable();
  }
1162683
function(obj) {
    var self = this
    if (obj.runMainInFiber) { // default is false
      console.warn('"runMainInFiber" is DEPRECATED. Please wrap all applications in "__" instead.')
      __(function() {
        self._invokeMain(obj)
      })
    } else {
      self._invokeMain(obj)
    }
  }
170187
def main():
    """"""
    parser = argparse.ArgumentParser(description='Compose a yaml file.')
    parser.add_argument(
        'root',
        type=argparse.FileType('r'),
        help='The root yaml file to compose.'
    )

    args = parser.parse_args()

    result = yaml.load(args.root, Loader=ComposeLoader)

    print(yaml.dump(result))
1073293
function main(argv) {
  const options = yargs
    .usage("Usage: hashy [<option>...]")
    .example("hashy [ -a <algorithm> ] <secret>", "hash the secret")
    .example("hashy <secret> <hash>", "verify the secret using the hash")
    .options({
      a: {
        default: hashy.DEFAULT_ALGO,
        describe: "algorithm to use for hashing",
      },
      h: {
        alias: "help",
        boolean: true,
        describe: "display this help message",
      },
      v: {
        alias: "version",
        boolean: true,
        describe: "display the version number",
      },
      c: {
        alias: "cost",
        describe: "cost for Bcrypt",
      },
    })
    .parse(argv);

  if (options.help) {
    return yargs.help();
  }

  if (options.version) {
    const pkg = require("./package");
    return "Hashy version " + pkg.version;
  }

  if (options.cost) {
    hashy.options.bcrypt.cost = +options.cost;
  }

  const args = options._;

  if (args.length === 1) {
    return hashy.hash(args[0], options.a).then(console.log);
  }

  if (args.length === 2) {
    const password = args[0];
    const hash = args[1];

    return hashy.verify(password, hash).then(function(success) {
      if (success) {
        if (hashy.needsRehash(hash, options.a)) {
          return "ok but password should be rehashed";
        }

        return "ok";
      }

      throw new Error("not ok");
    });
  }

  throw new Error("incorrect number of arguments");
}
589678
function main() {
  var server = new grpc.Server();
  server.addService(hello_proto.Greeter.service, {sayHello: sayHello});
  server.bind('0.0.0.0:50051', grpc.ServerCredentials.createInsecure());
  server.start();
}
155224
function main(content, callback) {
  parser(content, function(error, result) {
    if (error) {
      callback(error);
    } else {
      callback(null, result);
    }
  });
}
541248
function main(option, parser, force) {
  if(typeof option === 'function') {
    parser = option;
    option = null;
  }
  if(option !== false) {
    option = option || parse.option;
    parser = parser || parse;
  }
  //var mode = parse.auto;
  if(typeof parser === 'function') {
    module.exports.mode = parser(parse.modes, option, process.argv.slice(2));
  }
  initialize(force);
  return module.exports;
}
47728
function intro() {
  // @TODO: How best to pull in .scss color data export to reference branch colors below?
  const b = chalk.hex('#545DA6'); // indigo, light
  const y = chalk.hex('#ffcc4d'); // yellow, base

  const CLI_TITLE = chalk.bold.underline('Bolt-CLI');
  const CLI_DESCRIPTION = 'Welcome to the Bolt CLI ⚡️  Have fun!';
  const CLI_USAGE = 'Usage: `bolt <command> [options ...]`';
  const HELP_USAGE = 'Help: `bolt -h` or `bolt <command> --help`';

  // const HELP_HEADER_BACKUP = `
  //     /˜˜˜˜˜˜˜˜˜˜˜˜\
  //    / /˜˜˜˜/|˜˜˜˜\ \
  //   / /    / |     \ \
  //  / /    /  |____  \ \
  // / /    /       /   \ \
  // \ \   /____   /    / /
  //  \ \      |  /    / /
  //   \ \     | /    / /
  //    \ \____|/____/ /
  //     \____________/
  // `

  // ^ Colorized + partially filled in version of logo above
  const HELP_HEADER = `
    ${b('///////|\\\\\\\\\\\\')}
   ${b('///˜˜˜˜')}${y('/|')}${b('˜˜˜˜\\\\\\')}
  ${b('///    ')}${y('//|')}${b('     \\\\\\')}     ${CLI_TITLE}
 ${b('///    ')}${y('///|____')}${b('  \\\\\\')}
${b('///    ')}${y('/////////')}${b('   \\\\\\')}   ${CLI_DESCRIPTION}
${b('\\\\\\   ')}${y('/////////')}${b('    ///')}
 ${b('\\\\\\      ')}${y('|///')}${b('    ///')}    ${CLI_USAGE}
  ${b('\\\\\\     ')}${y('|//')}${b('    ///')}     ${HELP_USAGE}
   ${b('\\\\\\____')}${y('|/')}${b('____///')}
    ${b('\\\\\\\\\\\\|///////')}
`;

  info(HELP_HEADER);
}
1356121
async function main() {
  const csv = fs.readFileSync('fsm.csv', { encoding: 'utf8' })
  const dot = graphViz(parseCSV(csv))
  fs.writeFileSync('fsm.dot', dot)
  const viz = new Viz({ Module, render })
  const svg = await viz.renderString(dot)
  fs.writeFileSync('fsm.svg', svg)
}
94861
function Handler() {
    if (this.constructor === Handler) {
        throw new Error("Can't instantiate abstract class!");
    }

    /**
     * @var {Object}
     * @protected
     */
    this.__inspector;

    /**
     * @var {Object}
     * @protected
     */
    this.__run;

    /**
     * @var {Object}
     * @protected
     */
    this.__request = null;

    /**
     * @var {Object}
     * @protected
     */
    this.__response = null;
}
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);
	});
}