/*
Parse our envs from pantheon api into a choices array
422284
function(envs) {

  // Do not allow us to create the initial site from test or live
  delete envs.test;
  delete envs.live;

  // Map into a choices array
  var choices = [];
  _.map(envs, function(val, key) {
    choices.push({
      name: key,
      value: key,
      id: key,
      php: val.php_version || undefined,
      drush: val.drush_version || undefined
    });
  });

  // Sort nicely by name and return
  return _.sortBy(choices, 'name');

}
16074
function resolveFlavors(opts) {
  var string = process.env[opts.env || 'FLAVORS']

  if (string) {
    return string.split(',')
  } else if (opts.flavors) {
    return opts.flavors
  }

  return []
}
60419
function options (userOpts) {
  if (appLoaded && typeof userOpts === 'undefined') {
    return appOptions
  }
  userOpts = typeof userOpts === 'object' ? userOpts : {}
  appOptions = Object.assign({}, defaults, userOpts)
  appOptions.paths = Object.assign({}, defaults.paths, userOpts.paths)
  appLoaded = true

  return appOptions
}
841079
def read_env():
    """"""
    parser = argparse.ArgumentParser(description='mongo-orchestration server')
    parser.add_argument('-f', '--config',
                        action='store', default=None, type=str, dest='config')
    parser.add_argument('-e', '--env',
                        action='store', type=str, dest='env', default=None)
    parser.add_argument(action='store', type=str, dest='command',
                        default='start', choices=('start', 'stop', 'restart'))
    parser.add_argument('--no-fork',
                        action='store_true', dest='no_fork', default=False)
    parser.add_argument('-b', '--bind',
                        action='store', dest='bind', type=str,
                        default=DEFAULT_BIND)
    parser.add_argument('-p', '--port',
                        action='store', dest='port', type=int,
                        default=DEFAULT_PORT)
    parser.add_argument('--enable-majority-read-concern', action='store_true',
                        default=False)
    parser.add_argument('-s', '--server',
                        action='store', dest='server', type=str,
                        default=DEFAULT_SERVER, choices=('cherrypy', 'wsgiref'))
    parser.add_argument('--version', action='version',
                        version='Mongo Orchestration v' + __version__)
    parser.add_argument('--socket-timeout-ms', action='store',
                        dest='socket_timeout',
                        type=int, default=DEFAULT_SOCKET_TIMEOUT)
    parser.add_argument('--pidfile', action='store', type=str, dest='pidfile',
                        default=PID_FILE)

    cli_args = parser.parse_args()

    if cli_args.env and not cli_args.config:
        print("Specified release '%s' without a config file" % cli_args.env)
        sys.exit(1)
    if cli_args.command == 'stop' or not cli_args.config:
        return cli_args
    try:
        # read config
        with open(cli_args.config, 'r') as fd:
            config = json.loads(fd.read(), object_pairs_hook=SON)
        if not 'releases' in config:
            print("No releases defined in %s" % cli_args.config)
            sys.exit(1)
        releases = config['releases']
        if cli_args.env is not None and cli_args.env not in releases:
            print("Release '%s' is not defined in %s"
                  % (cli_args.env, cli_args.config))
            sys.exit(1)
        cli_args.releases = releases
        return cli_args
    except (IOError):
        print("config file not found")
        sys.exit(1)
    except (ValueError):
        print("config file is corrupted")
        sys.exit(1)
25526
function getChoices() {
    return {
      plugins: [{
        value: '@myrmex/api-gateway',
        name: icli.format.info('@myrmex/api-gateway') + ' - deploy swagger definitions in API gateway',
        short: 'api-gateway',
        checked: true
      }, {
        value: '@myrmex/cors',
        name: icli.format.info('@myrmex/cors') + ' - set CORS configuration for @myrmex/api-gateway',
        short: 'cors',
        checked: false
      }, {
        value: '@myrmex/iam',
        name: icli.format.info('@myrmex/iam') + ' - manage IAM policies and roles',
        short: 'iam',
        checked: true
      }, {
        value: '@myrmex/lambda',
        name: icli.format.info('@myrmex/lambda') + ' - deploy Lambdas in AWS and associate them to API endpoints',
        short: 'lambda',
        checked: true
      }, {
        value: '@myrmex/packager',
        name: icli.format.info('@myrmex/packager') + ' - use docker to package Lambdas defined with @myrmex/lambda',
        short: 'packager',
        checked: false
      }]
    };
  }
68858
def extract_environment!(options)
      values = []
      [:environment, :env, :rubies, :ruby].each do |k|
        values << options.delete(k)
      end
      values.compact.first
    end
1374100
def load_params(opts = {})
      Dotenv.load if opts[:use_dotenv]
      manifest.each do |p|
        env_name = p[:name].to_s
        if p[:const]
          # const
          @params[p[:name]] = p[:default]
        elsif p[:required]
          # required configurable
          @params[p[:name]] = ENV[env_name] if ENV.key?(env_name)
        else
          # optional configurable
          @params[p[:name]] = ENV.key?(env_name) ? ENV[env_name] : p[:default]
        end
      end
      @params
    end
65097
def get_list(key, *default, **kwargs):
    """"""
    separator = kwargs.get('separator', ' ')
    return get_env(key, *default, coerce=lambda x: x.split(separator))
813467
function validateVar({ spec = {}, name, rawValue }) {
    if (typeof spec._parse !== 'function') {
        throw new EnvError(`Invalid spec for "${name}"`)
    }
    const value = spec._parse(rawValue)

    if (spec.choices) {
        if (!Array.isArray(spec.choices)) {
            throw new TypeError(`"choices" must be an array (in spec for "${name}")`)
        } else if (!spec.choices.includes(value)) {
            throw new EnvError(`Value "${value}" not in choices [${spec.choices}]`)
        }
    }
    if (value == null) throw new EnvError(`Invalid value for env var "${name}"`)
    return value
}
1307611
function processOptions(opt) {
        keys(opt).forEach(function (key) {
            var value = opt[key];
            if (typeof value === 'string') {
                opt[key] = grunt.template.process(value);
            } else if (Array.isArray(value)) {
                opt[key] = value.slice().map(function (i) {
                    return grunt.template.process(i);
                });
            }
        });
    }
484883
function getOptions(opts) {
  var options = {};
  for (var opt in defaultOptions) {
    options[opt] = opts && _util.has(opts, opt) ? opts[opt] : defaultOptions[opt];
  }if (options.allowReserved == null) options.allowReserved = options.ecmaVersion < 5;

  if (_util.isArray(options.onToken)) {
    (function () {
      var tokens = options.onToken;
      options.onToken = function (token) {
        return tokens.push(token);
      };
    })();
  }
  if (_util.isArray(options.onComment)) options.onComment = pushComment(options, options.onComment);

  return options;
}
742817
def _parse_env(self):
        
        env_cfg = DotDict()

        # if the env prefix doesn't end with '_', we'll append it here
        if self.env_prefix and not self.env_prefix.endswith('_'):
            self.env_prefix = self.env_prefix + '_'

        # if there is no scheme, we won't know what to look for so only parse
        # config if there is a scheme.
        if self.scheme:
            for k, v in self.scheme.flatten().items():
                value = v.parse_env(k, self.env_prefix, self.auto_env)
                if value is not None:
                    env_cfg[k] = value

        if len(env_cfg) > 0:
            # the configuration changes, so we invalidate the cached config
            self._full_config = None
            self._environment.update(env_cfg)
17609
def parse_options():
	

	parser = optparse.OptionParser(usage=USAGE, version=VERSION)

	parser.add_option("-o", "--ontology",
			action="store", type="string", default="", dest="ontology",
			help="Specifies which ontology to compare to.")

	opts, args = parser.parse_args()

	if len(args) < 1 or not opts.ontology:
		parser.print_help()
		raise SystemExit(1)

	return opts, args
1027091
def finalize_env(env):
    

    keys = _PLATFORM_ENV_KEYS.get(sys.platform, [])
    if 'PATH' not in keys:
        # this MUST be available due to Node.js (and others really)
        # needing something to look for binary locations when it shells
        # out to other binaries.
        keys.append('PATH')
    results = {
        key: os.environ.get(key, '') for key in keys
    }
    results.update(env)
    return results
1085025
function(env) {

			var envConfig = this.createEmptyConfig();

			if (env) {

				envConfig.env = env;

				Object.keys(env).filter(function(name) {
					return env[name];
				}).forEach(function(name) {
					var environment = Environments.name;

					if (environment) {
						if (environment.globals) {
							assign(envConfig.globals, environment.globals);
						}

						if (environment.parserOptions) {
							assign(envConfig.parserOptions, environment.parserOptions);
						}
					}
				});
			}

			return envConfig;
		}
10774
def getenv(option, default=undefined, cast=undefined):
    

    # We can't avoid __contains__ because value may be empty.
    if option in os.environ:
        value = os.environ[option]
    else:
        if isinstance(default, Undefined):
            raise UndefinedValueError('{} not found. Declare it as envvar or define a default value.'.format(option))

        value = default

    if isinstance(cast, Undefined):
        return value

    if cast is bool:
        value = _cast_boolean(value)
    elif cast is list:
        value = [x for x in value.split(',') if x]
    else:
        value = cast(value)

    return value
1225290
function parseEntities(value, options) {
  var settings = {}
  var option
  var key

  if (!options) {
    options = {}
  }

  for (key in defaults) {
    option = options[key]
    settings[key] =
      option === null || option === undefined ? defaults[key] : option
  }

  if (settings.position.indent || settings.position.start) {
    settings.indent = settings.position.indent || []
    settings.position = settings.position.start
  }

  return parse(value, settings)
}