+
    n9e                         ^ RI HtHt ^ RIt^ RIHtHt ^ RIHt ]! RRR7      t	 ! R R	]]	,          4      t
]P                  ! ]
4       ]P                  ! ]
4       ]
! ]! 4       4      tRR
 ltR tR# )    )SetHashableN)TypeVarGeneric)pmapT_coT)	covariantc                     a a ] tR t^	t oRtRtV 3R ltR tR tR t	R t
R tR tR	 t]RR
 l4       tR tR tR tR t ! R R]4      tR tR t]P2                  t]P4                  t]P6                  t]P8                  t]P:                  t]P<                  t]P>                  t]P@                  t ]PB                  t!]PD                  t"]t#]t$] t%]t&]!t']"t(]PR                  t)Rt*Vt+V ;t,# )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])
c                :   < \         \        V `  V 4      pWn        V# N)superr   __new___map)clsmself	__class__s   && 2/usr/lib/python3/dist-packages/pyrsistent/_pset.pyr   PSet.__new__!   s    T3',	    c                    WP                   9   # r   r   r   elements   &&r   __contains__PSet.__contains__&   s    ))##r   c                ,    \        V P                  4      # r   )iterr   r   s   &r   __iter__PSet.__iter__)       DIIr   c                ,    \        V P                  4      # r   )lenr   r    s   &r   __len__PSet.__len__,   s    499~r   c                    V '       g   R \        \        V 4      4      ,           # RP                  \        \        V 4      4      ^R 4      # )pzpset([{0}]))strsetformatr    s   &r   __repr__PSet.__repr__/   s8    SY''##CD	N1R$899r   c                "    V P                  4       # r   )r.   r    s   &r   __str__PSet.__str__5   s    }}r   c                ,    \        V P                  4      # r   )hashr   r    s   &r   __hash__PSet.__hash__8   r#   r   c                &    \         \        V 4      33# r   )psetlistr    s   &r   
__reduce__PSet.__reduce__;   s    d4j]""r   c                N    \        \        \        R  V 4       4      VR7      4      # )c              3   (   "   T F  qR 3x  K
  	  R# 5i)TN ).0ks   & r   	<genexpr>&PSet._from_iterable.<locals>.<genexpr>A   s     4A$is   pre_size)r   r   dict)r   itrD   s   &&&r   _from_iterablePSet._from_iterable?   s    D444xHIIr   c                \    V P                  4       P                  V4      P                  4       # )zV
Return a new PSet with element added

>>> s1 = s(1, 2)
>>> s1.add(3)
pset([1, 2, 3])
evolveradd
persistentr   s   &&r   rL   PSet.addC   s$     ||~!!'*5577r   c                v    V P                  4       pV F  pVP                  V4       K  	  VP                  4       # )zq
Return a new PSet with elements in iterable added

>>> s1 = s(1, 2)
>>> s1.update([3, 4, 4])
pset([1, 2, 3, 4])
rJ   )r   iterableer   s   &&  r   updatePSet.updateM   s2     LLNGEE'N   ||~r   c                    WP                   9   d.   V P                  4       P                  V4      P                  4       # \	        R\        V4      ,          4      h)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)r   rK   removerM   KeyErrorreprr   s   &&r   rU   PSet.remove[   sC     ii<<>((1<<>>9DMIJJr   c                    WP                   9   d.   V P                  4       P                  V4      P                  4       # V # )zS
Return a new PSet with element removed. Returns itself if element is not present.
)r   rK   rU   rM   r   s   &&r   discardPSet.discardh   s3     ii<<>((1<<>>r   c                   H   a  ] tR t^qt o RtR tR tR tR tR t	R t
RtV tR# )	PSet._Evolverc                P    Wn         VP                  P                  4       V n        R # r   )_original_psetr   rK   _pmap_evolver)r   original_psets   &&r   __init__PSet._Evolver.__init__t   s    "/!.!3!3!;!;!=Dr   c                $    R V P                   V&   V # )Tr`   r   s   &&r   rL   PSet._Evolver.addx   s    *.Dw'Kr   c                     V P                   V V # r   re   r   s   &&r   rU   PSet._Evolver.remove|   s    ""7+Kr   c                6    V P                   P                  4       # r   )r`   is_dirtyr    s   &r   rj   PSet._Evolver.is_dirty   s    %%..00r   c                    V P                  4       '       g   V P                  # \        V P                  P	                  4       4      # r   )rj   r_   r   r`   rM   r    s   &r   rM   PSet._Evolver.persistent   s3    ==??+++**55788r   c                ,    \        V P                  4      # r   )r%   r`   r    s   &r   r&   PSet._Evolver.__len__   s    t))**r   )r_   r`   N)__name__
__module____qualname____firstlineno__	__slots__rb   rL   rU   rj   rM   r&   __static_attributes____classdictcell__)__classdict__s   @r   _Evolverr]   q   s-     7		>			1	9	+ 	+r   rx   c                    V # r   r>   r    s   &r   copy	PSet.copy   s    r   c                ,    \         P                  V 4      # )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.
)r   rx   r    s   &r   rK   PSet.evolver   s    : }}T""r   r   )r   __weakref__)   )-rp   rq   rr   rs   __doc__rt   r   r   r!   r&   r.   r1   r5   r:   classmethodrG   rL   rR   rU   rZ   objectrx   rz   rK   r   __le____lt____gt____ge____eq____ne____and____or____sub____xor__issubset
issupersetunionintersection
differencesymmetric_difference
isdisjointru   rv   __classcell__)r   rw   s   @@r   r   r   	   s    * (I
$:# J J8K+6 +6#F ZZFZZFZZFZZFZZFZZFkkGZZFkkGkkGHJELJ"JJr   r   c                J    V '       g   \         # \        P                  WR7      # )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])
rC   )_EMPTY_PSETr   rG   )rP   rD   s   &&r   r8   r8      s!     x;;r   c                     \        V 4      # )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])
)r8   )elementss   *r   sr      s     >r   )r>   r   )collections.abcr   r   systypingr   r   pyrsistent._pmapr   r   r   registerr   r8   r   r>   r   r   <module>r      sa    ) 
 # !v&| 74= | | T    $ 46l<
r   