U vi5 @sddlmZmZmZmZddlmZmZddlm Z m Z ddl m Z m Z edZedZd ee eefee eeeegeefdd d Zd gZdS) )CallableOptionalTypeVarcast) Observableabc)default_compareridentity)ComparerMapper_T_TKeyN) key_mappercomparerreturncsB|ptttgtft|ptttttdfdd }|S)N)sourcercs2dtjtttjtjdfdd }t|S)ayReturns an observable sequence that contains only distinct contiguous elements according to the key_mapper and the comparer. Examples: >>> op = distinct_until_changed(); >>> op = distinct_until_changed(lambda x: x.id) >>> op = distinct_until_changed(lambda x: x.id, lambda x, y: x == y) Args: key_mapper: [Optional] A function to compute the comparison key for each element. If not provided, it projects the value. comparer: [Optional] Equality comparer for computed key values. If not provided, defaults to an equality comparer function. Returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence. N)observer schedulerrcs@dttdtddfdd }j|jj|dS)NF)valuerc sd}z |}Wn2tk rB}z|WYdSd}~XYnXrz|}Wn2tk r}z|WYdSd}~XYnXr|sd||dS)NFT) Exceptionon_erroron_next)rZcomparer_equalskey exception) comparer_ current_keyhas_current_key key_mapper_rZ/opt/alt/python38/lib/python3.8/site-packages/reactivex/operators/_distinctuntilchanged.pyr2s    z[distinct_until_changed_..distinct_until_changed..subscribe..on_next)r)rr r subscriberZ on_completed)rrr)rrr)rrrrr +s zJdistinct_until_changed_..distinct_until_changed..subscribe)N)rZ ObserverBaser rZ SchedulerBaseZDisposableBaser)rr rr)rrdistinct_until_changeds z7distinct_until_changed_..distinct_until_changed)rrr r r rr)rrr"rr!rdistinct_until_changed_ s:r#)NN)typingrrrrZ reactivexrrZreactivex.internal.basicrr Zreactivex.typingr r r r r#__all__rrrrs  E