Skip to content

Commit

Permalink
import
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-usielski committed Jan 23, 2024
1 parent e289010 commit d60fd43
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 49 deletions.
7 changes: 1 addition & 6 deletions moler/config/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

__author__ = 'Grzegorz Latuszek, Marcin Usielski, Michal Ernst'
__copyright__ = 'Copyright (C) 2018-2023, Nokia'
__copyright__ = 'Copyright (C) 2018-2024, Nokia'
__email__ = '[email protected], [email protected], [email protected]'

import codecs
Expand Down Expand Up @@ -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

Expand Down
10 changes: 2 additions & 8 deletions moler/device/textualdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = '[email protected], [email protected], [email protected]'

import abc
Expand All @@ -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
Expand All @@ -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):
Expand Down
12 changes: 6 additions & 6 deletions moler/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
__copyright__ = 'Copyright (C) 2018-2024, Nokia'
__email__ = '[email protected], [email protected], [email protected]'

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):
Expand Down Expand Up @@ -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]
Expand Down
12 changes: 3 additions & 9 deletions moler/observer_thread_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = '[email protected]'

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):
Expand Down
17 changes: 5 additions & 12 deletions moler/runner_single_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,18 @@
"""

__author__ = 'Marcin Usielski'
__copyright__ = 'Copyright (C) 2021-2023, Nokia'
__copyright__ = 'Copyright (C) 2021-2024, Nokia'
__email__ = '[email protected]'


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):
Expand All @@ -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()

Expand Down
10 changes: 2 additions & 8 deletions moler/util/devices_SM.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"""

__author__ = 'Michal Ernst, Marcin Usielski'
__copyright__ = 'Copyright (C) 2019-2023, Nokia'
__copyright__ = 'Copyright (C) 2019-2024, Nokia'
__email__ = '[email protected], [email protected]'

import os
import random
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
Expand All @@ -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):
Expand Down

0 comments on commit d60fd43

Please sign in to comment.