daemon: added type hints to CoreEmu

This commit is contained in:
Blake Harnden 2020-06-09 19:48:29 -07:00
parent 4cc9d3debf
commit a79ba1b8d3

View file

@ -3,7 +3,7 @@ import logging
import os import os
import signal import signal
import sys import sys
from typing import Mapping, Type from typing import Dict, List, Type
import core.services import core.services
from core import configservices from core import configservices
@ -36,7 +36,7 @@ class CoreEmu:
Provides logic for creating and configuring CORE sessions and the nodes within them. Provides logic for creating and configuring CORE sessions and the nodes within them.
""" """
def __init__(self, config: Mapping[str, str] = None) -> None: def __init__(self, config: Dict[str, str] = None) -> None:
""" """
Create a CoreEmu object. Create a CoreEmu object.
@ -48,17 +48,17 @@ class CoreEmu:
# configuration # configuration
if config is None: if config is None:
config = {} config = {}
self.config = config self.config: Dict[str, str] = config
# session management # session management
self.sessions = {} self.sessions: Dict[int, Session] = {}
# load services # load services
self.service_errors = [] self.service_errors: List[str] = []
self.load_services() self.load_services()
# config services # config services
self.service_manager = ConfigServiceManager() self.service_manager: ConfigServiceManager = ConfigServiceManager()
config_services_path = os.path.abspath(os.path.dirname(configservices.__file__)) config_services_path = os.path.abspath(os.path.dirname(configservices.__file__))
self.service_manager.load(config_services_path) self.service_manager.load(config_services_path)
custom_dir = self.config.get("custom_config_services_dir") custom_dir = self.config.get("custom_config_services_dir")