From b4d156d85426d24c59a7d73e4b3b2690fd4c1ff5 Mon Sep 17 00:00:00 2001 From: Marcin Usielski Date: Wed, 13 Nov 2024 14:10:46 +0000 Subject: [PATCH] v3 --- moler/config/loggers.py | 2 +- moler/device/proxy_pc2.py | 27 ++++++++++++++++++++++++++- setup.py | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/moler/config/loggers.py b/moler/config/loggers.py index 413556968..5c5bfafda 100644 --- a/moler/config/loggers.py +++ b/moler/config/loggers.py @@ -84,7 +84,7 @@ %% %%% %%% %% %%% %% %%% %%%%%%%%% %%% %%%%%%% %% %%%%% %% %%% %% %%% %%% %%% %%% %% %%% %% %%%%%%%%%%% %%%%%%%%% %%%%%%%%%% %%% %%% - Prompt detecting v2. + Prompt detecting v3. """ diff --git a/moler/device/proxy_pc2.py b/moler/device/proxy_pc2.py index 8e86a8c7d..60a121e3f 100644 --- a/moler/device/proxy_pc2.py +++ b/moler/device/proxy_pc2.py @@ -24,6 +24,7 @@ ThreadedTerminal = None from moler.events.shared.wait4 import Wait4 +import inspect # helper variables to improve readability of state machines # f.ex. moler.device.textualdevice introduces state TextualDevice.not_connected = "NOT_CONNECTED" @@ -68,7 +69,7 @@ def __init__(self, sm_params, name=None, io_connection=None, io_type=None, varia commands and events when they are required for the first time. """ self._detecting_prompt_cmd = "echo DETECTING PROMPT" - self._prompt_detected = False + self.__prompt_detected = False self._use_local_unix_state = want_local_unix_state(io_type, io_connection) base_state = UNIX_LOCAL if self._use_local_unix_state else NOT_CONNECTED self._use_proxy_pc = self._should_use_proxy_pc(sm_params, PROXY_PC) @@ -83,6 +84,30 @@ def __init__(self, sm_params, name=None, io_connection=None, io_type=None, varia self._after_open_prompt_detector = None self._warn_about_temporary_life_of_class() + + @property + def _prompt_detected(self): + """ + Get prompt detected. + :return: bool value. + """ + frame = inspect.currentframe().f_back + caller = frame.f_code.co_name + self.logger.info(f"Getter _prompt_detected: {self.__prompt_detected} called by {caller}") + return self.__prompt_detected + + @_prompt_detected.setter + def _prompt_detected(self, value): + """ + Set prompt detected. + :param value: bool value. + :return: None. + """ + frame = inspect.currentframe().f_back + caller = frame.f_code.co_name + self.logger.info(f"Setter _prompt_detected: {self.__prompt_detected} -> {value} called by {caller}") + self.__prompt_detected = value + def _warn_about_temporary_life_of_class(self): what = "experimental/temporary implementation of device utilizing sshshell connection" temporary_classname = self.__class__.__name__ diff --git a/setup.py b/setup.py index 4f98ee3e2..99b5e2f0a 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name='moler', - version='3.12.152', + version='3.12.153', description='Moler is a library for working with terminals, mainly for automated tests', # Required long_description=long_description, long_description_content_type='text/markdown',