:tocdepth: 3 :py:mod:`gws.lib.watcher` ========================= .. py:module:: gws.lib.watcher .. autoapi-nested-parse:: File system watcher. Monitor file system events such as file creation, deletion, modification, and movement. The module allows directories or specific files to be monitored, supports pattern matching for files, and provides a mechanism to trigger custom notification callbacks when events occur. **Source code:** :source:`gws.lib.watcher` Package Contents ---------------- .. py:function:: new(notify: _NotifyFn) Create a new watcher. :param notify: A callback function that will be called when an event occurs. It should accept two arguments: the event type and the path of the file. Note that the callback will be called from a different thread than the one that created the watcher. .. py:class:: Watcher(notify: _NotifyFn) .. py:attribute:: dirEntries .. py:attribute:: excludePatterns :value: [] .. py:attribute:: filePaths .. py:attribute:: notify .. py:attribute:: observer :type: watchdog.observers.Observer .. py:method:: add_directory(dirname: str | os.PathLike, file_pattern: str = '', recursive: bool = False) .. py:method:: add_file(filename: str | os.PathLike) .. py:method:: exclude(path_pattern: str) .. py:method:: path_matches(path) .. py:method:: register(ev: watchdog.events.FileSystemEvent) .. py:method:: start() .. py:method:: stop()