#NEWLINE# def _read_callback( self , data = None ) : #NEWLINE# #INDENT# 'Callback called when some data are read on the socket.\n\n        The buffer is given to the hiredis parser. If a reply is complete,\n        we put the decoded reply to on the reply queue.\n\n        Args:\n            data (str): string (buffer) read on the socket.\n        ' #NEWLINE# try : #NEWLINE# #INDENT# if ( callback is not None ) : #NEWLINE# #INDENT# self . __reader . feed ( data ) #NEWLINE# while True : #NEWLINE# #INDENT# reply = self . __reader . gets ( ) #NEWLINE# if ( reply is not False ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# callback = self . __callback_queue . popleft ( ) #NEWLINE# callback ( reply ) #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# self . _reply_list . append ( reply ) #NEWLINE# self . _condition . notify_all ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except hiredis . ProtocolError : #NEWLINE# #INDENT# LOG . warning ( 'corrupted stream => disconnect' ) #NEWLINE# self . disconnect ( )