Validate that required env vars exist.

    :returns: True if required env vars exist.

    .. versionadded:: 0.0.12
776594
def valid_env_vars() -> bool:
    
    for envvar in _REQUIRED_ENV_VARS:
        try:
            _check_env_var(envvar)
        except KeyError as ex:
            LOG.error(ex)
            sys.exit(1)
    return True
275249
def validate(self):
        
        if (self.scheme is None or self.scheme != '') \
          and (self.host is None or self.host == ''):
            return False
        return True
708022
def _check_config_exists(config_file=None):
    '''
    
    '''
    if config_file is None:
        config_file = _config_file()
    if not os.path.isfile(config_file):
        return False
    return True
615575
def validate_current_versions(self):  # type: () -> bool
        
        versions = self.all_current_versions()
        for _, version in versions.items():
            if "Invalid Semantic Version" in version:
                logger.error(
                    "Invalid versions, can't compare them, can't determine if in sync"
                )
                return False

        if not versions:
            logger.warning("Found no versions, will use default 0.1.0")
            return True

        if not self.all_versions_equal(versions):
            if self.almost_the_same_version([x for x in versions.values()]):
                # TODO: disable with strict option
                logger.warning("Version very by a patch level, will use greater.")
                return True
            logger.error("Found various versions, how can we rationally pick?")
            logger.error(unicode(versions))
            return False

        for _ in versions:
            return True
        return False
1233813
def check_version(mod, required):
    """"""
    vers = tuple(int(v) for v in mod.__version__.split('.')[:3])
    if vers < required:
        req = '.'.join(str(v) for v in required)
        raise ImproperlyConfigured(
            "Module \"%s\" version (%s) must be >= %s." %
            (mod.__name__, mod.__version__, req))
817223
def environment_var_to_bool(env_var):
    

    # Try to see if env_var can be converted to an int
    try:
        env_var = int(env_var)
    except ValueError:
        pass

    if isinstance(env_var, numbers.Number):
        return bool(env_var)
    elif is_a_string(env_var):
        env_var = env_var.lower().strip()
        if env_var in "false":
            return False
        else:
            return True
    else:
        return bool(env_var)
222126
def _validate_config(config):
    
    required_keys = [KEY_ADDRESS, KEY_MODEL, KEY_PORT, KEY_PATHS]
    for key in required_keys:
        if key not in config:
            raise Error("Required key %s missing from config %s",
                        (key, config))
1289538
def has_envconfig() -> bool:
        
        if (os.getenv("VAULT_TOKEN", None) or
                (os.getenv("VAULT_APPID", None) and os.getenv("VAULT_USERID", None)) or
                (os.getenv("VAULT_SSLCERT", None) and os.getenv("VAULT_SSLKEY", None)) or
                (os.getenv("VAULT_ROLEID", None) and os.getenv("VAULT_SECRETID", None))):
            return True

        return False
815972
def is_in_virtualenv():
    

    pipenv_active = os.environ.get("PIPENV_ACTIVE", False)
    virtual_env = None
    use_system = False
    ignore_virtualenvs = bool(os.environ.get("PIPENV_IGNORE_VIRTUALENVS", False))

    if not pipenv_active and not ignore_virtualenvs:
        virtual_env = os.environ.get("VIRTUAL_ENV")
        use_system = bool(virtual_env)
    return (use_system or virtual_env) and not (pipenv_active or ignore_virtualenvs)
850246
protected function checkEnvVariable()
    {
        $key = $this->checkKey();
        $output = $this->execSSH("cd $this->domain;cat .env");
        if (str_contains($output, $key)) {
            $this->info("Key $key found in remote environment file");
        } else {
            $this->error("Key $key NOT found in remote environment file");
        }
    }
70219
def get_env():
    
    if not __ENV__:
        env = os.environ["env"] if "env" in os.environ else "Dev"
        set_env(env)
    return __ENV__
115049
def _validate(self):
        
        variable_names, _unused = getExprNames(self._expr, {})
        expr_indices = []
        for name in variable_names:
            if name == 'inf':
                continue
            match = _VARIABLE_NAME_RE.match(name)
            if not match:
                raise ValueError("%r is not a valid variable name" % name)
            expr_indices.append(int(match.group(2)))

        expr_indices.sort()
        expected_indices = list(range(len(self.inputs)))
        if expr_indices != expected_indices:
            raise ValueError(
                "Expected %s for variable indices, but got %s" % (
                    expected_indices, expr_indices,
                )
            )
        super(NumericalExpression, self)._validate()
972606
def necessary(self) -> bool:
        
        return any([
            self.trusted_proxy_headers,
            self.http_host,
            self.remote_addr,
            self.script_name,
            self.server_name,
            self.server_port,
            self.url_scheme,
            self.rewrite_path_info,
        ])
153227
def is_required_version(version, specified_version):
    
    # Certain packages may be defined with multiple values.
    if isinstance(specified_version, dict):
        specified_version = specified_version.get("version", "")
    if specified_version.startswith("=="):
        return version.strip() == specified_version.split("==")[1].strip()

    return True
200601
def validate(self):
        
        required_fields = list(filter(lambda x: self._fields[x], self._fields.keys()))
        for field in (self._top_fields + required_fields):
            if not hasattr(self, field) or hasattr(self, field) and getattr(self, field) == None:
                raise MissingFieldError(field)
1197759
def verify(conf, input_requirements_filename):
    
    exit_if_file_not_exists(input_requirements_filename, conf)

    cireqs.check_if_requirements_are_up_to_date(
        requirements_filename=input_requirements_filename,
        **conf._asdict())
    click.echo(click.style('✓', fg='green') + " {} has been verified".format(input_requirements_filename))
788992
def env(key, default=None, required=False):
    
    try:
        value = os.environ[key]
        return ast.literal_eval(value)
    except (SyntaxError, ValueError):
        return value
    except KeyError:
        if default or not required:
            return default
        raise ImproperlyConfigured(
            "Missing required environment variable '%s'" % key)