reformat examples in README.md and docs/config.py

This commit is contained in:
2020-11-04 15:13:51 +01:00
parent 013881b69b
commit 0b0f21d112
2 changed files with 151 additions and 103 deletions

View File

@@ -7,19 +7,34 @@
#async def custom_task(event, task_id):
# logging.info(f"{task_id}: execute example task: {event}")
#
#s = TaskScheduler(task=custom_task, files=True, dirs=False)
#s = TaskScheduler(
# task=custom_task,
# files=True,
# dirs=False)
#####################################################
# Example usage of TaskScheduler with FileManager #
#####################################################
#rules=[{"action": "move",
# "src_re": r"^(?P<path>.*)",
# "dst_re": r"\g<path>.processed",
# "auto_create": True}]
#fm = FileManager(rules=rules)
#s = TaskScheduler(task=fm.task, delay=10, files=True, dirs=False)
#rules=[{
# "action": "move",
# "src_re": r"^(?P<path>.*)",
# "dst_re": r"\g<path>.processed",
# "auto_create": True,
# "filemode": 0o755,
# "dirmode": 0o644,
# "user": "root",
# "goup": "root"}]
#
#fm = FileManager(
# rules=rules)
#
#s = TaskScheduler(
# task=fm.task,
# delay=10,
# files=True,
# dirs=False)
#####################################
@@ -27,29 +42,36 @@
#####################################
#cmd = "/usr/local/bin/task.sh {maskname} {pathname} {src_pathname}"
#s = ShellScheduler(cmd=cmd)
#s = ShellScheduler(
# cmd=cmd)
###################
# Example watch #
###################
#event_map = EventMap({"IN_ACCESS": None,
# "IN_ATTRIB": None,
# "IN_CLOSE_NOWRITE": None,
# "IN_CLOSE_WRITE": s.schedule,
# "IN_CREATE": None,
# "IN_DELETE": s.cancel,
# "IN_DELETE_SELF": s.cancel,
# "IN_IGNORED": None,
# "IN_MODIFY": s.cancel,
# "IN_MOVE_SELF": None,
# "IN_MOVED_FROM": s.cancel,
# "IN_MOVED_TO": s.schedule,
# "IN_OPEN": None,
# "IN_Q_OVERFLOW": None,
# "IN_UNMOUNT": s.cancel})
#watch = Watch(path="/tmp", event_map=event_map, rec=True, auto_add=True)
#event_map = EventMap({
# "IN_ACCESS": None,
# "IN_ATTRIB": None,
# "IN_CLOSE_NOWRITE": None,
# "IN_CLOSE_WRITE": s.schedule,
# "IN_CREATE": None,
# "IN_DELETE": s.cancel,
# "IN_DELETE_SELF": s.cancel,
# "IN_IGNORED": None,
# "IN_MODIFY": s.cancel,
# "IN_MOVE_SELF": None,
# "IN_MOVED_FROM": s.cancel,
# "IN_MOVED_TO": s.schedule,
# "IN_OPEN": None,
# "IN_Q_OVERFLOW": None,
# "IN_UNMOUNT": s.cancel})
#
#watch = Watch(
# path="/tmp",
# event_map=event_map,
# rec=True,
# auto_add=True)
###############################
@@ -57,4 +79,6 @@
###############################
#pyinotifyd_config = PyinotifydConfig(
# watches=[watch], loglevel=logging.INFO, shutdown_timeout=30)
# watches=[watch],
# loglevel=logging.INFO,
# shutdown_timeout=30)