check compatibility of accept_keywords
552160
def _check_accept_keywords(approved, flag):
    ''''''
    if flag in approved:
        return False
    elif (flag.startswith('~') and flag[1:] in approved) \
            or ('~'+flag in approved):
        return False
    else:
        return True
358926
function matchKeyword(keyword) {
        var token = lookahead();
        return token.type === Token.Keyword && token.value === keyword;
    }
1300747
def file_accept(files, patterns)
      files.select { |file| patterns.any? { |pattern| file =~ pattern } }
    end
233726
def python_2_unicode_compatible(klass):
    """"""
    if six.PY2:
        if '__str__' not in klass.__dict__:
            raise ValueError("Define __str__() on %s to use @python_2_unicode_compatible" % klass.__name__)
        if '__repr__' not in klass.__dict__:
            raise ValueError("Define __repr__() on %s to use @python_2_unicode_compatible" % klass.__name__)
        klass.__unicode__ = klass.__str__
        klass._unicode_repr = klass.__repr__
        klass.__str__ = lambda self: self.__unicode__().encode('utf-8')
        klass.__repr__ = lambda self: self._unicode_repr().encode('ascii', errors='backslashreplace')
    return klass
570011
def _sort_kw_matches(skw_matches, limit=0):
    """"""
    sorted_keywords = list(skw_matches.items())
    sorted(sorted_keywords, key=cmp_to_key(_skw_matches_comparator))
    return limit and sorted_keywords[:limit] or sorted_keywords
1026835
def _check_for_python_keywords(self, kwargs):
        """"""

        kwargs_copy = copy.deepcopy(kwargs)
        for key, val in iteritems(kwargs):
            if isinstance(val, dict):
                kwargs_copy[key] = self._check_for_python_keywords(val)
            elif isinstance(val, list):
                kwargs_copy[key] = self._iter_list_for_dicts(val)
            else:
                if key.endswith('_'):
                    strip_key = key.rstrip('_')
                    if keyword.iskeyword(strip_key):
                        kwargs_copy[strip_key] = val
                        kwargs_copy.pop(key)
        return kwargs_copy
233875
function compatibleTypes(x,y) {
	if (x === y)
		return true;
	if (x instanceof TQualifiedReference && y instanceof TQualifiedReference)
		return x.qname === y.qname;
	return false;
}
32713
def _is_accepted_input(self, input_string):
        
        ret = False
        accept_filter = (self.volume_string, "http stream debug: ")
        reject_filter = ()
        for n in accept_filter:
            if n in input_string:
                ret = True
                break
        if ret:
            for n in reject_filter:
                if n in input_string:
                    ret = False
                    break
        return ret
650821
def check_searching_param(searching_param, allowed)
      🔞 = searching_param.keys.map(&:to_sym) - allowed.map(&:to_sym)
      raise InvalidSearchException, "Attributes #{🔞.map(&:to_s).to_sentence} doesn't exists or aren't searchables. Available searchs are: #{allowed.to_sentence}" if 🔞.any?
    end
1161225
def _check_for_mismatches(self, known_keys):
        """"""
        for a_value_source in self.values_source_list:
            try:
                if a_value_source.always_ignore_mismatches:
                    continue
            except AttributeError:
                # ok, this values source doesn't have the concept
                # always igoring mismatches, we won't tolerate mismatches
                pass
            # we want to fetch the keys from the value sources so that we can
            # check for mismatches.  Commandline value sources, are different,
            # we never want to allow unmatched keys from the command line.
            # By detecting if this value source is a command line source, we
            # can employ the command line's own mismatch detection.  The
            # boolean 'allow_mismatches' controls application of the tollerance
            # for mismatches.
            if hasattr(a_value_source, 'command_line_value_source'):
                allow_mismatches = False
            else:
                allow_mismatches = True
            # make a set of all the keys from a value source in the form
            # of strings like this: 'x.y.z'
            value_source_mapping = a_value_source.get_values(
                self,
                allow_mismatches,
                self.value_source_object_hook
            )
            value_source_keys_set = set([
                k for k in
                DotDict(value_source_mapping).keys_breadth_first()
            ])
            # make a set of the keys that didn't match any of the known
            # keys in the requirements
            unmatched_keys = value_source_keys_set.difference(known_keys)
            # some of the unmatched keys may actually be ok because the were
            # used during acquisition.
            # remove keys of the form 'y.z' if they match a known key of the
            # form 'x.y.z'
            for key in unmatched_keys.copy():
                key_is_okay = six.moves.reduce(
                    lambda x, y: x or y,
                    (known_key.endswith(key) for known_key in known_keys)
                )
                if key_is_okay:
                    unmatched_keys.remove(key)
            # anything left in the unmatched_key set is a badly formed key.
            # issue a warning
            if unmatched_keys:
                if self.option_definitions.admin.strict.default:
                    # raise hell...
                    if len(unmatched_keys) > 1:
                        raise NotAnOptionError(
                            "%s are not valid Options" % unmatched_keys
                        )
                    elif len(unmatched_keys) == 1:
                        raise NotAnOptionError(
                            "%s is not a valid Option" % unmatched_keys.pop()
                        )
                else:
                    warnings.warn(
                        'Invalid options: %s' % ', '.join(sorted(unmatched_keys))
                    )
975956
def accept(self):
        """"""
        if not self.runconfigoptions.is_valid():
            return
        configurations = _get_run_configurations()
        configurations.insert(0, (self.filename, self.runconfigoptions.get()))
        _set_run_configurations(configurations)
        QDialog.accept(self)
133187
def is_supported(value, check_all=False, filters=None, iterate=False):
    """"""
    assert filters is not None
    if value is None:
        return True
    if not is_editable_type(value):
        return False
    elif not isinstance(value, filters):
        return False
    elif iterate:
        if isinstance(value, (list, tuple, set)):
            valid_count = 0
            for val in value:
                if is_supported(val, filters=filters, iterate=check_all):
                    valid_count += 1
                if not check_all:
                    break
            return valid_count > 0
        elif isinstance(value, dict):
            for key, val in list(value.items()):
                if not is_supported(key, filters=filters, iterate=check_all) \
                   or not is_supported(val, filters=filters,
                                       iterate=check_all):
                    return False
                if not check_all:
                    break
    return True
1135981
def _validate_incompatibilities(self, incompatibles):
        """"""
        for element in incompatibles:
            if type(element) is list:
                i = [a for a in element if self._get_parameter(a)]
                if len(i) > 1:
                    raise ValueError("Options {} are incompatible".format(" and ".join(i)))
            elif type(incompatibles) is dict:
                if self._get_parameter(element):
                    for b in incompatibles[element]:
                        if self._get_parameter(b):
                            raise ValueError("Options %s and %s are incompatible."
                                             % (element, b))
            else:
                for a in element:
                    if self._get_parameter(a):
                        for b in incompatibles[a]:
                            if self._get_parameter(b):
                                raise ValueError("Options %s and %s are incompatible."
                                                 % (a, b))
876878
def accept_all(self):
        '''
        
        '''
        keys = self.list_keys()
        for key in keys[self.PEND]:
            try:
                shutil.move(
                        os.path.join(
                            self.opts['pki_dir'],
                            self.PEND,
                            key),
                        os.path.join(
                            self.opts['pki_dir'],
                            self.ACC,
                            key)
                        )
                eload = {'result': True,
                         'act': 'accept',
                         'id': key}
                self.event.fire_event(eload,
                                      salt.utils.event.tagify(prefix='key'))
            except (IOError, OSError):
                pass
        return self.list_keys()
1269008
def check_compatibility(self):
        """"""
        message = ''
        value = True
        if PYQT4 or PYSIDE:
            message = _("You are working with Qt4 and in order to use this "
                        "plugin you need to have Qt5.<br><br>"
                        "Please update your Qt and/or PyQt packages to "
                        "meet this requirement.")
            value = False
        return value, message
124094
def accept(self):
        """"""
        newsock, addr = socket.accept(self)
        ssl_sock = SSLSocket(newsock._sock,
                             keyfile=self.keyfile,
                             certfile=self.certfile,
                             server_side=True,
                             cert_reqs=self.cert_reqs,
                             ssl_version=self.ssl_version,
                             ca_certs=self.ca_certs,
                             do_handshake_on_connect=self.do_handshake_on_connect,
                             suppress_ragged_eofs=self.suppress_ragged_eofs,
                             ciphers=self.ciphers)
        return ssl_sock, addr
1163623
def redirect_to_terms_accept(current_path='/', slug='default'):
    """"""
    redirect_url_parts = list(urlparse(ACCEPT_TERMS_PATH))
    if slug != 'default':
        redirect_url_parts[2] += slug
    querystring = QueryDict(redirect_url_parts[4], mutable=True)
    querystring[TERMS_RETURNTO_PARAM] = current_path
    redirect_url_parts[4] = querystring.urlencode(safe='/')
    return HttpResponseRedirect(urlunparse(redirect_url_parts))