U vâ’ižã@sŒddlmZmZmZmZddlmZmZddlmZ ddl m Z ddl m Z edƒZd edefeejedeefd œd d „Zd gZdS) é)ÚAnyÚCallableÚOptionalÚTypeVar)Ú ObservableÚabc)Ú operators)ÚTimeoutScheduler)Ú AsyncSubjectÚ_TN.)ÚfuncÚ schedulerÚreturncs*|p t ¡‰tttdœ‡‡fdd„ }|S)a²Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler. Examples: res = reactivex.to_async(lambda x, y: x + y)(4, 3) res = reactivex.to_async(lambda x, y: x + y, Scheduler.timeout)(4, 3) res = reactivex.to_async(lambda x: log.debug(x), Scheduler.timeout)('hello') Args: func: Function to convert to an asynchronous function. scheduler: [Optional] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout. Returns: Aynchronous function. )Úargsrcs<tƒ‰dtjtddœ‡‡‡fdd„ }ˆ |¡ˆ t ¡¡S)N)r Ústaterc sVz ˆˆŽ}Wn2tk r>}zˆ |¡WY¢dSd}~XYnXˆ |¡ˆ ¡dS)N)Ú ExceptionZon_errorZon_nextZ on_completed)r rÚresultÚex)rr Úsubject©úM/opt/alt/python38/lib/python3.8/site-packages/reactivex/observable/toasync.pyÚaction&s   z*to_async_..wrapper..action)N)r rÚ SchedulerBaserZscheduleÚpipeÚopsZ as_observable)rr©Z _schedulerr )rrrÚwrapper#s zto_async_..wrapper)r Z singletonrrr )r r rrrrÚ to_async_ s r)N)ÚtypingrrrrZ reactivexrrrrZreactivex.schedulerr Zreactivex.subjectr r rrÚ__all__rrrrÚs   ÿ þ +