<s> from rx import Observable <EOL> from rx . internal import extensionmethod <EOL> @ extensionmethod ( Observable ) <EOL> def sum ( self , key_selector = None ) : <EOL> """<STR_LIT>""" <EOL> if key_selector : <EOL> return self . map ( key_selector ) . sum ( ) <EOL> else : <EOL> return self . reduce ( seed = <NUM_LIT:0> , accumulator = lambda prev , curr : prev + curr ) </s>
