# Path: il2fb/ds/airbridge/json.py
# class JSONEncoder(_json.JSONEncoder):
#     def default(self, obj):
# def object_decoder(obj):
# 
# Path: il2fb/ds/airbridge/typing.py

# 
# Path: il2fb/ds/airbridge/streaming/subscribers/base.py
# class PluggableStreamingSubscriber(StreamingSubscriber):
# 
#     def __init__(self, app):
#         self._app = app
# 
#     def plug_in(self) -> None:
#         pass
# 
#     async def wait_plugged(self) -> Awaitable[None]:
#         pass
# 
#     def unplug(self) -> None:
#         pass
# 
#     async def wait_unplugged(self) -> Awaitable[None]:
#         pass


import logging
from pathlib import Path
from typing import Any, Awaitable
from il2fb.ds.airbridge import json
from il2fb.ds.airbridge.typing import StringOrPath
from il2fb.ds.airbridge.streaming.subscribers.base import PluggableStreamingSubscriber
# coding: utf-8





LOG = logging.getLogger(__name__)


class TextFileStreamingSink(PluggableStreamingSubscriber):

    def __init__(self, app, path: StringOrPath, encoding: str='utf-8'):
        super().__init__(app=app)

        self._path = path if isinstance(path, Path) else Path(path)
        self._encoding = encoding


# Path: il2fb/ds/airbridge/json.py
# class JSONEncoder(_json.JSONEncoder):
#     def default(self, obj):
# def object_decoder(obj):
# 
# Path: il2fb/ds/airbridge/typing.py

# 
# Path: il2fb/ds/airbridge/streaming/subscribers/base.py
# class PluggableStreamingSubscriber(StreamingSubscriber):
# 
#     def __init__(self, app):
#         self._app = app
# 
#     def plug_in(self) -> None:
#         pass
# 
#     async def wait_plugged(self) -> Awaitable[None]:
#         pass
# 
#     def unplug(self) -> None:
#         pass
# 
#     async def wait_unplugged(self) -> Awaitable[None]:
#         pass


# Path: il2fb/ds/airbridge/streaming/subscribers/file.py
import logging
from pathlib import Path
from typing import Any, Awaitable
from il2fb.ds.airbridge import json
from il2fb.ds.airbridge.typing import StringOrPath
from il2fb.ds.airbridge.streaming.subscribers.base import PluggableStreamingSubscriber

# coding: utf-8





LOG = logging.getLogger(__name__)


class TextFileStreamingSink(PluggableStreamingSubscriber):

    def __init__(self, app, path: StringOrPath, encoding: str='utf-8'):
        super().__init__(app=app)

        self._path = path if isinstance(path, Path) else Path(path)
        self._encoding = encoding


        self._stream = None