#NEWLINE# def on_data( self , data_bytes ) : #NEWLINE# #INDENT# text = decode_and_clean ( data_bytes ) #NEWLINE# if ( not self . port ) : #NEWLINE# #INDENT# m = re . match ( '^Observatory listening on http://.*?:(\\d+)' , text ) #NEWLINE# self . port = int ( m . groups ( ) [ 0 ] ) #NEWLINE# _logger . debug ( ( 'captured observatory port: %d' % data_bytes . port ) ) #NEWLINE# #UNINDENT# if self . listener : #NEWLINE# #INDENT# self . listener . on_data ( text )