diff --git a/moler/config/loggers.py b/moler/config/loggers.py index d01fc8224..516c58ef4 100644 --- a/moler/config/loggers.py +++ b/moler/config/loggers.py @@ -4,7 +4,7 @@ """ __author__ = 'Grzegorz Latuszek, Marcin Usielski, Michal Ernst' -__copyright__ = 'Copyright (C) 2018-2023, Nokia' +__copyright__ = 'Copyright (C) 2018-2024, Nokia' __email__ = 'grzegorz.latuszek@nokia.com, marcin.usielski@nokia.com, michal.ernst@nokia.com' import codecs @@ -514,11 +514,6 @@ def configure_moler_main_logger(): configure_moler_threads_logger() logger.info("More logs in: {}".format(_logging_path)) _list_libraries(logger=logger) - if sys.version_info < (3, 7): - logger.warning("****************************************************\n" - "* Support for Python < 3.7 will be removed soon. *\n" - "* Please update your Python to 3.7 at least. *\n" - "****************************************************") global _main_logger _main_logger = logger diff --git a/moler/device/textualdevice.py b/moler/device/textualdevice.py index 427c9026d..e115b3184 100644 --- a/moler/device/textualdevice.py +++ b/moler/device/textualdevice.py @@ -5,7 +5,7 @@ - be the state machine that controls which commands may run in given state """ __author__ = 'Grzegorz Latuszek, Marcin Usielski, Michal Ernst' -__copyright__ = 'Copyright (C) 2018-2023, Nokia' +__copyright__ = 'Copyright (C) 2018-2024, Nokia' __email__ = 'grzegorz.latuszek@nokia.com, marcin.usielski@nokia.com, michal.ernst@nokia.com' import abc @@ -18,7 +18,7 @@ import time import traceback import threading - +import queue from moler.cmd.commandtextualgeneric import CommandTextualGeneric from moler.connection_observer import ConnectionObserver from moler.config.loggers import configure_device_logger @@ -31,12 +31,6 @@ from moler.device.abstract_device import AbstractDevice from moler.config.loggers import change_logging_suffix -try: - import queue -except ImportError: - # noinspection PyUnresolvedReferences - import Queue as queue # For python 2 - # TODO: name, logger/logger_name as param class TextualDevice(AbstractDevice): diff --git a/moler/helpers.py b/moler/helpers.py index 11fd4331f..f6cc865f5 100644 --- a/moler/helpers.py +++ b/moler/helpers.py @@ -7,16 +7,16 @@ __copyright__ = 'Copyright (C) 2018-2024, Nokia' __email__ = 'grzegorz.latuszek@nokia.com, michal.ernst@nokia.com, marcin.usielski@nokia.com' -from functools import wraps -from types import FunctionType, MethodType -from six import string_types -from math import isclose -import collections.abc as collections import copy import importlib import logging import re import sys +import collections.abc +from functools import wraps +from types import FunctionType, MethodType +from six import string_types +from math import isclose class ClassProperty(property): @@ -203,7 +203,7 @@ def create_object_from_name(full_class_name, constructor_params): def update_dict(target_dict, expand_dict): for key, value in expand_dict.items(): if (key in target_dict and isinstance(target_dict[key], dict) and isinstance(expand_dict[key], - collections.Mapping)): + collections.abc.Mapping)): update_dict(target_dict[key], expand_dict[key]) else: target_dict[key] = expand_dict[key] diff --git a/moler/observer_thread_wrapper.py b/moler/observer_thread_wrapper.py index 5b616dbc0..8f3cdd3ca 100644 --- a/moler/observer_thread_wrapper.py +++ b/moler/observer_thread_wrapper.py @@ -3,23 +3,17 @@ """Wrapper for observer registered in ThreadedMolerConnection (old name: ObservableConnection).""" __author__ = 'Marcin Usielski' -__copyright__ = 'Copyright (C) 2020-2023, Nokia' +__copyright__ = 'Copyright (C) 2020-2024, Nokia' __email__ = 'marcin.usielski@nokia.com' import logging import traceback import threading -from threading import Thread - +import queue from moler.util import tracked_thread from moler.config.loggers import TRACE from moler.exceptions import CommandFailure, MolerException - -try: - import queue -except ImportError: - # noinspection PyUnresolvedReferences - import Queue as queue # For python 2 +from threading import Thread class ObserverThreadWrapper(object): diff --git a/moler/runner_single_thread.py b/moler/runner_single_thread.py index a5209b1cf..193305f59 100644 --- a/moler/runner_single_thread.py +++ b/moler/runner_single_thread.py @@ -5,25 +5,18 @@ """ __author__ = 'Marcin Usielski' -__copyright__ = 'Copyright (C) 2021-2023, Nokia' +__copyright__ = 'Copyright (C) 2021-2024, Nokia' __email__ = 'marcin.usielski@nokia.com' -from threading import Lock +import threading +import logging +import time from moler.runner import ConnectionObserverRunner from moler.exceptions import CommandTimeout from moler.exceptions import ConnectionObserverTimeout from moler.util.loghelper import log_into_logger from moler.helpers import copy_list -import threading -import logging -import time - -try: - import queue -except ImportError: - # noinspection PyUnresolvedReferences - import Queue as queue # For python 2 class RunnerSingleThread(ConnectionObserverRunner): @@ -48,7 +41,7 @@ def __init__(self): name="RunnerSingle-{}".format(RunnerSingleThread._th_nr) ) RunnerSingleThread._th_nr += 1 - self._connection_observer_lock = Lock() + self._connection_observer_lock = threading.Lock() self._loop_thread.daemon = True self._loop_thread.start() diff --git a/moler/util/devices_SM.py b/moler/util/devices_SM.py index 57ba29112..579faa761 100644 --- a/moler/util/devices_SM.py +++ b/moler/util/devices_SM.py @@ -4,7 +4,7 @@ """ __author__ = 'Michal Ernst, Marcin Usielski' -__copyright__ = 'Copyright (C) 2019-2023, Nokia' +__copyright__ = 'Copyright (C) 2019-2024, Nokia' __email__ = 'michal.ernst@nokia.com, marcin.usielski@nokia.com' import os @@ -12,7 +12,7 @@ import time import math import threading - +import queue from moler.io.raw.memory import ThreadedFifoBuffer from moler.device import DeviceFactory from moler.device.textualdevice import TextualDevice @@ -21,12 +21,6 @@ from moler.helpers import copy_list from moler.util.moler_test import MolerTest -try: - import queue -except ImportError: - # noinspection PyUnresolvedReferences - import Queue as queue # Python 2 and 3. - def iterate_over_device_states(device, max_time=None, tests_per_device=300, max_no_of_threads=11, rerun=0, timeout_multiply=3.0):