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.Component
Publishes one or more
FileWatcher
resources.If more than one watcher is to be configured, provide a
watchers
argument 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
watchers
is 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_attr
defaulting 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
) –True
to watch for changes in subdirectories as well - backend (
Optional
[str
]) – name of the backend plugin (from theasphalt.watcher.watchers
namespace)
- path (