Compares the file entry against the filter.

    Args:
      file_entry (dfvfs.FileEntry): file entry to compare.

    Returns:
      bool: True if the file entry matches the filter.
359458
def Matches(self, file_entry):
    
    if not self._names or not file_entry.IsFile():
      return False

    return file_entry.name.lower() in self._names
71982
def should_exclude(self, filename) -> bool:
        
        for skip_glob in self.skip_globs:
            if self.filename_matches_glob(filename, skip_glob):
                return True
        return False
494430
public boolean fileMatchesRules(File file) {

        try {
            if(file.exists()) {
                if(includeFilesContainingText.length == 0 && excludeFilesContainingText.length == 0) {
                    return fileMatchesRules(
							getComparableFileName(file));
                } else {
                    return fileMatchesRules(
							getComparableFileName(file),
                            FileSupport.getTextFileFromFS(file));
                }
            }
        } catch (IOException ioe) {
            //at the moment file does not match rules
        }
		return false;
	}
21988
def match(self, fname, flevel, ftype):
        ''''''
        # if filetype is the same
        # and level isn't set or level is the same
        # and pattern matche the filename
        if self.filetype == ftype and (self.level is None or self.level == flevel) and fnmatch.fnmatch(fname, self.pattern):
            return self.score
        return 0
176774
def FileEntryExistsByPathSpec(self, path_spec):
    
    volume_index = apfs_helper.APFSContainerPathSpecGetVolumeIndex(path_spec)

    # The virtual root file has not corresponding volume index but
    # should have a location.
    if volume_index is None:
      location = getattr(path_spec, 'location', None)
      return location is not None and location == self.LOCATION_ROOT

    return 0 <= volume_index < self._fsapfs_container.number_of_volumes
973052
def valid_file?(entry)
      ext = File.extname(entry).gsub(/\./, "").downcase
      File.file?(source.join(entry)) && EXTENSIONS.include?(ext) && entry !~ IGNORE_FILES
    end
400738
def Matches(self, file_entry):
    
    if not self._file_scanner or not file_entry.IsFile():
      return None

    file_object = file_entry.GetFileObject()
    if not file_object:
      return False

    try:
      scan_state = pysigscan.scan_state()
      self._file_scanner.scan_file_object(scan_state, file_object)

    except IOError as exception:
      # TODO: replace location by display name.
      location = getattr(file_entry.path_spec, 'location', '')
      logging.error((
          '[skipping] unable to scan file: {0:s} for signatures '
          'with error: {1!s}').format(location, exception))
      return False

    finally:
      file_object.close()

    return scan_state.number_of_scan_results > 0
526121
def _CheckIsDirectory(self, file_entry):
    
    if definitions.FILE_ENTRY_TYPE_DIRECTORY not in self._file_entry_types:
      return False
    return file_entry.IsDirectory()
766096
public static boolean compareFilesByExtension(final File sourceFile, final File fileToCompare)
	{
		return CompareFileExtensions
			.compareFiles(sourceFile, fileToCompare, true, false, true, true, true, true)
			.getFileExtensionEquality();
	}
1052527
def get_entry(self, entry_id):
        

        if entry_id in self._entries:
            return self._entries[entry_id]
        else:
            entry_offset = entry_id * self.entry_size

            # load entry
            entry = MftEntry(
                filename=self.filename,
                offset=self.offset + entry_offset,
                length=self.entry_size,
                index=entry_id
            )

            # cache entry
            self._entries[entry_id] = entry

            return entry
639885
public static boolean entryEquals(ZipFile zf1, ZipFile zf2, String path1, String path2) {
    try {
      return doEntryEquals(zf1, zf2, path1, path2);
    }
    catch (IOException e) {
      throw ZipExceptionUtil.rethrow(e);
    }
  }
609458
def match_entry_line(str_to_match, regex_obj=MAIN_REGEX_OBJ):
    """"""
    match_obj = regex_obj.match(str_to_match)
    if not match_obj:
        error_message = ('Line "%s" is unrecognized by overlay4u. '
                'This is only meant for use with Ubuntu Linux.')
        raise UnrecognizedMountEntry(error_message % str_to_match)
    return match_obj.groupdict()
278362
private ChmEntry findEntry(String file) {
        for (ChmEntry entry : entries) {
            if (file.equals(entry.getSourcePath())) {
                return entry;
            }
        }

        return null;
    }
710469
def FileEntryExistsByPathSpec(self, path_spec):
    
    # Opening a file by identifier is faster than opening a file by location.
    fsapfs_file_entry = None
    location = getattr(path_spec, 'location', None)
    identifier = getattr(path_spec, 'identifier', None)

    try:
      if identifier is not None:
        fsapfs_file_entry = self._fsapfs_volume.get_file_entry_by_identifier(
            identifier)
      elif location is not None:
        fsapfs_file_entry = self._fsapfs_volume.get_file_entry_by_path(location)

    except IOError as exception:
      raise errors.BackEndError(exception)

    return fsapfs_file_entry is not None
258879
def write_entry_to_file(file_descriptor, entry_comment, entry_key):
    
    escaped_key = re.sub(r'([^\\])"', '\\1\\"', entry_key)
    file_descriptor.write(u'/* %s */\n' % entry_comment)
    file_descriptor.write(u'"%s" = "%s";\n' % (escaped_key, escaped_key))
897652
def on_need_compare(self, pair):
        """"""
        # print("on_need_compare", pair)
        # If no metadata is available, we could only classify file entries as
        # 'existing'.
        # Now we use peer information to improve this classification.
        c_pair = (pair.local_classification, pair.remote_classification)

        org_pair = c_pair
        org_operation = pair.operation

        # print("need_compare", pair)

        if pair.is_dir:
            # For directores, we cannot compare existing peer entries.
            # Instead, we simply log (and traverse the children later).
            pair.local_classification = pair.remote_classification = "existing"
            pair.operation = "equal"
            self._log_action("", "visit", "?", pair.local, min_level=4)
            # self._log_action("", "equal", "=", pair.local, min_level=4)
            return

        elif c_pair == ("existing", "existing"):
            # Naive classification derived from file time and size
            time_cmp = eps_compare(
                pair.local.mtime, pair.remote.mtime, FileEntry.EPS_TIME
            )
            if time_cmp < 0:
                c_pair = ("unmodified", "modified")  # remote is newer
            elif time_cmp > 0:
                c_pair = ("modified", "unmodified")  # local is newer
            elif pair.local.size == pair.remote.size:
                c_pair = ("unmodified", "unmodified")  # equal
            else:
                c_pair = ("modified", "modified")  # conflict!

        elif c_pair == ("new", "new"):
            # Naive classification derived from file time and size
            time_cmp = eps_compare(
                pair.local.mtime, pair.remote.mtime, FileEntry.EPS_TIME
            )
            if time_cmp == 0 and pair.local.size == pair.remote.size:
                c_pair = ("unmodified", "unmodified")  # equal
            else:
                c_pair = ("modified", "modified")  # conflict!

        # elif c_pair == ("unmodified", "unmodified"):

        pair.local_classification = c_pair[0]
        pair.remote_classification = c_pair[1]

        pair.operation = operation_map.get(c_pair)
        # print("on_need_compare {} => {}".format(org_pair, pair))
        if not pair.operation:
            raise RuntimeError(
                "Undefined operation for pair classification {}".format(c_pair)
            )
        elif pair.operation == org_operation:
            raise RuntimeError("Could not re-classify  {}".format(org_pair))

        handler = getattr(self, "on_" + pair.operation, None)
        res = handler(pair)
        #         self._log_action("", "different", "?", pair.local, min_level=2)
        return res
660207
def check_parameter_similarity(files_dict):
    
    try:
        parameter_names = files_dict.itervalues().next().keys()  # get the parameter names of the first file, to check if these are the same in the other files
    except AttributeError:  # if there is no parameter at all
        if any(i is not None for i in files_dict.itervalues()):  # check if there is also no parameter for the other files
            return False
        else:
            return True
    if any(parameter_names != i.keys() for i in files_dict.itervalues()):
        return False
    return True