Refactor whole importing hell into a nice and clean API

This commit is contained in:
Kristóf Tóth 2018-04-06 15:21:45 +02:00
parent b942c1cf53
commit 1f2e1f0489
23 changed files with 47 additions and 29 deletions

View File

@ -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

View File

@ -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

View 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

View File

@ -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

View File

@ -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__)

View File

@ -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):

View File

@ -2,3 +2,4 @@
# All Rights Reserved. See LICENSE file for details.
from .supervisor_mixin import SupervisorMixin
from .callback_mixin import CallbackMixin

View File

@ -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__)

View File

@ -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__)

View File

@ -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__)

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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):

View File

@ -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:

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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__)

View File

@ -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__)