class_docstr: Compares two directory snapshots and creates an object that represents
  the difference between the two snapshots.
  
  :param ref:
      The reference directory snapshot.
  :type ref:
      :class:`DirectorySnapshot`
  :param snapshot:
      The directory snapshot which will be compared
      with the reference snapshot.
  :type snapshot:
      :class:`DirectorySnapshot`
class_docstr_tok: ["Compares","two","directory","snapshots","and","creates","an","object","that","represents","the","difference","between","the","two","snapshots",".",":","param","ref",":","The","reference","directory","snapshot",".",":","type","ref",":",":","class",":","`","DirectorySnapshot","`",":","param","snapshot",":","The","directory","snapshot","which","will","be","compared","with","the","reference","snapshot",".",":","type","snapshot",":",":","class",":","`","DirectorySnapshot","`"]
code: def __init__(self, ref, snapshot):
      created = snapshot.paths - ref.paths
      deleted = ref.paths - snapshot.paths
  
      # check that all unchanged paths have the same inode
      for path in ref.paths & snapshot.paths:
          if ref.inode(path) != snapshot.inode(path):
              created.add(path)
              deleted.add(path)
  
      # find moved paths
      moved = set()
      for path in set(deleted):
          inode = ref.inode(path)
          new_path = snapshot.path(inode)
          if new_path:
              # file is not deleted but moved
              deleted.remove(path)
              moved.add((path, new_path))
  
      for path in set(created):
          inode = snapshot.inode(path)
          old_path = ref.path(inode)
          if old_path:
              created.remove(path)
              moved.add((old_path, path))
  
      # find modified paths
      # first check paths that have not moved
      modified = set()
      for path in ref.paths & snapshot.paths:
          if ref.inode(path) == snapshot.inode(path):
              if ref.mtime(path) != snapshot.mtime(path):
                  modified.add(path)
  
      for old_path, new_path in moved:
          if ref.mtime(old_path) != snapshot.mtime(new_path):
              modified.add(old_path)
  
      self._dirs_created = [
          path for path in created if snapshot.isdir(path)
      ]
      self._dirs_deleted = [path for path in deleted if ref.isdir(path)]
      self._dirs_modified = [
          path for path in modified if ref.isdir(path)
      ]
      self._dirs_moved = [
          (frm, to) for (frm, to) in moved if ref.isdir(frm)
      ]
  
      self._files_created = list(created - set(self._dirs_created))
      self._files_deleted = list(deleted - set(self._dirs_deleted))
      self._files_modified = list(modified - set(self._dirs_modified))
      self._files_moved = list(moved - set(self._dirs_moved))
  
imports: import errno
  import os
  from stat import S_ISDIR
  from wandb_watchdog.utils import stat
label_desc: Use image node_id 1 to create a new DirectorySnapshotDiff object from inherited base classes: object with example: obj = DirectorySnapshotDiff(ref, snapshot)