U vi@sfddlZddlmZmZmZddlmZddlmZddl m Z eZ edZ e e e dd d Z dS) N)OptionalTypeVarcast)SequenceContainsNoElementsError)NewThreadScheduler) Observable_T)sourcereturncsdtdttddtddfdd }tddfdd }dd fd d }|j|||td sqrrttstS) a`Run source synchronously. Subscribes to the observable source. Then blocks and waits for the observable source to either complete or error. Returns the last value emitted, or throws exception if any error occured. Examples: >>> result = run(source) Args: source: Observable source to run. Raises: SequenceContainsNoElementsError: if observable completes (on_completed) without any values being emitted. Exception: raises exception if any error (on_error) occured. Returns: The last element emitted from the observable. NF)valuer cs |ddSNT)r ) has_resultresultr>/opt/alt/python38/lib/python3.8/site-packages/reactivex/run.pyon_next)szrun..on_next)errorr cs|ddSr set)r)done exceptionlatchrron_error.szrun..on_error)r csddSr rr)rrrr on_completed5szrun..on_completed) scheduler) threadingEventrr Exception subscriberwaitr)r rrrr)rrrrrrruns    r!)rtypingrrrZreactivex.internal.exceptionsrZreactivex.schedulerrZ observablerrr r!rrrrs