diff --git a/pyinotifyd/__init__.py b/pyinotifyd/__init__.py
index 4f35c11..5681353 100755
--- a/pyinotifyd/__init__.py
+++ b/pyinotifyd/__init__.py
@@ -16,8 +16,10 @@
__all__ = [
"Pyinotifyd",
- "daemon_from_config",
-]
+ "DaemonInstance",
+ "main",
+ "scheduler",
+ "watch"]
import argparse
import asyncio
@@ -26,7 +28,7 @@ import logging.handlers
import signal
import sys
-from pyinotifyd.watch import Watch, EventMap
+from pyinotifyd.watch import EventMap, Watch
from pyinotifyd._install import install, uninstall
__version__ = "0.0.2"
@@ -46,9 +48,10 @@ class Pyinotifyd:
def from_cfg_file(config_file):
config = {}
name = Pyinotifyd.name
+ exec(f"import logging", {}, config)
exec(f"from {name} import Pyinotifyd", {}, config)
exec(f"from {name}.scheduler import *", {}, config)
- exec(f"from {name}.watch import EventMap, Watch", {}, config)
+ exec(f"from {name}.watch import *", {}, config)
with open(config_file, "r") as fh:
exec(fh.read(), {}, config)
instance = config[f"{name}"]
diff --git a/pyinotifyd/scheduler.py b/pyinotifyd/scheduler.py
index 5a85435..dd0f8eb 100755
--- a/pyinotifyd/scheduler.py
+++ b/pyinotifyd/scheduler.py
@@ -12,6 +12,13 @@
# along with pyinotifyd. If not, see .
#
+__all__ = [
+ "Task",
+ "TaskScheduler",
+ "ShellScheduler",
+ "FileManagerRule",
+ "FileManagerScheduler"]
+
import asyncio
import logging
import os
@@ -24,7 +31,7 @@ from shlex import quote as shell_quote
from uuid import uuid4
-def event_to_str(event):
+def _event_to_str(event):
return f"maskname={event.maskname}, pathname={event.pathname}"
@@ -81,16 +88,16 @@ class TaskScheduler(Task):
if self._delay > 0:
task_state.waiting = True
self._log.debug(
- f"schedule task ({event_to_str(event)}, "
+ f"schedule task ({_event_to_str(event)}, "
f"task_id={task_id}, delay={self._delay})")
await asyncio.sleep(self._delay)
task_state.waiting = False
self._log.debug(
- f"start task ({event_to_str(event)}, task_id={task_id})")
+ f"start task ({_event_to_str(event)}, task_id={task_id})")
await self._delayed_task(event, task_id)
self._log.debug(
- f"task finished ({event_to_str(event)}, task_id={task_id})")
+ f"task finished ({_event_to_str(event)}, task_id={task_id})")
del self._tasks[event.pathname]
def start(self, event, *args, **kwargs):
@@ -111,7 +118,7 @@ class TaskScheduler(Task):
if task_state.waiting:
self._log.debug(
- f"cancel task ({event_to_str(event)}, "
+ f"cancel task ({_event_to_str(event)}, "
f"task_id={task_state.task_id})")
task_state.task.cancel()
del self._tasks[event.pathname]
diff --git a/pyinotifyd/watch.py b/pyinotifyd/watch.py
index d1c4155..48a2a1d 100755
--- a/pyinotifyd/watch.py
+++ b/pyinotifyd/watch.py
@@ -14,6 +14,10 @@
# along with pyinotifyd. If not, see .
#
+__all__ = [
+ "EventMap",
+ "Watch"]
+
import asyncio
import pyinotify