Checks the value for possible keywords set in behat.yml file.
190413
private function checkForKeyword($value)
    {
        if (! isset($_SESSION['behat']['GenesisSqlExtension']['keywords'])) {
            return $value;
        }

        foreach ($_SESSION['behat']['GenesisSqlExtension']['keywords'] as $keyword => $val) {
            $key = sprintf('{%s}', $keyword);

            if ($value == $key) {
                $value = str_replace($key, $val, $value);
            }
        }

        return $value;
    }
78609
def _check_values(self, values):
        """"""
        assert isinstance(values, Iterable) and not \
            isinstance(values, (str, dict, bytes, bytearray)), \
            'values should be a list or tuple. Got {}'.format(type(values))
        assert len(values) == len(self.datetimes), \
            'Length of values list must match length of datetimes list. {} != {}'.format(
                len(values), len(self.datetimes))
        assert len(values) > 0, 'Data Collection must include at least one value'
707018
def _def_check(self):
        
        if self._def != dict():
            for key, val in iteritems_(self._def):
                if key not in list(TEXT_INDEX_ARGS.keys()):
                    raise CloudantArgumentError(127, key)
                if not isinstance(val, TEXT_INDEX_ARGS[key]):
                    raise CloudantArgumentError(128, key, TEXT_INDEX_ARGS[key])
386004
def has_bom(self, filestream):
        """"""

        content = filestream.read(4)
        if content == b'PK\x03\x04':
            # Zip file found.
            # Return `BINARY_ENCODE` as content is binary type,
            # but don't return None which means we don't know what we have.
            return filters.BINARY_ENCODE
        # We only handle zip files, so if we are checking this, we've already failed.
        return None
827514
def _checkAttribs(self, strict):
        """"""
        if self.min:
            warning("Minimum value not allowed for boolean-type parameter " +
                    self.name, strict)
            self.min = None
        if self.max:
            if not self.prompt:
                warning("Maximum value not allowed for boolean-type parameter " +
                                self.name + " (probably missing comma)",
                                strict)
                # try to recover by assuming max string is prompt
                self.prompt = self.max
            else:
                warning("Maximum value not allowed for boolean-type parameter " +
                        self.name, strict)
            self.max = None
        if self.choice:
            warning("Choice values not allowed for boolean-type parameter " +
                    self.name, strict)
            self.choice = None
869893
def _check_sample_config(items, in_file, config):
    
    logger.info("Checking sample YAML configuration: %s" % in_file)
    _check_quality_format(items)
    _check_for_duplicates(items, "lane")
    _check_for_duplicates(items, "description")
    _check_for_degenerate_interesting_groups(items)
    _check_for_batch_clashes(items)
    _check_for_problem_somatic_batches(items, config)
    _check_for_misplaced(items, "algorithm",
                         ["resources", "metadata", "analysis",
                          "description", "genome_build", "lane", "files"])

    [_check_toplevel_misplaced(x) for x in items]
    [_check_algorithm_keys(x) for x in items]
    [_check_algorithm_values(x) for x in items]
    [_check_aligner(x) for x in items]
    [_check_variantcaller(x) for x in items]
    [_check_svcaller(x) for x in items]
    [_check_hetcaller(x) for x in items]
    [_check_indelcaller(x) for x in items]
    [_check_jointcaller(x) for x in items]
    [_check_hlacaller(x) for x in items]
    [_check_realign(x) for x in items]
    [_check_trim(x) for x in items]
501678
function hasToSkip(value) {
            return options.skipWords.has(value) ||
                lodash.find(options.skipIfMatch, function (aPattern) {
                    return value.match(aPattern);
                });
        }
1341479
def check_backends(title):
    
    path = os.path.dirname(fulltext.backends.__file__)
    errs = []
    for name in os.listdir(path):
        if not name.endswith('.py'):
            continue
        if name == '__init__.py':
            continue

        mod_name = "fulltext.backends.%s" % (
            os.path.splitext(os.path.basename(name))[0])

        try:
            mod = __import__(mod_name, fromlist=[' '])
        except ImportError as err:
            errs.append((mod_name, str(err)))
            continue

        kw = dict(encoding='utf8', encoding_errors='strict',
                  kwargs={})
        try:
            inst = getattr(mod, "Backend")(**kw)
            if hasattr(inst, "check"):
                inst.check(title=title)
        except Exception as err:
            errs.append((mod.__name__, str(err)))
    if errs:
        for mod, err in errs:
            msg = hilite("%s: %s" % (mod, err), ok=False)
            print(msg, file=sys.stderr)
        sys.exit(1)
216396
def has_safe_repr(value):
    """"""
    if value is None or value is NotImplemented or value is Ellipsis:
        return True
    if type(value) in (bool, int, float, complex, range_type, Markup) + string_types:
        return True
    if type(value) in (tuple, list, set, frozenset):
        for item in value:
            if not has_safe_repr(item):
                return False
        return True
    elif type(value) is dict:
        for key, value in iteritems(value):
            if not has_safe_repr(key):
                return False
            if not has_safe_repr(value):
                return False
        return True
    return False
29020
def bool_lookup(value)
      return 'yes' if %w(true yes yep).include? value.to_s.downcase
      return 'no' if %w(false no nope).include? value.to_s.downcase
      value
    end
1323611
def validate_yaml(yaml_in, yaml_fn):
    """"""
    try:
        import yamllint.linter as linter
        from yamllint.config import YamlLintConfig
    except ImportError:
        return
    conf = """{"extends": "relaxed",
               "rules": {"trailing-spaces": {"level": "warning"},
                         "new-lines": {"level": "warning"},
                         "new-line-at-end-of-file": {"level": "warning"}}}"""
    if utils.file_exists(yaml_in):
        with open(yaml_in) as in_handle:
            yaml_in = in_handle.read()
    out = linter.run(yaml_in, YamlLintConfig(conf))

    for problem in out:
        msg = '%(fn)s:%(line)s:%(col)s: [%(level)s] %(msg)s' % {'fn': yaml_fn,
                                                                'line': problem.line,
                                                                'col': problem.column,
                                                                'level': problem.level,
                                                                'msg': problem.message}
        if problem.level == "error":
            raise ValueError(msg)
1148929
def _check(self, args):
        """"""
        if sum(bool(args[arg]) for arg in self._mapping) > 1:
            raise DocoptExit(_('These options are mutually exclusive: {0}',
                               ', '.join(self._mapping)))
91502
def check(text):
    """"""
    err = "glaad.offensive_terms"
    msg = "Offensive term. Remove it or consider the context."

    list = [
        "fag",
        "faggot",
        "dyke",
        "sodomite",
        "homosexual agenda",
        "gay agenda",
        "transvestite",
        "homosexual lifestyle",
        "gay lifestyle"
        # homo - may create false positives without additional context
        # FIXME use topic detetor to decide whether "homo" is offensive
    ]

    return existence_check(text, list, err, msg, join=True, ignore_case=False)
442662
def scan_for_spec(keyword):
    
    # Both 'spec' formats are wrapped in parens, discard
    keyword = keyword.lstrip('(').rstrip(')')
    # First, test for intermediate '1.2+' style
    matches = release_line_re.findall(keyword)
    if matches:
        return Spec(">={}".format(matches[0]))
    # Failing that, see if Spec can make sense of it
    try:
        return Spec(keyword)
    # I've only ever seen Spec fail with ValueError.
    except ValueError:
        return None
654418
def detect_config(self):
        """"""
        default_files = ("config.json", "config.yml")
        for file_ in default_files:
            if os.path.exists(file_):
                return file_
280036
def check(self):
        """"""
        for name, valItem, dtype in self.values:
            val = valItem.text()
            if dtype:
                try:
                    val = dtype(val)
                except:
                    msgBox = QtWidgets.QMessageBox()
                    msgBox.setText(
                        'attribute %s has not the right dtype(%s)' %
                        (name, str(dtype)))
                    msgBox.exec_()
            self.args[name] = val
        self.accept()
404679
def _search_vals(self, compiled_pattern, fld_val):
        """"""
        matches = []
        if isinstance(fld_val, set):
            for val in fld_val:
                self._search_val(matches, compiled_pattern, val)
        elif isinstance(fld_val, str):
            self._search_val(matches, compiled_pattern, fld_val)
        return matches