U vi{ @sddlmZmZmZmZddlmZmZmZddlm Z ddl m Z edZ edZd dddeeje eeeejgeje feeee geefeee geeeee ffd d d ZdS) )CallableOptionalTypeVarUnion)ConnectableObservable Observableabc) operators)CompositeDisposable_TSource_TResultN)subject_factorymapper)subjectr rreturncs0tttttttfdfdd }|S)aMulticasts the source sequence notifications through an instantiated subject into all uses of the sequence within a mapper function. Each subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the mapper function's invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay. Examples: >>> res = multicast(observable) >>> res = multicast( subject_factory=lambda scheduler: Subject(), mapper=lambda x: x ) Args: subject_factory: Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the mapper function. subject: Subject to push source elements into. mapper: [Optional] Mapper function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if subject_factory" is a factory function. Returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a mapper function. )sourcercsPr6dtjtttjtjdfdd }t|SsBtdt}|S)N)observer schedulerrcsHsttj|d}s&t|j||d}t|||S)N)r)r)AssertionErrorpipeops multicast subscriber connect)rrZ connectableZ subscription)rrr O/opt/alt/python38/lib/python3.8/site-packages/reactivex/operators/_multicast.pyr8sz0multicast_..multicast..subscribez!multicast: Subject cannot be None)N) rZ ObserverBaser r SchedulerBaseZDisposableBaser ValueErrorr)rrretrrr )rrr3s zmulticast_..multicast)rr rr r)rr rrrrr multicast_ s)r )N)typingrrrrZ reactivexrrrr rZreactivex.disposabler r r Z SubjectBaserr rrrrs&