class_docstr: Platform-independent emitter that polls a directory to detect file
  system changes.
class_docstr_tok: ["Platform-independent","emitter","that","polls","a","directory","to","detect","file","system","changes","."]
code: def queue_events(self, timeout):
      # We don't want to hit the disk continuously.
      # timeout behaves like an interval for polling emitters.
      if self.stopped_event.wait(timeout):
          return
  
      with self._lock:
          if not self.should_keep_running():
              return
  
          # Get event diff between fresh snapshot and previous snapshot.
          # Update snapshot.
          try:
              new_snapshot = self._take_snapshot()
          except OSError:
              self.queue_event(DirDeletedEvent(self.watch.path))
              self.stop()
              return
  
          events = DirectorySnapshotDiff(self._snapshot, new_snapshot)
          self._snapshot = new_snapshot
  
          # Files.
          for src_path in events.files_deleted:
              self.queue_event(FileDeletedEvent(src_path))
          for src_path in events.files_modified:
              self.queue_event(FileModifiedEvent(src_path))
          for src_path in events.files_created:
              self.queue_event(FileCreatedEvent(src_path))
          for src_path, dest_path in events.files_moved:
              self.queue_event(FileMovedEvent(src_path, dest_path))
  
          # Directories.
          for src_path in events.dirs_deleted:
              self.queue_event(DirDeletedEvent(src_path))
          for src_path in events.dirs_modified:
              self.queue_event(DirModifiedEvent(src_path))
          for src_path in events.dirs_created:
              self.queue_event(DirCreatedEvent(src_path))
          for src_path, dest_path in events.dirs_moved:
              self.queue_event(DirMovedEvent(src_path, dest_path))
  
file_path: wandb/wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/polling.py
imports: from __future__ import with_statement
  import os
  import threading
  from functools import partial
  from wandb_watchdog.utils import stat
  from wandb_watchdog.utils.dirsnapshot import DirectorySnapshot, DirectorySnapshotDiff
  from wandb_watchdog.observers.api import EventEmitter, BaseObserver, DEFAULT_OBSERVER_TIMEOUT, DEFAULT_EMITTER_TIMEOUT
  from wandb_watchdog.events import DirMovedEvent, DirDeletedEvent, DirCreatedEvent, DirModifiedEvent, FileMovedEvent, FileDeletedEvent, FileCreatedEvent, FileModifiedEvent
label_desc: Use image node_id 3 for calling the PollingEmitter obj's underlying member method code with example usage: obj.queue_events(timeout) without return types