#NEWLINE# def find_prompt( self , delay_factor = 0.1 ) : #NEWLINE# #INDENT# 'Finds the current network device prompt, last line only.' #NEWLINE# delay_factor = self . select_delay_factor ( delay_factor ) #NEWLINE# self . clear_buffer ( ) #NEWLINE# self . remote_conn . sendall ( '\n' ) #NEWLINE# time . sleep ( delay_factor ) #NEWLINE# prompt = '' #NEWLINE# if self . remote_conn . recv_ready ( ) : #NEWLINE# #INDENT# prompt = self . remote_conn . recv ( MAX_BUFFER ) . decode ( 'utf-8' , 'ignore' ) #NEWLINE# prompt = prompt . strip ( ) #NEWLINE# if self . ansi_escape_codes : #NEWLINE# #INDENT# prompt = self . strip_ansi_escape_codes ( prompt ) #NEWLINE# #UNINDENT# #UNINDENT# count = 0 #NEWLINE# while ( ( count <= 10 ) and ( not prompt ) ) : #NEWLINE# #INDENT# if self . wait_for_recv_ready ( ) : #NEWLINE# #INDENT# prompt = self . remote_conn . recv ( MAX_BUFFER ) . decode ( 'utf-8' , 'ignore' ) #NEWLINE# if self . ansi_escape_codes : #NEWLINE# #INDENT# prompt = self . strip_ansi_escape_codes ( prompt ) #NEWLINE# #UNINDENT# prompt = prompt . strip ( ) #NEWLINE# #UNINDENT# count += 1 #NEWLINE# #UNINDENT# prompt = self . normalize_linefeeds ( prompt ) #NEWLINE# prompt = prompt . split ( '\n' ) [ ( - 1 ) ] #NEWLINE# prompt = prompt . strip ( ) #NEWLINE# if ( not prompt ) : #NEWLINE# #INDENT# raise ValueError ( 'Unable to find prompt: {}' . format ( prompt ) ) #NEWLINE# #UNINDENT# time . sleep ( delay_factor ) #NEWLINE# self . clear_buffer ( ) #NEWLINE# return prompt