<s> """<STR_LIT>""" <EOL> from twisted . internet import defer <EOL> from nodeset . common import log <EOL> class Formatter : <EOL> """<STR_LIT>""" <EOL> def encode ( self , data ) : <EOL> """<STR_LIT>""" <EOL> return data <EOL> def decode ( self , data ) : <EOL> """<STR_LIT>""" <EOL> return data <EOL> class Stream : <EOL> """<STR_LIT>""" <EOL> formatterClass = Formatter <EOL> def __init__ ( self , node , peers = None ) : <EOL> self . node = node <EOL> self . peers = peers <EOL> self . formatter = self . formatterClass ( ) <EOL> def push ( self , data ) : <EOL> """<STR_LIT>""" <EOL> defers = [ ] <EOL> log . msg ( "<STR_LIT>" % self . peers ) <EOL> for peer in self . peers : <EOL> d = peer . callRemote ( '<STR_LIT>' , self . formatter . encode ( data ) , self . formatter ) <EOL> defers . append ( d ) <EOL> if len ( defers ) > <NUM_LIT:1> : <EOL> return defer . DeferredList ( defers ) <EOL> return defers . pop ( ) </s>
