Given a set of files in this directory, returns all the files that
        match the :class:`Pattern` instances which match this directory.
545454
def match(self, files):
        """"""
        if not files:
            return set()

        if (self.matched_inherit.all_files()
                or self.matched_and_subdir.all_files()
                or self.matched_no_subdir.all_files()):
            # Optimization: one of the matched patterns matches everything
            # So simply return it
            return set(files)

        unmatched = set(files)
        matched = set()
        for pattern_set in self._matching_pattern_sets():
            pattern_set.match_files(matched, unmatched)
            if not unmatched:
                # Optimization: If we have matched all files already
                # simply return at this point - nothing else to do
                break

        return matched
1245863
def patterns(self):
        
        # No explicit argument for patterns ==> consider the first source argument as pattern.
        if not self.args.patterns and not self.args.pattern_files:
            try:
                self.args.patterns.append(self.args.files.pop(0))
            except IndexError:
                raise LogRaptorArgumentError('PATTERN', 'no search pattern')

        # Get the patterns from arguments and files
        patterns = set()
        if self.args.pattern_files:
            patterns.update([p.rstrip('\n') for p in fileinput.input(self.args.pattern_files)])
        patterns.update(self.args.patterns)
        logger.debug("search patterns to be processed: %r", patterns)

        # If one pattern is empty then skip the other patterns
        if '' in patterns:
            logger.info("an empty pattern provided: match all strings!")
            return tuple()

        try:
            flags = re.IGNORECASE if self.args.case else 0 | re.UNICODE
            return tuple([
                re.compile(r'(\b%s\b)' % pat if self.args.word else '(%s)' % pat, flags=flags)
                for pat in patterns if pat
            ])
        except re.error as err:
            raise LogRaptorArgumentError('wrong regex syntax for pattern: %r' % err)
71732
def glob(*args):
    
    if len(args) is 1 and isinstance(args[0], list):
        args = args[0]
    matches = []
    for pattern in args:
        for item in glob2.glob(pattern):
            if not os.path.isdir(item):
                matches.append(item)
    return matches
143
def match_files(self, matched, unmatched):
        """"""
        for pattern in self.iter():
            pattern.match_files(matched, unmatched)
            if not unmatched:
                # Optimization: If we have matched all files already
                # simply return at this point - nothing else to do
                break
1124555
def match_files(files, pattern: Pattern):
    """"""

    for name in files:
        if re.match(pattern, name):
            yield name
722373
def match_filenames(filenames, pattern):
    """"""
    matching = []

    for filename in filenames:
        if fnmatch(get_filebase(filename, pattern), globify(pattern)):
            matching.append(filename)

    return matching
471825
def iterfiles(self, pattern=None, abspath=False):
        
        if pattern is not None:
            globster = Globster([pattern])
        for root, dirs, files in self.walk():
            for f in files:
                if pattern is None or (pattern is not None and globster.match(f)):
                    if abspath:
                        yield os.path.join(root, f)
                    else:
                        yield self.relpath(os.path.join(root, f))
737230
def findall(dir=os.curdir):
    
    files = _find_all_simple(dir)
    if dir == os.curdir:
        make_rel = functools.partial(os.path.relpath, start=dir)
        files = map(make_rel, files)
    return list(files)
973464
def _find_files(directory):
    
    pattern = "{directory}/*.xml".format(
        directory=directory,
    )
    files = glob(pattern)
    return files
552785
def get_file(self,pattern):
        '''
         
        '''
        flag=[fnmatch.fnmatch(l,pattern) for l in self.filelist]
        id=self.fid_list.compress(flag)
        flag = self.fileid == id
        return flag
429775
def find_files(self):
        ''''''
        for path in self.paths:
            for subpath, dirs, files in os.walk(path):
                for filename in files:
                    (name, ext) = os.path.splitext(filename)
                    if ext in self.extensions:
                        yield os.path.join(subpath, filename)
91949
def load(self, patterns, dirs, ignore=None):
        
        for dir_ in dirs:
            dir_root = dir_
            if os.path.exists(os.path.join(dir_, "__init__.py")):
                dir_root = os.path.abspath(os.path.join(dir_, os.pardir))

            for path in self.find_files(patterns=patterns, dirs=[dir_], ignore=ignore):
                data = self.read_file(path=path)
                if data:
                    data["relative_path"] = os.path.relpath(path, dir_root)
                    self.paths[path] = data
1152920
def _compare(self, dir1, dir2):
        

        left = set()
        right = set()

        self._numdirs += 1

        excl_patterns = set(self._exclude).union(self._ignore)

        for cwd, dirs, files in os.walk(dir1):
            self._numdirs += len(dirs)
            for f in dirs + files:
                path = os.path.relpath(os.path.join(cwd, f), dir1)
                re_path = path.replace('\\', '/')
                if self._only:
                    for pattern in self._only:
                        if re.match(pattern, re_path):
                            # go to exclude and ignore filtering
                            break
                    else:
                        # next item, this one does not match any pattern
                        # in the _only list
                        continue

                add_path = False
                for pattern in self._include:
                    if re.match(pattern, re_path):
                        add_path = True
                        break
                else:
                    # path was not in includes
                    # test if it is in excludes
                    for pattern in excl_patterns:
                        if re.match(pattern, re_path):
                            # path is in excludes, do not add it
                            break
                    else:
                        # path was not in excludes
                        # it should be added
                        add_path = True

                if add_path:
                    left.add(path)
                    anc_dirs = re_path[:-1].split('/')
                    for i in range(1, len(anc_dirs)):
                        left.add('/'.join(anc_dirs[:i]))

        for cwd, dirs, files in os.walk(dir2):
            for f in dirs + files:
                path = os.path.relpath(os.path.join(cwd, f), dir2)
                re_path = path.replace('\\', '/')
                for pattern in self._ignore:
                    if re.match(pattern, re_path):
                        if f in dirs:
                            dirs.remove(f)
                        break
                else:
                    right.add(path)
                    # no need to add the parent dirs here,
                    # as there is no _only pattern detection
                    if f in dirs and path not in left:
                        self._numdirs += 1

        common = left.intersection(right)
        left.difference_update(common)
        right.difference_update(common)

        return DCMP(left, right, common)
658184
def find(self, pattern):
        
        output = []

        def _find(dir):
            if re.match(pattern, dir._filename.split("/")[-1]):
                output.append(dir)
            if dir.is_directory():
                for c in dir.children:
                    _find(c)
        _find(self)
        return output
570335
def find_class_files(self):
        
        files = self._find_files()
        self.announce(
            "found '{}' compiled class files in '{}'".format(
                len(files), self.root
            )
        )
        return files
381748
def find(pattern: str, path: str) -> List[str]:
    
    result = []
    for root, dirs, files in os.walk(path):
        for name in files:
            if fnmatch.fnmatch(name, pattern):
                result.append(os.path.join(root, name))
    return result
1128746
def find_directories(root, pattern):
    
    results = []
    for base, dirs, files in os.walk(root):
        matched = fnmatch.filter(dirs, pattern)
        results.extend(os.path.join(base, d) for d in matched)
    return results