def __init__(self, base_url: str, domain: str = None, bot_mxid: str = None, token: str = None,
                 identity: str = None, log: Logger = None, state_store: StateStore = None,
                 client_session: ClientSession = None, child: bool = False, real_user: bool = False,
                 real_user_content_key: Optional[str] = None):
        self.base_url = base_url
        self.token = token
        self.identity = identity
        self.validate_cert = True
        self.session = client_session

        self.domain = domain
        self.bot_mxid = bot_mxid
        self._bot_intent = None
        self.state_store = state_store
        self.is_real_user = real_user
        self.real_user_content_key = real_user_content_key

        if real_user:
            self.log = log
            self.intent_log = log.getChild("intent")
            self.txn_id = 0
        elif child:
            self.log = log
        else:
            self.intent_log = log.getChild("intent")
            self.log = log.getChild("api")
            self.txn_id = 0
            self.children = {}
            self.real_users = {}
示例#2
0
    def __init__(self,
                 name: str,
                 logger: logging.Logger,
                 config_directory: str,
                 rabbit_ip: str,
                 file_patterns: Optional[List[str]] = None,
                 ignore_file_patterns: Optional[List[str]] = None,
                 ignore_directories: bool = True,
                 case_sensitive: bool = False):
        """
        Constructs the ConfigsManager instance
        :param config_directory: The root config directory to watch.
            This is searched recursively.
        :param file_patterns: The file patterns in the directory to watch.
            Defaults to all ini files
        :param ignore_file_patterns: Any file patterns to ignore.
            Defaults to None
        :param ignore_directories: Whether changes in directories should be
            ignored. Default: True
        :param case_sensitive: Whether the patterns in `file_patterns` and
            `ignore_file_patterns` are case sensitive. Defaults to False
        """
        if not file_patterns:
            file_patterns = ['*.ini']

        self._name = name
        self._config_directory = config_directory
        self._file_patterns = file_patterns
        self._watching = False
        self._connected_to_rabbit = False

        logger.debug("Creating config RabbitMQ connection")
        rabbitmq = RabbitMQApi(logger.getChild("config_{}".format(
            RabbitMQApi.__name__)),
                               host=rabbit_ip)

        super().__init__(logger, rabbitmq)

        self._logger.debug("Creating heartbeat RabbitMQ connection")
        self._heartbeat_rabbit = RabbitMQApi(logger.getChild(
            "heartbeat_{}".format(RabbitMQApi.__name__)),
                                             host=rabbit_ip)

        self._event_handler = ConfigFileEventHandler(
            self._logger.getChild(ConfigFileEventHandler.__name__),
            self._on_event_thrown, file_patterns, ignore_file_patterns,
            ignore_directories, case_sensitive)
        self._observer = PollingObserver()
        self._observer.schedule(self._event_handler,
                                config_directory,
                                recursive=True)
示例#3
0
 def __init__(self, tg_queue: Queue, bot: telegram.Bot, chat_ids: [int],
              logger: logging.Logger):
     self.tg_queue = tg_queue
     self.bot = bot
     self.chat_ids = chat_ids
     self._logger = logger.getChild(self.__class__.__name__)
     self._stop_execution = threading.Event()
示例#4
0
def _initialise_component_redis(component_display_name: str,
                                component_logger: logging.Logger) -> RedisApi:
    # Try initialising the Redis API until successful. This had to be done
    # separately to avoid instances when Redis creation failed and we
    # attempt to use it.
    while True:
        try:
            redis_db = env.REDIS_DB
            redis_port = env.REDIS_PORT
            redis_host = env.REDIS_IP
            unique_alerter_identifier = env.UNIQUE_ALERTER_IDENTIFIER

            redis = RedisApi(logger=component_logger.getChild(
                RedisApi.__name__),
                             db=redis_db,
                             host=redis_host,
                             port=redis_port,
                             namespace=unique_alerter_identifier)
            break
        except Exception as e:
            msg = get_initialisation_error_message(component_display_name, e)
            log_and_print(msg, component_logger)
            # sleep before trying again
            time.sleep(RE_INITIALISE_SLEEPING_PERIOD)

    return redis
示例#5
0
文件: logging.py 项目: lsst/utils
def getLogger(name: Optional[str] = None,
              logger: logging.Logger = None) -> LsstLogAdapter:
    """Get a logger compatible with LSST usage.

    Parameters
    ----------
    name : `str`, optional
        Name of the logger. Root logger if `None`.
    logger : `logging.Logger` or `LsstLogAdapter`
        If given the logger is converted to the relevant logger class.
        If ``name`` is given the logger is assumed to be a child of the
        supplied logger.

    Returns
    -------
    logger : `LsstLogAdapter`
        The relevant logger.

    Notes
    -----
    A `logging.LoggerAdapter` is used since it is easier to provide a more
    uniform interface than when using `logging.setLoggerClass`. An adapter
    can be wrapped around the root logger and the `~logging.setLoggerClass`
    will return the logger first given that name even if the name was
    used before the `Task` was created.
    """
    if not logger:
        logger = logging.getLogger(name)
    elif name:
        logger = logger.getChild(name)
    return LsstLogAdapter(logger, {})
 def __init__(self, name: str, token: str, 
              owner_name:str, app_name: str, 
              parent_logger: logging.Logger) -> None:
     self.log = parent_logger.getChild(name)
     self.token = token
     self.owner_name = owner_name
     self.app_name = app_name
示例#7
0
 def __init__(self,
              performance_test: int,
              concurrency_test: int,
              configuration: Dict,
              cluster_items: Dict,
              enable_ssl: bool,
              logger: logging.Logger,
              tag: str = "Abstract Server"):
     """
     Class constructor
     :param performance_test: Message length to use in the performance test
     :param concurrency_test: Number of requests to do in the concurrency test
     :param configuration: ossec.conf cluster configuration
     :param cluster_items: cluster.json cluster internal configuration
     :param enable_ssl: Whether to enable asyncio's SSL support
     :param logger: Logger to use
     :param tag: Log tag
     """
     self.clients = {}
     self.performance = performance_test
     self.concurrency = concurrency_test
     self.configuration = configuration
     self.cluster_items = cluster_items
     self.enable_ssl = enable_ssl
     self.tag = tag
     self.logger = logger.getChild(tag)
     # logging tag
     self.logger.addFilter(cluster.ClusterFilter(tag=tag, subtag="Main"))
     self.tasks = [self.check_clients_keepalive]
     self.handler_class = AbstractServerHandler
     self.loop = asyncio.get_running_loop()
示例#8
0
 def __init__(self, client: mclient.Client, opts: BasicConfig, logger: logging.Logger, device_id: str):
     self.__client = client
     self.__logger = logger.getChild("PID")
     self._config = PluginConfig(opts, "PID")
     self._device_id = device_id
     self._hvac_call = PID_Controller(self._config, client, logger)
     self._device = None
示例#9
0
 def __init__(self, episodes_q: Queue, telegram_q: Queue,
              logger: logging.Logger):
     self.in_q = episodes_q
     self.out_q = telegram_q
     self.tvdb = tv_info.init_tvdb()
     self._logger = logger.getChild(self.__class__.__name__)
     self._stop_execution = threading.Event()
示例#10
0
文件: memory.py 项目: kapec94/pyMNN
    def __init__(self, x_shape, n_samples, logger: logging.Logger = None):
        if logger is None:
            logger = logging.Logger('AutoMemoryBuilder')
            logger.addHandler(logging.NullHandler())

        self._logger = logger.getChild('AutoMemoryBuilder')
        self._logger.debug('Constructor')

        if len(x_shape) == 1:
            self._x_size = x_shape[0]
        else:
            assert len(x_shape) == 2
            self._x_size = x_shape[0] * x_shape[1]

        assert self._x_size >= n_samples

        self._n_samples = n_samples
        self._xmem_shape = (n_samples, self._x_size)

        self._i = 0

        self._logger.info('Allocating pinned array: {0} bytes'.format(
            n_samples * self._x_size))

        self._pinned_mem = cuda.pinned_array(self._xmem_shape)
        self._stream = cuda.stream()
示例#11
0
    def __init__(self, primary_instrument: InstrumentContext,
                 secondary_instrument: InstrumentContext, ctx: ProtocolContext,
                 pair_policy: hc_types.PipettePair, api_version: APIVersion,
                 hardware_manager: HardwareManager, trash: Labware,
                 log_parent: logging.Logger) -> None:
        super().__init__(ctx.broker)
        self._instruments = {
            pair_policy.primary: primary_instrument,
            pair_policy.secondary: secondary_instrument
        }
        self._api_version = api_version
        self._log = log_parent.getChild(repr(self))
        self._tip_racks = list(
            set(primary_instrument.tip_racks)
            & set(secondary_instrument.tip_racks))
        self._pair_policy = pair_policy

        self._starting_tip: Union[Well, None] = None
        self._last_tip_picked_up_from: Union[Well, None] = None

        self._well_bottom_clearance = Clearances(default_aspirate=1.0,
                                                 default_dispense=1.0)

        self.trash_container = trash
        self.paired_instrument_obj = PairedInstrument(primary_instrument,
                                                      secondary_instrument,
                                                      pair_policy, ctx,
                                                      hardware_manager,
                                                      self._log)
示例#12
0
    def __init__(
        self,
        name: str,
        host: typing.Optional[str],
        port: int,
        log: logging.Logger,
        connect_callback: typing.Optional[typing.Callable],
        family: socket.AddressFamily = socket.AF_UNSPEC,
    ) -> None:
        self.name = name
        self.host = host
        self.port = port
        self.family = family
        self.log = log.getChild(f"OneClientServer({name})")
        self.__connect_callback = connect_callback

        # Was the client connected last time `call_connected_callback`
        # called? Used to prevent multiple calls to ``connect_callback``
        # for the same connected state.
        self._was_connected = False
        self._monitor_connection_task: asyncio.Future = asyncio.Future()
        self._monitor_connection_task.set_result(None)
        self._monitor_connection_interval = 0.1

        self.server: typing.Optional[asyncio.AbstractServer] = None
        self.reader: typing.Optional[asyncio.StreamReader] = None
        self.writer: typing.Optional[asyncio.StreamWriter] = None
        self.connected_task: asyncio.Future = asyncio.Future()
        self.start_task: asyncio.Future = asyncio.create_task(self.start())
        self.done_task: asyncio.Future = asyncio.Future()
示例#13
0
 def __init__(self, tg_queue: Queue, bot: telegram.Bot, chat_ids: [int],
              logger: logging.Logger):
     self.tg_queue = tg_queue
     self.bot = bot
     self.chat_ids = chat_ids
     self._logger = logger.getChild(self.__class__.__name__)
     self._stop_execution = threading.Event()
示例#14
0
    def __init__(self, chain_query_service: ChainQueryService,
                 logger: logging.Logger,
                 block_height_storage: BlockHeightStorageProxy,
                 transaction_consumer: TransactionConsumer,
                 polling_state_storage: PollingStateStorageProxy,
                 max_handle_transaction_tries: int, min_polling_delay_s: float,
                 max_polling_delay_s: float, last_block_distance: int) -> None:
        greenlet.Greenlet.__init__(self)

        self._consumer = transaction_consumer
        self._chain_query_service = chain_query_service
        self._logger = logger.getChild(self.__class__.__name__ + "." +
                                       transaction_consumer.__class__.__name__)
        self._block_height_storage = block_height_storage
        self._cancelled = False
        self._polling_delay_s = min_polling_delay_s
        self._d_height = 0
        self._min_polling_delay = min_polling_delay_s
        self._max_polling_delay = max_polling_delay_s
        self._last_block_time_s = None  # type: Optional[float]
        self._last_polling_delay = self._polling_delay_s
        self._polling_state_storage = polling_state_storage
        self._max_handle_transaction_tries = max_handle_transaction_tries
        self._polling_state = PollingState()
        self._current_height = None
        self._last_block_distance = last_block_distance
示例#15
0
    def __init__(self, configuration: Dict, cluster_items: Dict, enable_ssl: bool, performance_test: int,
                 concurrency_test: int, file: str, string: int, logger: logging.Logger, tag: str = "Client Manager"):
        """
        Class constructor

        :param configuration: client configuration
        :param enable_ssl: Whether to use SSL encryption or not
        :param performance_test: Value for the performance test function
        :param concurrency_test: Value for the concurrency test function
        :param file: File path for the send file test function
        :param string: String size for the send string test function
        """
        self.name = configuration['node_name']
        self.configuration = configuration
        self.cluster_items = cluster_items
        self.ssl = enable_ssl
        self.performance_test = performance_test
        self.concurrency_test = concurrency_test
        self.file = file
        self.string = string
        self.logger = logger.getChild(tag)
        # logging tag
        self.tag = tag
        self.logger.addFilter(cluster.ClusterFilter(tag=self.tag, subtag="Main"))
        self.tasks = []
        self.handler_class = AbstractClient
        self.client = None
        self.extra_args = {}
        self.loop = asyncio.get_running_loop()
示例#16
0
    def __init__(self, client: mclient.Client, opts: conf.BasicConfig,
                 logger: logging.Logger, device_id: str):
        self._config = opts
        self.__client = client
        self.__logger = logger.getChild("w1Temp")
        self._prev_deg = [None, None]
        self.dht = None
        self._plugin_manager = None

        if isinstance(self._config.get("DHT", None), list):
            devices = self._config["DHT"]
            self._config["DHT"] = {}
            self._config["DHT/dev"] = devices

        sensor_map = {
            '11': Adafruit_DHT.DHT11,
            '22': Adafruit_DHT.DHT22,
            '2302': Adafruit_DHT.AM2302
        }

        self.dht = sensor_map.get(self._config.get("DHT/dev/type", "22"),
                                  Adafruit_DHT.DHT22)

        self.__lastTemp = 0.0
        self.__ava_topic = device_id
示例#17
0
 def __init__(self,
              logger: logging.Logger,
              pman: PluginManager,
              callback,
              name: str,
              measurement_unit: str = '',
              ava_topic=None,
              value_template=None,
              json_attributes=False,
              device=None,
              unique_id=None,
              icon=None):
     if not callable(callback):
         raise AttributeError("callback not callable")
     self._log = logger.getChild("Switch")
     self._log.debug(
         "Switch Object für {} mit custom uid {} erstellt.".format(
             name, unique_id))
     self._pm = pman
     self._callback = callback
     self._name = name
     self._munit = measurement_unit
     self._vt = value_template
     self._jsattrib = json_attributes
     self._dev = device
     self._unique_id = unique_id
     self._icon = icon
     self._topics = pman.config.get_autodiscovery_topic(
         autodisc.Component.SWITCH, name, autodisc.DeviceClass())
     if ava_topic is not None:
         self._topics.ava_topic = ava_topic
     self.is_online = ava_topic is None
示例#18
0
 def __init__(self,
              logger: logging.Logger,
              pman: PluginManager,
              callback,
              name: str,
              ava_topic=None,
              device=None,
              unique_id=None,
              icon=None):
     if not callable(callback):
         raise AttributeError("callback not callable")
     self._log = logger.getChild("Switch")
     self._log.debug(
         "Switch Object für {} mit custom uid {} erstellt.".format(
             name, unique_id))
     self._pm = pman
     self._callback = callback
     self._name = name
     self._ava_topic = ava_topic
     self._dev = device
     self._unique_id = unique_id
     self._icon = icon
     self._topics = pman.config.get_autodiscovery_topic(
         autodisc.Component.LIGHT, name, autodisc.DeviceClass())
     self._sendDelay = ResettableTimer(0.25,
                                       self._pushState,
                                       userval=None,
                                       autorun=False)
    def __init__(
        self, flask: Any, gateway_controller: GatewayController,
        logger: Logger,
        attempt_list_serializer: TransactionAttemptListSerializer,
        public_configuration: PublicConfiguration,
        public_configuration_serializer: PublicConfigurationSerializer
    ) -> None:
        self._flask = flask
        self._gateway_controller = gateway_controller
        self._logger = logger.getChild(self.__class__.__name__)
        self._serializer = attempt_list_serializer
        self._public_configuration = public_configuration
        self._public_configuration_serializer = public_configuration_serializer

        self._add_url_rule('/api/v1', 'heartbeat', lambda: "", methods=['GET'])

        self._add_url_rule(
            '/api/v1/coin-address/<waves_address>',
            'create_address',
            lambda waves_address: self._create_address(waves_address),
            methods=['GET'])

        self._add_url_rule('/api/v1/attempt-list',
                           'get_attempt_list',
                           lambda: self._get_attempt_list(),
                           methods=['GET'])

        self._add_url_rule('/api/v1/attempt-list/<attempt_list_id>',
                           'get_attempt_list_by_id',
                           lambda attempt_list_id: self.
                           _get_attempt_list_by_id(attempt_list_id),
                           methods=['GET'])

        self._add_url_rule('/',
                           'redirect',
                           lambda: flask_module.redirect('/static/'),
                           methods=['GET'])

        self._add_url_rule('/static/',
                           'index',
                           lambda: flask_module.redirect('/static/index.html'),
                           methods=['GET'])

        self._add_url_rule('/api/v1/public-config',
                           'get_public_config',
                           lambda: flask_module.jsonify(
                               self._public_configuration_serializer.as_dict(
                                   self._public_configuration)),
                           methods=['GET'])

        self._add_url_rule('/api/v1/check/waves/<tx>',
                           'check_waves_tx',
                           lambda tx: self._check_waves_transaction(tx),
                           methods=['GET'])

        self._add_url_rule('/api/v1/check/coin/<tx>',
                           'check_coin_tx',
                           lambda tx: self._check_coin_transaction(tx),
                           methods=['GET'])
示例#20
0
 def __init__(self, client: mclient.Client, opts: Config.BasicConfig,
              logger: logging.Logger, device_id: str):
     self.__client = client
     self.__logger = logger.getChild("rPiGPIO")
     self._config = opts
     self._pins = []
     self._device_id = device_id
     self._registered_callback_topics = []
示例#21
0
 def __init__(self, log: logging.Logger):
     self._current_state = self.State.FAILED
     self._nh_set = set()
     self._ac = None
     self._child_set = set()
     self._father = None
     self._ref_count = 0
     self._log = log.getChild("d_cont")
示例#22
0
    def __init__(self, config: PluginConfig, log: Logger) -> None:
        self._config = PluginConfig(config, "systray")
        self._log = log.getChild("STRAY")

        self.icon_thread = Thread(name="systray",
                                  daemon=False,
                                  target=self.sicon_thread)
        self.icon_thread.start()
示例#23
0
 def __init__(self, base_logger: logging.Logger):
     self.logger = base_logger.getChild("MPLogger")
     self.__queue = multiprocessing.Queue(-1)
     self.__logger_level = base_logger.getEffectiveLevel()
     self.__listener = threading.Thread(name="MPLoggerListener",
                                        target=self.__listener)
     self.__listener_shutdown = threading.Event()
     self.__listener_exc_info = None
示例#24
0
 def __init__(self, query_string: str, logger: Logger = None):
     self.string = query_string
     self.tokens = []
     self.postfix = []
     self.logger = logger.getChild('query_parser')
     self._is_tokenized = False
     self._is_preparsed = False
     self._is_postfix = False
示例#25
0
 def __init__(self, client: mclient.Client, opts: conf.BasicConfig,
              logger: logging.Logger, device_id: str):
     self._config = conf.PluginConfig(opts, "ShellSwitch")
     self.__client = client
     self.__logger = logger.getChild("ShellSwitch")
     self._registered_callback_topics = []
     self._name_topic_map = {}
     self._state_name_map = {}
示例#26
0
def _apply_migrations(log: Logger):
    """
    Apply migrations as found in the migration dir.
    Returns a boolean indicating whether the database was empty prior to migration.
    """
    log = log.getChild(Path(__file__).stem)

    log.info(f"Started mongodb migrations")

    if not migration_dir.is_dir():
        raise ValueError(f"Invalid migration dir {migration_dir}")

    empty_dbs = check_mongo_empty()
    last_version = get_last_server_version()

    try:
        new_scripts = {
            ver: path
            for ver, path in ((Version(f.stem), f)
                              for f in migration_dir.glob("*.py"))
            if ver > last_version
        }
    except ValueError as ex:
        raise ValueError(f"Failed parsing migration version from file: {ex}")

    dbs = {Database.auth: "migrate_auth", Database.backend: "migrate_backend"}

    for script_version in sorted(new_scripts):
        script = new_scripts[script_version]

        if empty_dbs:
            log.info(f"Skipping migration {script.name} (empty databases)")
        else:
            spec = importlib.util.spec_from_file_location(
                script.stem, str(script))
            module = importlib.util.module_from_spec(spec)
            spec.loader.exec_module(module)

            for alias, func_name in dbs.items():
                func = getattr(module, func_name, None)
                if not func:
                    continue
                try:
                    log.info(f"Applying {script.stem}/{func_name}()")
                    func(get_db(alias))
                except Exception:
                    log.exception(f"Failed applying {script}:{func_name}()")
                    raise ValueError(
                        "Migration failed, aborting. Please restore backup.")

        DatabaseVersion(
            id=utils.id(),
            num=script.stem,
            created=datetime.utcnow(),
            desc="Applied on server startup",
        ).save()

    log.info("Finished mongodb migrations")
示例#27
0
def prepare_aws_credentials(cfg: config.Loader, logger: logging.Logger,
                            cleanup: ExitStack) -> Optional[str]:
    host_aws_credentials = {}
    if "AWS_EC2_METADATA_DISABLED" in os.environ:
        # https://github.com/aws/aws-cli/issues/5623
        host_aws_credentials["AWS_EC2_METADATA_DISABLED"] = os.environ[
            "AWS_EC2_METADATA_DISABLED"]
    # get AWS credentials from boto3 (unless prevented by configuration)
    if cfg["download_awscli"].get_bool("host_credentials"):
        import boto3  # pyre-fixme

        try:
            b3creds = boto3.session.Session().get_credentials()
            host_aws_credentials["AWS_ACCESS_KEY_ID"] = b3creds.access_key
            host_aws_credentials["AWS_SECRET_ACCESS_KEY"] = b3creds.secret_key
            host_aws_credentials["AWS_SESSION_TOKEN"] = b3creds.token
        except Exception:
            pass

    if host_aws_credentials:
        # write credentials to temp file that'll self-destruct afterwards
        host_aws_credentials = (
            "\n".join(f"export {k}={shlex.quote(v)}"
                      for (k, v) in host_aws_credentials.items()) + "\n")
        aws_credentials_file = cleanup.enter_context(
            tempfile.NamedTemporaryFile(
                prefix=hashlib.sha256(
                    host_aws_credentials.encode()).hexdigest(),
                delete=True,
                mode="w",
            ))
        print(host_aws_credentials, file=aws_credentials_file, flush=True)
        # make file group-readable to ensure it'll be usable if the docker image runs as non-root
        os.chmod(aws_credentials_file.name,
                 os.stat(aws_credentials_file.name).st_mode | 0o40)
        logger.getChild("awscli_downloader").info(
            "loaded host AWS credentials")
        return aws_credentials_file.name
    else:
        logger.getChild("awscli_downloader").info(
            "no AWS credentials available via host awscli/boto3; if needed, "
            "configure them and set [download_awscli] host_credentials=true. "
            "(On EC2: awscli might still assume role from instance metadata "
            "service.)")
        return None
示例#28
0
    def __init__(self, *, http_client: HttpClient, log: logging.Logger,) -> None:
        """Construct a new client object.

        :param http_client: The API HTTP client
        :param log: Any base logger to be used (one will be created if not supplied)
        """

        self.http_client = http_client
        self.log = log.getChild("build")
示例#29
0
 def __init__(self,
              project_path: Path,
              config_file_name: str,
              logger: Logger,
              quiet: bool = False):
     self.project_path = project_path
     self.config_path = project_path / config_file_name
     self.logger = logger.getChild('cfg')
     self.quiet = quiet
示例#30
0
 def __init__(self, config: dict, vehicles: dict, logger: logging.Logger):
     self.udp = KebaUDP(config["host"],
                        logger=logger.getChild("udp_interface"))
     self.logger = logger
     self.vehicles = {
         vehicle["rfid_token"]: vehicle
         for vehicle in vehicles
     }
     self.udp.connect()
示例#31
0
 def __init__(self, client: mclient.Client, opts: conf.BasicConfig,
              logger: logging.Logger, device_id: str):
     threading.Thread.__init__(self)
     self.name = "BleTracker"
     self.__client = client
     self.__logger = logger.getChild("BleTrack")
     self._config = opts
     self._device_id = device_id
     self.__logger.debug("BleTrack.__init__()")
示例#32
0
    def getChild(self, suffix, ownDir=False):
        child = Logger.getChild(self, suffix)
        child.setLevel(self.getEffectiveLevel())

        if ownDir:
            for handler in self._collectHandlers():
                if isinstance(handler, LogfileHandler):
                    handler = handler.getChild(suffix)
                child.addHandler(handler)

            child.propagate = False

        return child
示例#33
0
 def __init__(self, episodes_q: Queue, telegram_q: Queue, logger: logging.Logger):
     self.in_q = episodes_q
     self.out_q = telegram_q
     self.tvdb = tv_info.init_tvdb()
     self._logger = logger.getChild(self.__class__.__name__)
     self._stop_execution = threading.Event()
示例#34
0
 def __init__(self, project_path: Path, config_file_name: str, logger: Logger):
     self.project_path = project_path
     self.config_path = project_path / config_file_name
     self.logger = logger.getChild('cfg')
示例#35
0
 def __init__(self, app, logger: logging.Logger, port: int):
     self._logger = logger.getChild(self.__class__.__name__)
     self._app = app
     self._port = port