# Path: il2fb/ds/airbridge/typing.py



import io
import logging
import threading
import time
from pathlib import Path
from os import stat_result
from ddict import DotAccessDict
from il2fb.ds.airbridge.typing import StringHandler, StringOrPath

LOG = logging.getLogger(__name__)


class StopWatchDog(Exception):
    pass


class TextFileWatchDog:

    def __init__(
        self,
        path: StringOrPath,
        state: DotAccessDict=None,
        polling_period: float=0.5,
    ):
        self._path = path if isinstance(path, Path) else Path(path)
        self._state = state if state is not None else DotAccessDict()
        self._polling_period = polling_period

        self._do_stop = False
        self._stop_lock = threading.Lock()

        self._subscribers = []
        self._subscribers_lock = threading.Lock()

    def subscribe(self, subscriber: StringHandler) -> None:
        with self._subscribers_lock:
            self._subscribers.append(subscriber)


# Path: il2fb/ds/airbridge/typing.py



# Path: il2fb/ds/airbridge/watch_dog.py
import io
import logging
import threading
import time
from pathlib import Path
from os import stat_result
from ddict import DotAccessDict
from il2fb.ds.airbridge.typing import StringHandler, StringOrPath


LOG = logging.getLogger(__name__)


class StopWatchDog(Exception):
    pass


class TextFileWatchDog:

    def __init__(
        self,
        path: StringOrPath,
        state: DotAccessDict=None,
        polling_period: float=0.5,
    ):
        self._path = path if isinstance(path, Path) else Path(path)
        self._state = state if state is not None else DotAccessDict()
        self._polling_period = polling_period

        self._do_stop = False
        self._stop_lock = threading.Lock()

        self._subscribers = []
        self._subscribers_lock = threading.Lock()

    def subscribe(self, subscriber: StringHandler) -> None:
        with self._subscribers_lock:
            self._subscribers.append(subscriber)


    def unsubscribe(self, subscriber: StringHandler) -> None: