watcher
dev_tool.services.watcher
__all__ = ['FileWatcherService']
module-attribute
FileWatcherService
A service class for watching file changes.
This class provides methods for monitoring files for changes and triggering callbacks.
The constructor for the FileWatcherService class.
Parameters:
-
interval(float, default:1.0) –The polling interval in seconds.
Source code in dev_tool/services/watcher/service.py
interval = interval
instance-attribute
watch
A method that adds a file to the watch list.
Parameters:
-
file(Path) –The path to the file to watch.
-
callback(Callable[[Path], None]) –The callback function to call when the file changes.
Source code in dev_tool/services/watcher/service.py
unwatch
A method that removes a file from the watch list.
Parameters:
-
file(Path) –The path to the file to unwatch.
-
callback(Callable[[Path], None] | None, default:None) –The specific callback to remove, or None to remove all callbacks.
Source code in dev_tool/services/watcher/service.py
start
A method that starts the file watching process.
Source code in dev_tool/services/watcher/service.py
stop
A method that stops the file watching process.