def _CanSkipContentExtraction(self, file_entry):
    """Determines if content extraction of a file entry can be skipped.

    Args:
      file_entry (dfvfs.FileEntry): file entry of which to determine content
          extraction can be skipped.

    Returns:
      bool: True if content extraction can be skipped.
    """
    # TODO: make this filtering solution more generic. Also see:
    # https://github.com/log2timeline/plaso/issues/467
    location = getattr(file_entry.path_spec, 'location', None)
    if not location:
      return False

    data_stream_name = getattr(file_entry.path_spec, 'data_stream', None)
    if data_stream_name:
      return False

    file_system = file_entry.GetFileSystem()

    path_segments = file_system.SplitPath(location)
    if not path_segments:
      return False

    if self._CHROME_CACHE_DATA_FILE_RE.match(path_segments[-1]):
      location_segments = path_segments[:-1]
      location_segments.append('index')
      location = file_system.JoinPath(location_segments)
      index_path_spec = path_spec_factory.Factory.NewPathSpec(
          file_entry.type_indicator, location=location,
          parent=file_entry.path_spec.parent)

      if file_system.FileEntryExistsByPathSpec(index_path_spec):
        # TODO: improve this check if "index" is a Chrome Cache index file.
        return True

    elif self._FIREFOX_CACHE_DATA_FILE_RE.match(path_segments[-1]):
      location_segments = path_segments[:-4]
      location_segments.append('_CACHE_MAP_')
      location = file_system.JoinPath(location_segments)
      cache_map_path_spec = path_spec_factory.Factory.NewPathSpec(
          file_entry.type_indicator, location=location,
          parent=file_entry.path_spec.parent)

      if file_system.FileEntryExistsByPathSpec(cache_map_path_spec):
        # TODO: improve this check if "_CACHE_MAP_" is a Firefox Cache
        # version 1 cache map file.
        return True

    elif self._FIREFOX_CACHE2_DATA_FILE_RE.match(path_segments[-1]):
      location_segments = path_segments[:-2]
      location_segments.append('index')
      location = file_system.JoinPath(location_segments)
      index_path_spec = path_spec_factory.Factory.NewPathSpec(
          file_entry.type_indicator, location=location,
          parent=file_entry.path_spec.parent)

      if file_system.FileEntryExistsByPathSpec(index_path_spec):
        # TODO: improve this check if "index" is a Firefox Cache version 2
        # index file.
        return True

    elif len(path_segments) == 1 and path_segments[0].lower() in (
        'hiberfil.sys', 'pagefile.sys', 'swapfile.sys'):
      return True

    return False
def _CanSkipContentExtraction ( self , file_entry ) : location = getattr ( file_entry . path_spec , 'location' , None ) if not location : return False data_stream_name = getattr ( file_entry . path_spec , 'data_stream' , None ) if data_stream_name : return False file_system = file_entry . GetFileSystem ( ) path_segments = file_system . SplitPath ( location ) if not path_segments : return False if self . _CHROME_CACHE_DATA_FILE_RE . match ( path_segments [ - 1 ] ) : location_segments = path_segments [ : - 1 ] location_segments . append ( 'index' ) location = file_system . JoinPath ( location_segments ) index_path_spec = path_spec_factory . Factory . NewPathSpec ( file_entry . type_indicator , location = location , parent = file_entry . path_spec . parent ) if file_system . FileEntryExistsByPathSpec ( index_path_spec ) : return True elif self . _FIREFOX_CACHE_DATA_FILE_RE . match ( path_segments [ - 1 ] ) : location_segments = path_segments [ : - 4 ] location_segments . append ( '_CACHE_MAP_' ) location = file_system . JoinPath ( location_segments ) cache_map_path_spec = path_spec_factory . Factory . NewPathSpec ( file_entry . type_indicator , location = location , parent = file_entry . path_spec . parent ) if file_system . FileEntryExistsByPathSpec ( cache_map_path_spec ) : return True elif self . _FIREFOX_CACHE2_DATA_FILE_RE . match ( path_segments [ - 1 ] ) : location_segments = path_segments [ : - 2 ] location_segments . append ( 'index' ) location = file_system . JoinPath ( location_segments ) index_path_spec = path_spec_factory . Factory . NewPathSpec ( file_entry . type_indicator , location = location , parent = file_entry . path_spec . parent ) if file_system . FileEntryExistsByPathSpec ( index_path_spec ) : return True elif len ( path_segments ) == 1 and path_segments [ 0 ] . lower ( ) in ( 'hiberfil.sys' , 'pagefile.sys' , 'swapfile.sys' ) : return True return False
Determines if content extraction of a file entry can be skipped.

    Args:
      file_entry (dfvfs.FileEntry): file entry of which to determine content
          extraction can be skipped.

    Returns:
      bool: True if content extraction can be skipped.