def _EntriesGenerator(self):
    """Retrieves directory entries.

    Since a directory can contain a vast number of entries using
    a generator is more memory efficient.

    Yields:
      A path specification (instance of path.FakePathSpec).
    """
    location = getattr(self.path_spec, u'location', None)
    if location is None:
      return

    paths = self._file_system.GetPaths()

    for path in iter(paths.keys()):
      # Determine if the start of the path is similar to the location string.
      # If not the file the path refers to is not in the same directory.
      if not path or not path.startswith(location):
        continue

      _, suffix = self._file_system.GetPathSegmentAndSuffix(location, path)

      # Ignore anything that is part of a sub directory or the directory itself.
      if suffix or path == location:
        continue

      path_spec_location = self._file_system.JoinPath([path])
      yield fake_path_spec.FakePathSpec(location=path_spec_location)
dataset/ETHPy150Open log2timeline/dfvfs/dfvfs/vfs/fake_file_entry.py/FakeDirectory._EntriesGenerator/original