watchdog.observers.polling#

module:

watchdog.observers.polling

synopsis:

Polling emitter implementation.

author:

yesudeep@google.com (Yesudeep Mangalapilly)

author:

Mickaël Schoentgen <contact@tiger-222.fr>

Classes#

class watchdog.observers.polling.PollingEmitter(event_queue: EventQueue, watch: ObservedWatch, *, timeout: float = 1.0, event_filter: list[type[FileSystemEvent]] | None = None, stat: Callable[[str], os.stat_result] = <built-in function stat>, listdir: Callable[[str | None], Iterator[os.DirEntry]] = <built-in function scandir>)[source]#

Bases: EventEmitter

Platform-independent emitter that polls a directory to detect file system changes.

on_thread_start() None[source]#

Override this method instead of start(). start() calls this method.

This method is called right before this thread is started and this object’s run() method is invoked.

queue_events(timeout: float) None[source]#

Override this method to populate the event queue with events per interval period.

Parameters:

timeout (float) – Timeout (in seconds) between successive attempts at reading events.

class watchdog.observers.polling.PollingObserver(*, timeout: float = 1.0)[source]#

Bases: BaseObserver

Platform-independent observer that polls a directory to detect file system changes.

class watchdog.observers.polling.PollingObserverVFS(stat: Callable[[str], os.stat_result], listdir: Callable[[str | None], Iterator[os.DirEntry]], *, polling_interval: int = 1)[source]#

Bases: BaseObserver

File system independent observer that polls a directory to detect changes.

__init__(stat: Callable[[str], os.stat_result], listdir: Callable[[str | None], Iterator[os.DirEntry]], *, polling_interval: int = 1) None[source]#
Parameters:
  • stat – stat function. See os.stat for details.

  • listdir – listdir function. See os.scandir for details.

  • polling_interval (int) – interval in seconds between polling the file system.