mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 13:11:31 +00:00
Refactor whole importing hell into a nice and clean API
This commit is contained in:
parent
b942c1cf53
commit
1f2e1f0489
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
from .envvars import * # pylint: disable=wildcard-import
|
||||
from .envvars import TAOENV
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
from .event_handler_base import TriggerlessEventHandler, TriggeredEventHandler
|
||||
from .fsm_base import FSMBase
|
||||
|
8
lib/tfw/components/__init__.py
Normal file
8
lib/tfw/components/__init__.py
Normal file
@ -0,0 +1,8 @@
|
||||
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
from .directory_monitoring_event_handler import DirectoryMonitoringEventHandler
|
||||
from .process_managing_event_handler import ProcessManagingEventHandler
|
||||
from .terminado_event_handler import TerminadoEventHandler
|
||||
from .source_code_event_handler import SourceCodeEventHandler
|
||||
from .history_monitor import HistoryMonitor, BashMonitor, GDBMonitor
|
@ -6,7 +6,7 @@ from functools import wraps
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEventHandler as FileSystemWatchdogEventHandler
|
||||
|
||||
from tfw.networking.event_handlers.server_connector import ServerUplinkConnector
|
||||
from tfw.networking.event_handlers import ServerUplinkConnector
|
||||
from tfw.components.decorators import RateLimiter
|
||||
|
||||
from tfw.config.logs import logging
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
from os.path import isdir, exists
|
||||
|
||||
from tfw.components.directory_monitor import DirectoryMonitor
|
||||
from tfw.event_handler_base import TriggerlessEventHandler
|
||||
from tfw import TriggerlessEventHandler
|
||||
from tfw.config.logs import logging
|
||||
from .directory_monitor import DirectoryMonitor
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -9,8 +9,8 @@ from abc import ABC, abstractmethod
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import PatternMatchingEventHandler
|
||||
|
||||
from tfw.components.mixins.callback_mixin import CallbackMixin
|
||||
from tfw.components.decorators.rate_limiter import RateLimiter
|
||||
from tfw.components.mixins import CallbackMixin
|
||||
from tfw.components.decorators import RateLimiter
|
||||
|
||||
|
||||
class CallbackEventHandler(PatternMatchingEventHandler, ABC):
|
||||
|
@ -2,3 +2,4 @@
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
from .supervisor_mixin import SupervisorMixin
|
||||
from .callback_mixin import CallbackMixin
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
from xmlrpc.client import Fault as SupervisorFault
|
||||
|
||||
from tfw.event_handler_base import TriggerlessEventHandler
|
||||
from tfw import TriggerlessEventHandler
|
||||
from tfw.components.mixins import SupervisorMixin
|
||||
from tfw.components.directory_monitor import with_monitor_paused
|
||||
from tfw.config.logs import logging
|
||||
from .directory_monitor import with_monitor_paused
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -6,9 +6,9 @@ from glob import glob
|
||||
from fnmatch import fnmatchcase
|
||||
from collections import Iterable
|
||||
|
||||
from tfw.event_handler_base import TriggerlessEventHandler
|
||||
from tfw.components.directory_monitor import DirectoryMonitor
|
||||
from tfw import TriggerlessEventHandler
|
||||
from tfw.config.logs import logging
|
||||
from .directory_monitor import DirectoryMonitor
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
from tfw.components.terminado_mini_server import TerminadoMiniServer
|
||||
from tfw.event_handler_base import TriggerlessEventHandler
|
||||
from tfw import TriggerlessEventHandler
|
||||
from tfw.config import TFWENV
|
||||
from tfw.config.logs import logging
|
||||
from tao.config import TAOENV
|
||||
from .terminado_mini_server import TerminadoMiniServer
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
from .envvars import *
|
||||
from .envvars import TFWENV
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from tfw.networking.serialization import deserialize_all
|
||||
from tfw.networking.event_handlers.server_connector import ServerConnector
|
||||
from tfw.networking import deserialize_all
|
||||
from tfw.networking.event_handlers import ServerConnector
|
||||
|
||||
|
||||
class EventHandlerBase(ABC):
|
||||
|
@ -5,7 +5,7 @@ from typing import List
|
||||
|
||||
from transitions import Machine
|
||||
|
||||
from tfw.components.mixins.callback_mixin import CallbackMixin
|
||||
from tfw.components.mixins import CallbackMixin
|
||||
|
||||
|
||||
class FSMBase(CallbackMixin):
|
||||
|
@ -1,3 +1,7 @@
|
||||
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
from .serialization import decode_if_needed, encode_if_needed, serialize_all, deserialize_all
|
||||
from .zmq_connector_base import ZMQConnectorBase
|
||||
from .controller_connector import ControllerConnector
|
||||
from .message_sender import MessageSender
|
||||
|
@ -5,7 +5,7 @@ import zmq
|
||||
from zmq.eventloop.zmqstream import ZMQStream
|
||||
|
||||
from tfw.config import TFWENV
|
||||
from tfw.networking.zmq_connector_base import ZMQConnectorBase
|
||||
from tfw.networking import ZMQConnectorBase
|
||||
|
||||
|
||||
class ControllerConnector(ZMQConnectorBase):
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
from .server_connector import ServerConnector, ServerUplinkConnector, ServerDownlinkConnector
|
||||
|
@ -6,9 +6,9 @@ from functools import partial
|
||||
import zmq
|
||||
from zmq.eventloop.zmqstream import ZMQStream
|
||||
|
||||
from tfw.networking.serialization import serialize_all
|
||||
from tfw.networking import serialize_all
|
||||
from tfw.networking import ZMQConnectorBase
|
||||
from tfw.config import TFWENV
|
||||
from tfw.networking.zmq_connector_base import ZMQConnectorBase
|
||||
|
||||
|
||||
class ServerDownlinkConnector(ZMQConnectorBase):
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from tfw.networking.event_handlers.server_connector import ServerUplinkConnector
|
||||
from tfw.networking.event_handlers import ServerUplinkConnector
|
||||
|
||||
|
||||
class MessageSender:
|
@ -1,3 +1,7 @@
|
||||
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
from .event_handler_connector import EventHandlerConnector, EventHandlerUplinkConnector, EventHandlerDownlinkConnector
|
||||
from .tfw_server import TFWServer
|
||||
from .zmq_websocket_handler import ZMQWebSocketProxy
|
||||
from .controller_responder import ControllerResponder
|
||||
|
@ -1,8 +1,7 @@
|
||||
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
from tfw.networking.controller_connector import ControllerConnector
|
||||
from tfw.networking.serialization import deserialize_all, serialize_all
|
||||
from tfw.networking import deserialize_all, serialize_all, ControllerConnector
|
||||
|
||||
|
||||
class ControllerResponder:
|
||||
|
@ -4,8 +4,7 @@
|
||||
import zmq
|
||||
from zmq.eventloop.zmqstream import ZMQStream
|
||||
|
||||
from tfw.networking.zmq_connector_base import ZMQConnectorBase
|
||||
from tfw.networking.serialization import serialize_all
|
||||
from tfw.networking import ZMQConnectorBase, serialize_all
|
||||
from tfw.config import TFWENV
|
||||
from tfw.config.logs import logging
|
||||
|
||||
|
@ -5,10 +5,10 @@ from collections import defaultdict
|
||||
|
||||
from tornado.web import Application
|
||||
|
||||
from tfw.networking.server.zmq_websocket_handler import ZMQWebSocketProxy
|
||||
from tfw.networking.event_handlers.server_connector import ServerUplinkConnector
|
||||
from tfw.message_sender import MessageSender
|
||||
from tfw.networking import MessageSender
|
||||
from tfw.networking.event_handlers import ServerUplinkConnector
|
||||
from tfw.config.logs import logging
|
||||
from .zmq_websocket_handler import ZMQWebSocketProxy
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -6,9 +6,9 @@ from abc import ABC, abstractmethod
|
||||
|
||||
from tornado.websocket import WebSocketHandler
|
||||
|
||||
from tfw.networking.serialization import deserialize_all
|
||||
from tfw.networking.server.event_handler_connector import EventHandlerConnector
|
||||
from tfw.networking import deserialize_all
|
||||
from tfw.config.logs import logging
|
||||
from .event_handler_connector import EventHandlerConnector
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user