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, False if not or
          None if the filter does not apply.
775802
def Matches(self, file_entry):
    
    location = getattr(file_entry.path_spec, 'location', None)
    if not location:
      return None

    if '.' not in location:
      return False

    _, _, extension = location.rpartition('.')
    return extension.lower() in self._extensions
94794
public boolean compare(EvidenceDir baseDir, EvidenceDir targetDir, File evidenceFile) {

        LOG.info("screenshot.compare",
                new Object[] { evidenceFile, baseDir.getDir(), targetDir.getDir() });

        if (!baseDir.exists()) {
            LOG.info("base.dir.none", baseDir.getDir().getPath());
            return false;
        }

        Map<String, File> baseSsMap = baseDir.getScreenshotFilesAsMap(evidenceFile.getName());
        boolean match = true;

        for (Entry<String, File> targetEntry : targetDir
                .getScreenshotFilesAsMap(evidenceFile.getName()).entrySet()) {

            if (baseSsMap.get(EvidenceDir.toMaskSsName(targetEntry.getKey())) != null) {
                continue;
            }

            File baseSs = baseSsMap.get(targetEntry.getKey());
            File targetSs = targetEntry.getValue();

            if (baseSs == null) {
                LOG.warn("base.screenshot.none", targetEntry.getKey());
                match = false;
                continue;
            }

            match &= compareOneScreenshot(baseSs, targetSs, 10, 10);
        }

        return match;
    }
744006
def IsFile(self):
    
    if self._stat_object is None:
      self._stat_object = self._GetStat()
    if self._stat_object is not None:
      self.entry_type = self._stat_object.type
    return self.entry_type == definitions.FILE_ENTRY_TYPE_FILE
472684
public boolean filterMatches(AbstractItem item)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "filterMatches", item);

		/* Cast the incoming item to a subscriptionState object. if it is not, an
		 * exception will be thrown and the match will fail */

    ConsumerDispatcherState subState = null;

    if (item instanceof DurableSubscriptionItemStream) 
    {
      try
      {
        subState = ((DurableSubscriptionItemStream) item).getConsumerDispatcherState();
      }
      catch (Exception e)
      {
        FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.impl.store.filters.SubscriptionStateFilter.filterMatches",
          "1:180:1.33.1.1",
          this);

        SibTr.exception(tc, e);
        
        if (tc.isEntryEnabled())
          SibTr.exit(tc, "filterMatches", e);
          
        return false;
      }
  
  		/* If this filter is a subscriptionId filter, check for a match */
  		
      if (_subscriptionId != null)
      {
        boolean retval = (subState.getSubscriberID().equals(_subscriptionId));
        if (tc.isEntryEnabled())
          SibTr.exit(tc, "filterMatches", Boolean.valueOf(retval));
        return retval;
      }
  
  		/* If this filter is a destination name filter, check for a match */
  		
      if (_destination != null)
      {
        boolean retval = (subState.getTopicSpaceUuid().equals(_destination));
        if (tc.isEntryEnabled())
          SibTr.exit(tc, "filterMatches", Boolean.valueOf(retval));
        return retval;
      }
      
      /* If this filter is for a specific consumer dispatcher state object, check for a match */

      if (_consumerDispatcherState != null)
      {
        boolean retval = (subState == _consumerDispatcherState);
        if (tc.isEntryEnabled())
          SibTr.exit(tc, "filterMatches", Boolean.valueOf(retval));
        return retval;
      }

      //The match succeeds if its a durable subscription and no specific matching is requested
      if ((_destination == null) && (_subscriptionId == null) && (_consumerDispatcherState == null))
      {
        if (tc.isEntryEnabled())
          SibTr.exit(tc, "filterMatches", Boolean.TRUE);
        return true;
      }
    }
    /* If filter type has not been set, the match fails */
    
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "filterMatches", Boolean.FALSE);

    return false;

  }
9343
def FileEntryExistsByPathSpec(self, path_spec):
    
    location = getattr(path_spec, 'location', None)

    if location is None:
      return False

    is_device = False
    if platform.system() == 'Windows':
      # Note that os.path.exists() returns False for Windows device files so
      # instead use libsmdev to do the check.
      try:
        is_device = pysmdev.check_device(location)
      except IOError as exception:
        # Since pysmdev will raise IOError when it has no access to the device
        # we check if the exception message contains ' access denied ' and
        # return true.

        # Note that exception.message no longer works in Python 3.
        exception_string = str(exception)
        if not isinstance(exception_string, py2to3.UNICODE_TYPE):
          exception_string = py2to3.UNICODE_TYPE(
              exception_string, errors='replace')

        if ' access denied ' in exception_string:
          is_device = True

    # Note that os.path.exists() returns False for broken symbolic links hence
    # an additional check using os.path.islink() is necessary.
    return is_device or os.path.exists(location) or os.path.islink(location)
1187232
def is_matching(cls, file_path):
        
        if file_path.endswith(".ndata") and os.path.exists(file_path):
            try:
                with open(file_path, "r+b") as fp:
                    local_files, dir_files, eocd = parse_zip(fp)
                    contains_data = b"data.npy" in dir_files
                    contains_metadata = b"metadata.json" in dir_files
                    file_count = contains_data + contains_metadata  # use fact that True is 1, False is 0
                    # TODO: make sure ndata isn't compressed, or handle it
                    if len(dir_files) != file_count or file_count == 0:
                        return False
                    return True
            except Exception as e:
                logging.error("Exception parsing ndata file: %s", file_path)
                logging.error(str(e))
        return False
776136
def _CheckIsDevice(self, file_entry):
    
    if definitions.FILE_ENTRY_TYPE_DEVICE not in self._file_entry_types:
      return False
    return file_entry.IsDevice()
1147609
def _compare_file(self, local, remote):
        """"""
        assert isinstance(local, FileEntry) and isinstance(remote, FileEntry)

        if not local or not remote:
            write("    Files cannot be compared ({} != {}).".format(local, remote))
            return False
        elif local.size != remote.size:
            write(
                "    Files are different (size {:,d} != {:,d}).".format(
                    local.size, remote.size
                )
            )
            return False

        with local.target.open_readable(
            local.name
        ) as fp_src, remote.target.open_readable(remote.name) as fp_dest:
            res, ofs = byte_compare(fp_src, fp_dest)

        if not res:
            write("    Files are different at offset {:,d}.".format(ofs))
        else:
            write("    Files are equal.")
        return res
973052
def valid_file?(entry)
      ext = File.extname(entry).gsub(/\./, "").downcase
      File.file?(source.join(entry)) && EXTENSIONS.include?(ext) && entry !~ IGNORE_FILES
    end
1165517
public static boolean compareFilesByContent(final File sourceFile, final File fileToCompare)
	{
		return CompareFileExtensions
			.compareFiles(sourceFile, fileToCompare, true, true, true, true, true, false)
			.getContentEquality();
	}
717078
protected boolean matchesFilter(MetadataReader reader, MetadataReaderFactory readerFactory) throws IOException {
        for (TypeFilter filter : ENTITY_TYPE_FILTERS) {
            if (filter.match(reader, readerFactory)) {
                return true;
            }
        }
        return false;
    }
327170
def match(self, filename, isdir=False):
    

    for lst in self:
      result = lst.match(filename, isdir)
      if result != MATCH_DEFAULT:
        return result
    return MATCH_DEFAULT
1204979
def file_match(file)
      raise ArgumentError, "Filename cannot be nil" if file.nil?
      { filename: file, matched: file, line: 1, column: 1 }
    end
1130275
def FileEntryExistsByPathSpec(self, path_spec):
    
    tsk_vs_part, _ = tsk_partition.GetTSKVsPartByPathSpec(
        self._tsk_volume, path_spec)

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

    return True
59722
def show_matching_entry(program, arguments, use_clipboard=True, quiet=False, filters=()):
    """"""
    entry = program.select_entry(*arguments)
    if not quiet:
        formatted_entry = entry.format_text(include_password=not use_clipboard, filters=filters)
        if formatted_entry and not formatted_entry.isspace():
            output(formatted_entry)
    if use_clipboard:
        entry.copy_password()
499564
def _GetFileSystemTypeFromFileEntry(self, file_entry):
    
    if file_entry.type_indicator != dfvfs_definitions.TYPE_INDICATOR_TSK:
      return file_entry.type_indicator

    # TODO: Implement fs_type in dfVFS and remove this implementation
    # once that is in place.
    file_system = file_entry.GetFileSystem()
    fs_info = file_system.GetFsInfo()
    if fs_info.info:
      type_string = '{0!s}'.format(fs_info.info.ftype)
      if type_string.startswith('TSK_FS_TYPE_'):
        type_string = type_string[12:]
      if type_string.endswith('_DETECT'):
        type_string = type_string[:-7]

    return type_string
419715
def _CheckIsPipe(self, file_entry):
    
    if definitions.FILE_ENTRY_TYPE_PIPE not in self._file_entry_types:
      return False
    return file_entry.IsPipe()