<s> from rx import AnonymousObservable <EOL> from rx . disposables import CompositeDisposable <EOL> from . exceptions import DisposedException <EOL> def add_ref ( xs , r ) : <EOL> def subscribe ( observer ) : <EOL> return CompositeDisposable ( r . disposable , xs . subscribe ( observer ) ) <EOL> return AnonymousObservable ( subscribe ) <EOL> def adapt_call ( func ) : <EOL> """<STR_LIT>""" <EOL> cached = [ None ] <EOL> def func1 ( arg1 , * _ ) : <EOL> return func ( arg1 ) <EOL> def func2 ( arg1 , arg2 = None , * _ ) : <EOL> return func ( arg1 , arg2 ) <EOL> def func_wrapped ( * args , ** kw ) : <EOL> if cached [ <NUM_LIT:0> ] : <EOL> return cached [ <NUM_LIT:0> ] ( * args , ** kw ) <EOL> for fn in ( func1 , func2 ) : <EOL> try : <EOL> ret = fn ( * args , ** kw ) <EOL> except TypeError : <EOL> continue <EOL> else : <EOL> cached [ <NUM_LIT:0> ] = fn <EOL> return ret <EOL> return func ( * args , ** kw ) <EOL> return func_wrapped <EOL> def check_disposed ( this ) : <EOL> if this . is_disposed : <EOL> raise DisposedException ( ) <EOL> def is_future ( p ) : <EOL> return callable ( getattr ( p , "<STR_LIT>" , None ) ) <EOL> class TimeInterval ( object ) : <EOL> def __init__ ( self , value , interval ) : <EOL> self . value = value <EOL> self . interval = interval <EOL> class Timestamp ( object ) : <EOL> def __init__ ( self , value , timestamp ) : <EOL> self . value = value <EOL> self . timestamp = timestamp </s>
