Propagates :func:`mailcap.find_match` but caches the mailcap (first
        argument)
973919
def mailcap_find_match(self, *args, **kwargs):
        
        return mailcap.findmatch(self._mailcaps, *args, **kwargs)
331132
def global_matches(self, text):
        
        import keyword
        matches = []
        seen = {"__builtins__"}
        n = len(text)
        for word in keyword.kwlist:
            if word[:n] == text:
                seen.add(word)
                matches.append(word)
        for nspace in [self.namespace, builtins.__dict__]:
            for word, val in nspace.items():
                if word[:n] == text and word not in seen:
                    seen.add(word)
                    matches.append(self._callable_postfix(val, word))
        return matches
234323
def confirm_top(match, data, nodegroups=None):
    '''
    
    '''
    matcher = 'compound'
    if not data:
        log.error('Received bad data when setting the match from the top '
                  'file')
        return False
    for item in data:
        if isinstance(item, dict):
            if 'match' in item:
                matcher = item['match']

    matchers = salt.loader.matchers(__opts__)
    funcname = matcher + '_match.match'
    if matcher == 'nodegroup':
        return matchers[funcname](match, nodegroups)
    else:
        m = matchers[funcname]
        return m(match)
865121
function _findEach(src, match, quotes, comments, callback) {
        var from = 0;
        var to;
        while (from < src.length) {
            to = _find(src, match, from, quotes, comments);
            if (to < 0) {
                to = src.length;
            }
            callback(src.substr(from, to - from));
            from = to + 1;
        }
    }
1232743
def global_matches(self, text):
        

        def get_item(obj, attr):
            return obj[attr]

        a = {}

        for dict_with_comps in [__builtin__.__dict__, self.namespace, self.global_namespace]:  # @UndefinedVariable
            a.update(dict_with_comps)

        filter = _StartsWithFilter(text)

        return dir2(a, a.keys(), get_item, filter)
1325644
function (pattern, options) {
    var self = this;
    function find() {
      var isMatch = lazy.mm.matcher(pattern, options);
      for (var key in self) {
        var val = self[key];
        if (typeof val === 'object' && isMatch(key)) {
          return val;
        }
      }
    }
    var res = this.fragmentCache(pattern, find);
    res.__proto__ = this;
    return res;
  }
3594
def match_in_args_kwargs(self, match_args, args, kwargs, allow_star_args=False):
        """"""
        req_len = 0
        arg_checks = {}
        to_match = []  # [(move_down, match, against)]
        for i, arg in enumerate(match_args):
            if isinstance(arg, tuple):
                (match, default) = arg
            else:
                match, default = arg, None
            names = get_match_names(match)
            if default is None:
                if not names:
                    req_len = i + 1
                    to_match.append((False, match, args + "[" + str(i) + "]"))
                else:
                    arg_checks[i] = (
                        # if i < req_len
                        " and ".join('"' + name + '" not in ' + kwargs for name in names),
                        # if i >= req_len
                        "_coconut.sum((_coconut.len(" + args + ") > " + str(i) + ", "
                        + ", ".join('"' + name + '" in ' + kwargs for name in names)
                        + ")) == 1",
                    )
                    tempvar = self.get_temp_var()
                    self.add_def(
                        tempvar + " = "
                        + args + "[" + str(i) + "] if _coconut.len(" + args + ") > " + str(i) + " else "
                        + "".join(kwargs + '.pop("' + name + '") if "' + name + '" in ' + kwargs + " else "
                                  for name in names[:-1])
                        + kwargs + '.pop("' + names[-1] + '")',
                    )
                    to_match.append((True, match, tempvar))
            else:
                if not names:
                    tempvar = self.get_temp_var()
                    self.add_def(tempvar + " = " + args + "[" + str(i) + "] if _coconut.len(" + args + ") > " + str(i) + " else " + default)
                    to_match.append((True, match, tempvar))
                else:
                    arg_checks[i] = (
                        # if i < req_len
                        None,
                        # if i >= req_len
                        "_coconut.sum((_coconut.len(" + args + ") > " + str(i) + ", "
                        + ", ".join('"' + name + '" in ' + kwargs for name in names)
                        + ")) <= 1",
                    )
                    tempvar = self.get_temp_var()
                    self.add_def(
                        tempvar + " = "
                        + args + "[" + str(i) + "] if _coconut.len(" + args + ") > " + str(i) + " else "
                        + "".join(
                            kwargs + '.pop("' + name + '") if "' + name + '" in ' + kwargs + " else "
                            for name in names
                        )
                        + default,
                    )
                    to_match.append((True, match, tempvar))

        max_len = None if allow_star_args else len(match_args)
        self.check_len_in(req_len, max_len, args)
        for i in sorted(arg_checks):
            lt_check, ge_check = arg_checks[i]
            if i < req_len:
                if lt_check is not None:
                    self.add_check(lt_check)
            else:
                if ge_check is not None:
                    self.add_check(ge_check)

        for move_down, match, against in to_match:
            if move_down:
                with self.down_a_level():
                    self.match(match, against)
            else:
                self.match(match, against)
109427
def find_matching(cls, message, channel):
		
		return (
			handler
			for handler in cls._registry
			if isinstance(handler, cls)
			and handler.match(message, channel)
		)
636788
def match(self, regexp, flags=None):
        """"""

        try:
            reg = _regexp_cache[(regexp, flags)]
        except KeyError:
            if flags:
                reg = re.compile(regexp, flags)
            else:
                reg = re.compile(regexp)
            _regexp_cache[(regexp, flags)] = reg

        return self.match_reg(reg)
1010730
async def get_match(self, m_id, force_update=False) -> Match:
        
        found_m = self._find_match(m_id)
        if force_update or found_m is None:
            await self.get_matches()
            found_m = self._find_match(m_id)
        return found_m
261746
def ignore_rule_matches_result(ignore_rule, pa11y_result):
    
    return all(
        fnmatch.fnmatch(pa11y_result.get(attr), ignore_rule.get(attr))
        for attr in ignore_rule.keys()
    )
148702
def cached(f):
    
    @functools.wraps(f)
    def wrapped(*args, **kwargs):
        with _cache_lock:
            identifier = (f.__name__,  args, kwargs)
            key = pickle.dumps(identifier)
            value = cache.get(key)
            if value is not None:
                logger.debug("HIT for %s -> %s" % (str(identifier), value))
            else:
                logger.debug("MISS for %s" % str(identifier))
                value = f(*args, **kwargs)
                cache[key] = value
            return value
    return wrapped
601686
def _name_matches(name, matches):
    '''
    
    '''
    for m in matches:
        if name.endswith(m):
            return True
        if name.lower().endswith('_' + m.lower()):
            return True
        if name.lower() == m.lower():
            return True
    return False
1116210
def get_match(self, match_id):
        """"""
        return self._make_req(endpoints.MATCH, dict(
            k=self.key,
            mp=match_id), Match)
1184001
def underscore_search(input, list, first_match=false)
      meth = first_match ? :find : :select
      return (first_match ? input : [input]) if list.include?(input)
      input = input.to_s
      if input.include?("_")
        underscore_regex = input.split('_').map {|e|
          Regexp.escape(e) }.join("([^_]+)?_")
        list.send(meth) {|e| e.to_s =~ /^#{underscore_regex}/ }
      else
        escaped_input = Regexp.escape(input)
        list.send(meth) {|e| e.to_s =~ /^#{escaped_input}/ }
      end
    end
801269
def find_first_match(basedir, string):
    
    matches = find(basedir, string)
    return matches[0] if matches else matches
373373
function( e, match ) {
		var result = { passed: false }, message = '';

		// Get a string for matching on the error
		if ( munit.isError( e ) ) {
			message = e.message;
		}
		else if ( munit.isString( e ) ) {
			message = e;
		}

		// No match required
		if ( match === undefined ) {
			result.passed = true;
		}
		// Non Error/String error object, string matching required
		else if ( ! munit.isError( e ) && ! munit.isString( e ) ) {
			if ( e === match ) {
				result.passed = true;
			}
			else {
				result.extra = "Match object '" + match + "' does not match error '" + e + "'";
			}
		}
		// Function error class matching
		else if ( munit.isFunction( match ) ) {
			if ( e instanceof match ) {
				result.passed = true;
			}
			else {
				result.extra = "Error does not match class '" + match.name + "'";
			}
		}
		// Regex checking on the error message
		else if ( munit.isRegExp( match ) ) {
			if ( match.exec( message ) ) {
				result.passed = true;
			}
			else {
				result.extra = "Regex (" + match + ") could not find match on:\n" + message;
			}
		}
		// String matching on the error message
		else if ( munit.isString( match ) ) {
			if ( match === message ) {
				result.passed = true;
			}
			else {
				result.extra = "Error message doesn't match:\nActual: " + message + "\nExpected: " + match;
			}
		}
		// Unkown error type passed
		else {
			result.extra = "Unknown error match type '" + match + "'";
		}

		return result;
	}