asphalt.filewatcher.component¶
-
class
asphalt.filewatcher.component.FileWatcherComponent(watchers: typing.Dict[str, typing.Dict[str, typing.Any]] = None, **default_watcher_args)¶ Bases:
asphalt.core.component.ComponentPublishes one or more
FileWatcherresources.If more than one watcher is to be configured, provide a
watchersargument as a dictionary where the key is the resource name and the value is a dictionary of keyword arguments tocreate_watcher(). Otherwise, directly pass those keyword arguments to the component constructor itself.If
watchersis defined, any extra keyword arguments are used as default values forcreate_watcher()for all watchers (merge_config()is used to merge the per-watcher arguments with the defaults). Otherwise, a single watcher is created based on the provided default arguments, withcontext_attrdefaulting towatcher.Parameters:
-
asphalt.filewatcher.component.create_watcher(path, events, *, recursive=True, backend=None, **kwargs)¶ Create a new file system watcher.
If no backend name is explicitly given, the best default backend for the current platform is used.
Parameters: - path (
Union[str,Path]) – path to the directory to watch - events (
Iterable[FileEventType]) – either a comma separated string or iterable of event types to watch - recursive (
bool) –Trueto watch for changes in subdirectories as well - backend (
Optional[str]) – name of the backend plugin (from theasphalt.watcher.watchersnamespace)
- path (