Skip to content

Commit

Permalink
v3
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-usielski committed Nov 13, 2024
1 parent d083e64 commit b4d156d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion moler/config/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
%% %%% %%% %% %%% %% %%% %%%%%%%%% %%% %%%%%%%
%% %%%%% %% %%% %% %%% %%% %%% %%%
%% %%% %% %%%%%%%%%%% %%%%%%%%% %%%%%%%%%% %%% %%%
Prompt detecting v2.
Prompt detecting v3.
"""


Expand Down
27 changes: 26 additions & 1 deletion moler/device/proxy_pc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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__
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit b4d156d

Please sign in to comment.