@@ -55,7 +55,9 @@ def __init__(
5555 :param terminal_delayafterclose: delay for checking if terminal was properly closed
5656 """
5757 super ().__init__ (moler_connection = moler_connection )
58- self .logger .warning ("ThreadedTerminalNoFork - experimental implementation. Use at your own risk." )
58+ self .logger .warning (
59+ "ThreadedTerminalNoFork - experimental implementation. Use at your own risk."
60+ )
5961 self .debug_hex_on_non_printable_chars = (
6062 False # Set True to log incoming non printable chars as hex.
6163 )
@@ -87,8 +89,11 @@ def open(self) -> contextlib.closing:
8789 context_manager = super ().open ()
8890
8991 if not self ._terminal :
90- self ._terminal = PtyProcessUnicodeNotFork (cmd = self ._cmd , dimensions = self .dimensions ,
91- buffer_size = self ._read_buffer_size )
92+ self ._terminal = PtyProcessUnicodeNotFork (
93+ cmd = self ._cmd ,
94+ dimensions = self .dimensions ,
95+ buffer_size = self ._read_buffer_size ,
96+ )
9297 assert self ._terminal is not None
9398 self ._terminal .create_pty_process ()
9499 self ._terminal .delayafterclose = self ._terminal_delayafterclose
@@ -131,7 +136,9 @@ def close(self) -> None:
131136 except Exception as ex :
132137 self .logger .warning (f"Exception while joining pulling thread: { ex } " )
133138 if self .pulling_thread .is_alive ():
134- self .logger .warning (f"Pulling thread did not finish after { self ._join_timeout } timeout." )
139+ self .logger .warning (
140+ f"Pulling thread did not finish after { self ._join_timeout } timeout."
141+ )
135142 self .moler_connection .shutdown ()
136143 super ().close ()
137144
@@ -210,11 +217,15 @@ def _verify_shell_is_operable(self, data: str) -> None:
210217
211218 for line in lines :
212219 line = remove_all_known_special_chars (line )
213- if not re .search (self ._re_set_prompt_cmd , line ) and re .search (
214- self .target_prompt , line ) and not self ._shell_operable .is_set ():
220+ if (
221+ not re .search (self ._re_set_prompt_cmd , line ) and re .search (
222+ self .target_prompt , line ) and not self ._shell_operable .is_set ()
223+ ):
215224 self ._notify_on_connect ()
216225 self ._shell_operable .set ()
217- self .data_received (data = self .read_buffer , recv_time = datetime .datetime .now ())
226+ self .data_received (
227+ data = self .read_buffer , recv_time = datetime .datetime .now ()
228+ )
218229 elif not self ._export_sent and re .search (
219230 self .first_prompt , self .read_buffer , re .MULTILINE
220231 ):
0 commit comments