code: def _EntriesGenerator(self):
      
      location = getattr(self.path_spec, 'location', None)
      if location is not None:
        # Windows will raise WindowsError, which can be caught by OSError,
        # if the process has not access to list the directory. The os.access()
        # function cannot be used since it will return true even when os.listdir()
        # fails.
        try:
          for directory_entry in os.listdir(location):
            directory_entry_location = self._file_system.JoinPath([
                location, directory_entry])
            yield os_path_spec.OSPathSpec(location=directory_entry_location)
  
        except OSError as exception:
          if exception.errno == errno.EACCES:
            exception_string = str(exception)
            if not isinstance(exception_string, py2to3.UNICODE_TYPE):
              exception_string = py2to3.UNICODE_TYPE(
                  exception_string, errors='replace')
  
            raise errors.AccessError(
                'Access to directory denied with error: {0!s}'.format(
                    exception_string))
          else:
            raise errors.BackEndError(
                'Unable to list directory: {0:s} with error: {1!s}'.format(
                    location, exception))
docs: Retrieves directory entries.
  
      Since a directory can contain a vast number of entries using
      a generator is more memory efficient.
  
      Yields:
        OSPathSpec: a path specification.
  
      Raises:
        AccessError: if the access to list the directory was denied.
        BackEndError: if the directory could not be listed.