ff=ddlmZmZddlZddlmZGddeZejeejeeeZ d dZ d Z dS) )SetHashableN)pmapcZeZdZdZdZfdZdZdZdZdZ dZ d Z d Z e dd Zd ZdZdZdZGddeZdZdZejZejZejZejZejZejZejZejZej Z ej!Z!eZ"eZ#eZ$eZ%e Z&e!Z'ej(Z(xZ)S)PSeta! Persistent set implementation. Built on top of the persistent map. The set supports all operations in the Set protocol and is Hashable. Do not instantiate directly, instead use the factory functions :py:func:`s` or :py:func:`pset` to create an instance. Random access and insert is log32(n) where n is the size of the set. Some examples: >>> s = pset([1, 2, 3, 1]) >>> s2 = s.add(4) >>> s3 = s2.remove(2) >>> s pset([1, 2, 3]) >>> s2 pset([1, 2, 3, 4]) >>> s3 pset([1, 3, 4]) )_map __weakref__cftt||}||_|SN)superr__new__r)clsmself __class__s p/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pyrsistent/_pset.pyr z PSet.__new__s,T3'',,  c||jvSr )rrelements r __contains__zPSet.__contains__#s$)##rc*t|jSr )iterrrs r__iter__z PSet.__iter__&DIrc*t|jSr )lenrrs r__len__z PSet.__len__)s49~~rc|sdtt|zSdtt|ddS)Npz pset([{0}]))strsetformatrs r__repr__z PSet.__repr__,sJ (SYY' '##CD NN1R4$8999rc*|Sr )r'rs r__str__z PSet.__str__2s}}rc*t|jSr )hashrrs r__hash__z PSet.__hash__5rrc0tt|ffSr )psetlistrs r __reduce__zPSet.__reduce__8sd4jj]""rcltttd|D|S)Nc3K|]}|dfV dS)TN).0ks r z&PSet._from_iterable..>s&44Aq$i444444rpre_size)rrdict)ritr9s r_from_iterablezPSet._from_iterable<s4D4444444xHHHIIIrct||S)z~ Return a new PSet with element added >>> s1 = s(1, 2) >>> s1.add(3) pset([1, 2, 3]) evolveradd persistentrs rr@zPSet.add@s,||~~!!'**55777rc|}|D]}|||S)z Return a new PSet with elements in iterable added >>> s1 = s(1, 2) >>> s1.update([3, 4, 4]) pset([1, 2, 3, 4]) r>)riterableers rupdatez PSet.updateJs? LLNN  G EE'NNNN||~~rc||jvr9||St dt |z)z Return a new PSet with element removed. Raises KeyError if element is not present. >>> s1 = s(1, 2) >>> s1.remove(2) pset([1]) z Element '%s' not present in PSet)rr?removerAKeyErrorreprrs rrGz PSet.removeXsS di  <<>>((11<<>> >9DMMIJJJrc||jvr9||S|S)zc Return a new PSet with element removed. Returns itself if element is not present. )rr?rGrArs rdiscardz PSet.discardes> di  <<>>((11<<>> > rc6eZdZdZdZdZdZdZdZdZ dS) PSet._Evolver)_original_pset _pmap_evolvercP||_|j|_dSr )rNrr?rO)r original_psets r__init__zPSet._Evolver.__init__qs'"/D !.!3!;!;!=!=D   rcd|j|<|S)NTrOrs rr@zPSet._Evolver.addus*.D w 'Krc|j|=|Sr rTrs rrGzPSet._Evolver.removeys"7+Krc4|jSr )rOis_dirtyrs rrWzPSet._Evolver.is_dirty}s%..00 0rc|s|jSt|jSr )rWrNrrOrArs rrAzPSet._Evolver.persistents8==?? ,++*557788 8rc*t|jSr )rrOrs rrzPSet._Evolver.__len__st)** *rN) __name__ __module__ __qualname__ __slots__rRr@rGrWrArr4rr_EvolverrMnss7  > > >       1 1 1 9 9 9  + + + + +rr^c|Sr r4rs rcopyz PSet.copys rc6t|S)a! Create a new evolver for this pset. For a discussion on evolvers in general see the documentation for the pvector evolver. Create the evolver and perform various mutating updates to it: >>> s1 = s(1, 2, 3) >>> e = s1.evolver() >>> _ = e.add(4) >>> len(e) 4 >>> _ = e.remove(1) The underlying pset remains the same: >>> s1 pset([1, 2, 3]) The changes are kept in the evolver. An updated pmap can be created using the persistent() function on the evolver. >>> s2 = e.persistent() >>> s2 pset([2, 3, 4]) The new pset will share data with the original pset in the same way that would have been done if only using operations on the pset. )rr^rs rr?z PSet.evolvers:}}T"""r)r1)*rZr[r\__doc__r]r rrrr'r)r,r0 classmethodr<r@rErGrKobjectr^r`r?r__le____lt____gt____ge____eq____ne____and____or____sub____xor__issubset issupersetunion intersection differencesymmetric_difference isdisjoint __classcell__)rs@rrrs*(I $$$::: ###JJJ[J888    K K K+++++6+++6###FZF ZF ZF ZF ZF ZFkG ZFkGkGHJ ELJ"JJJJJrrr4r1cL|stSt||S)z Creates a persistent set from iterable. Optionally takes a sizing parameter equivalent to that used for :py:func:`pmap`. >>> s1 = pset([1, 2, 3, 2]) >>> s1 pset([1, 2, 3]) r8) _EMPTY_PSETrr<)rCr9s rr.r.s+    x(  ; ;;rc t|S)z Create a persistent set. Takes an arbitrary number of arguments to insert into the new set. >>> s1 = s(1, 2, 3, 2) >>> s1 pset([1, 2, 3]) )r.)elementss rsr{s >>r)r4r1) collections.abcrrsyspyrsistent._pmaprrdrregisterrxr.r{r4rrrs)))))))) !!!!!!| | | | | 6| | | |  T$d4466ll  < < < <     r