Search pattern in archive members.
555861
def search_archive(pattern, archive, verbosity=0, interactive=True):
    """"""
    if not pattern:
        raise util.PatoolError("empty search pattern")
    util.check_existing_filename(archive)
    if verbosity >= 0:
        util.log_info("Searching %r in %s ..." % (pattern, archive))
    res = _search_archive(pattern, archive, verbosity=verbosity, interactive=interactive)
    if res == 1 and verbosity >= 0:
        util.log_info("... %r not found" % pattern)
    return res
1260952
def do_find(lookup, term):
    """"""

    space = defaultdict(list)

    for name in lookup.keys():
        space[name].append(name)

    try:
        iter_lookup = lookup.iteritems()  # Python 2
    except AttributeError:
        iter_lookup = lookup.items()  # Python 3

    for name, definition in iter_lookup:
        for keyword in definition['keywords']:
            space[keyword].append(name)
        space[definition['category']].append(name)

    matches = fnmatch.filter(space.keys(), term)

    results = set()
    for match in matches:
        results.update(space[match])

    return [(r, translate(lookup, r)) for r in results]
927748
private static List<File> findFilesInDirectory(File directory,
			Pattern pattern, boolean scanRecursive) {
		List<File> files = new ArrayList<File>();
		String[] filesInDirectory = directory.list();
		if (filesInDirectory == null) {
			return files;
		}
		for (String fileToCheck : filesInDirectory) {
			File file = new File(directory, fileToCheck);
			if (file.isFile()) {
				if (pattern.matcher(fileToCheck).matches()) {
					files.add(file);
				}
			} else if (file.isDirectory()) {
				if (scanRecursive) {
					files.addAll(findFilesInDirectory(file, pattern,
							scanRecursive));
				}
			}
		}
		return files;
	}
325578
def query_names(self, pat):
        """"""

        for item in self.chnames.items():
            if fnmatch.fnmatchcase(item[1], pat):
                print item
708097
def match_entries(entries, pattern):
    """"""
    matching = []

    for variant in expand_braces(pattern):
        matching.extend(fnmatch.filter(entries, variant))

    return list(_deduplicate(matching))
298235
def search(cls, args):
        """"""
        safe_shell_pat = re.escape(args['<pattern>']).replace(r'\*', '.*')
        pat_str = '.*{}.*'.format(safe_shell_pat)
        pattern = re.compile(pat_str, re.IGNORECASE)
        remote_json = NAppsManager.search(pattern)
        remote = set()
        for napp in remote_json:
            # WARNING: This will be changed in future versions, when 'author'
            # will be removed.
            username = napp.get('username', napp.get('author'))
            remote.add(((username, napp.get('name')), napp.get('description')))

        cls._print_napps(remote)
182833
def search_file(pattern, file_path):
    
    try:
        with open(file_path) as file:
            string = file.read()
    except PermissionError:
        return []

    matches = re.findall(pattern, string)

    return matches
1081639
def match_zipfile_members(zipfile_path: str, pattern: Pattern):
    """"""

    with ZipFile(zipfile_path, mode='r') as zfile:
        members = zfile.namelist()

    yield from match_files(members, pattern)
458047
def search(pattern, text):
    ''
    return re.compile(str(pattern)).search(str(text))
610400
def _inner_search(obj, glob, separator, dirs=True, leaves=False):
    """"""
    for path in dpath.path.paths(obj, dirs, leaves, skip=True):
        if dpath.path.match(path, glob):
            yield path
1118063
def entries(self):
        """"""
        timer = Timer()
        passwords = []
        logger.info("Scanning %s ..", format_path(self.directory))
        listing = self.context.capture("find", "-type", "f", "-name", "*.gpg", "-print0")
        for filename in split(listing, "\0"):
            basename, extension = os.path.splitext(filename)
            if extension == ".gpg":
                # We use os.path.normpath() to remove the leading `./' prefixes
                # that `find' adds because it searches the working directory.
                passwords.append(PasswordEntry(name=os.path.normpath(basename), store=self))
        logger.verbose("Found %s in %s.", pluralize(len(passwords), "password"), timer)
        return natsort(passwords, key=lambda e: e.name)
887030
def recherche(self, pattern, entete, in_all=False):
        """"""
        if in_all:
            self.collection = self.get_all()
        self.collection.recherche(pattern, entete)
        self._reset_render()
        return len(self.collection)
678088
def search(self):
        

        self.__interrupt_search()

        search_pattern = self.Search_comboBox.currentText()
        replacement_pattern = self.Replace_With_comboBox.currentText()
        if not search_pattern:
            return False

        SearchAndReplace.insert_pattern(search_pattern, self.__search_patterns_model)
        SearchAndReplace.insert_pattern(replacement_pattern, self.__replace_with_patterns_model)

        location = umbra.ui.common.parse_location(
            foundations.strings.to_string(self.Where_lineEdit.text()) or
            self.__targets_format.format(self.__default_target))
        self.__ignore_hidden_files and location.filters_out.append("\\\.|/\.")

        settings = self.__get_settings()

        self.__search_worker_thread = Search_worker(self, search_pattern, location, settings)
        # Signals / Slots.
        self.__search_worker_thread.searchFinished.connect(self.__search_worker_thread__searchFinished)

        self.__container.engine.worker_threads.append(self.__search_worker_thread)
        self.__container.engine.start_processing("Searching In Files ...")
        self.__search_worker_thread.start()
        return True
1203271
def pattern(self):
        """"""
        if not self._pattern:

            # trigger evaluation of operation
            if (self.operation in ['query', 'getmore', 'update', 'remove'] or
                    self.command in ['count', 'findandmodify']):
                self._pattern = self._find_pattern('query: ')
            elif self.command == 'find':
                self._pattern = self._find_pattern('filter: ')

        return self._pattern
1366821
def _cached_search_compile(pattern, re_verbose, re_version, pattern_type):
    """"""

    return _bre_parse._SearchParser(pattern, re_verbose, re_version).parse()
1017729
def _find_matching_collections_internally(collections, record):
    
    for name, data in iteritems(collections):
        if _build_query(data['query']).match(record):
            yield data['ancestors']
    raise StopIteration
504334
def find_macthing_files(match):
    """"""
    last_slash = match.rfind('/')
    if last_slash == -1:
        dirname = '.'
        match_prefix = match
        result_prefix = ''
    else:
        dirname = match[0:last_slash]
        match_prefix = match[last_slash + 1:]
        result_prefix = dirname + '/'
    return [result_prefix + filename for filename in os.listdir(dirname) if filename.startswith(match_prefix)]