+
    n9e                     :   ^ RI HtHtHtHt ^ RIHt ^ RIHtH	t	 ^ RI
Ht ]	! RRR7      tR t ! R	 R
]],          4      t]P                  ! ]4       ]P                  ! ]4       ]P                  ! ]4       ]P                  ! ]4       R tR t]! ]! 4       4      tR# )    )	ContainerIterableSizedHashable)reduce)GenericTypeVar)pmapT_coT)	covariantc                 R    V P                  WP                  V^ 4      ^,           4      # )r   )setget)counterselements   &&2/usr/lib/python3/dist-packages/pyrsistent/_pbag.py_add_to_countersr   	   s!    <<gq!9A!=>>    c                      a  ] tR t^t o RtRtR tR tR tR t	R t
R tR tR	 tR
 tR tR t]t]t]tR tR tR tR tR tRtV tR# )PBaga  
A persistent bag/multiset type.

Requires elements to be hashable, and allows duplicates, but has no
ordering. Bags are hashable.

Do not instantiate directly, instead use the factory functions :py:func:`b`
or :py:func:`pbag` to create an instance.

Some examples:

>>> s = pbag([1, 2, 3, 1])
>>> s2 = s.add(4)
>>> s3 = s2.remove(1)
>>> s
pbag([1, 1, 2, 3])
>>> s2
pbag([1, 1, 2, 3, 4])
>>> s3
pbag([1, 2, 3, 4])
c                    Wn         R # )N_counts)selfcountss   &&r   __init__PBag.__init__&   s    r   c                @    \        \        V P                  V4      4      # )z{
Add an element to the bag.

>>> s = pbag([1])
>>> s2 = s.add(1)
>>> s3 = s.add(2)
>>> s2
pbag([1, 1])
>>> s3
pbag([1, 2])
)r   r   r   r   r   s   &&r   addPBag.add)   s     $T\\7;<<r   c                \    V'       d$   \        \        \        WP                  4      4      # V # )zc
Update bag with all elements in iterable.

>>> s = pbag([1])
>>> s.update([1, 2])
pbag([1, 1, 2])
)r   r   r   r   )r   iterables   &&r   updatePBag.update7   s#     /<<HIIr   c                   WP                   9  d   \        V4      hV P                   V,          ^8X  d   V P                   P                  V4      pM3V P                   P                  WP                   V,          ^,
          4      p\	        V4      # )z
Remove an element from the bag.

>>> s = pbag([1, 1, 2])
>>> s2 = s.remove(1)
>>> s3 = s.remove(2)
>>> s2
pbag([1, 2])
>>> s3
pbag([1, 1])
)r   KeyErrorremover   r   )r   r   newcs   && r   r(   PBag.removeD   sj     ,,&7##\\'"a'<<&&w/D<<##G\\'-BQ-FGDDzr   c                :    V P                   P                  V^ 4      # )zv
Return the number of times an element appears.


>>> pbag([]).count('non-existent')
0
>>> pbag([1, 1, 2]).count(1)
2
)r   r   r   s   &&r   count
PBag.countX   s     ||++r   c                H    \        V P                  P                  4       4      # )zE
Return the length including duplicates.

>>> len(pbag([1, 1, 2]))
3
)sumr   
itervaluesr   s   &r   __len__PBag.__len__d   s     4<<**,--r   c              #     "   V P                   P                  4        F  w  r\        V4       F  pVx  K	  	  K  	  R# 5i)z~
Return an iterator of all elements, including duplicates.

>>> list(pbag([1, 1, 2]))
[1, 1, 2]
>>> list(pbag([1, 2]))
[1, 2]
N)r   	iteritemsrange)r   eltr,   is   &   r   __iter__PBag.__iter__m   s3      ,,002JC5\	 " 3s   <>c                    WP                   9   # )z_
Check if an element is in the bag.

>>> 1 in pbag([1, 1, 2])
True
>>> 0 in pbag([1, 2])
False
r   )r   r7   s   &&r   __contains__PBag.__contains__z   s     ll""r   c                6    R P                  \        V 4      4      # )z	pbag({0}))formatlistr1   s   &r   __repr__PBag.__repr__   s    !!$t*--r   c                p    \        V4      \        Jd   \        R4      hV P                  VP                  8H  # )z
Check if two bags are equivalent, honoring the number of duplicates,
and ignoring insertion order.

>>> pbag([1, 1, 2]) == pbag([1, 2])
False
>>> pbag([2, 1, 0]) == pbag([0, 1, 2])
True
z Can only compare PBag with PBags)typer   	TypeErrorr   r   others   &&r   __eq__PBag.__eq__   s/     ;d">??||u}},,r   c                    \        R 4      h)zPBags are not orderable)rE   rF   s   &&r   __lt__PBag.__lt__   s    122r   c                   \        V\        4      '       g   \        # V P                  P	                  4       pVP                  P                  4        F  w  r4V P                  V4      V,           W#&   K!  	  \        VP                  4       4      # )zb
Combine elements from two PBags.

>>> pbag([1, 2, 2]) + pbag([2, 3, 3])
pbag([1, 2, 2, 2, 3, 3])
)
isinstancer   NotImplementedr   evolverr5   r,   
persistent)r   rG   resultelemother_counts   &&   r   __add__PBag.__add__   sl     %&&!!%%'!&!8!8!:D::d+k9FL ";F%%'((r   c                b   \        V\        4      '       g   \        # V P                  P	                  4       pVP                  P                  4        FC  w  r4V P                  V4      V,
          pV^ 8  d   WRV&   K*  W09   g   K2  VP                  V4       KE  	  \        VP                  4       4      # )z|
Remove elements from one PBag that are present in another.

>>> pbag([1, 2, 2, 2, 3]) - pbag([2, 3, 3, 4])
pbag([1, 2, 2])
)	rN   r   rO   r   rP   r5   r,   r(   rQ   )r   rG   rR   rS   rT   newcounts   &&    r   __sub__PBag.__sub__   s     %&&!!%%'!&!8!8!:Dzz$'+5H!|'td# "; F%%'((r   c                &   \        V\        4      '       g   \        # V P                  P	                  4       pVP                  P                  4        F%  w  r4V P                  V4      p\        WT4      pWbV&   K'  	  \        VP                  4       4      # )z
Union: Keep elements that are present in either of two PBags.

>>> pbag([1, 2, 2, 2]) | pbag([2, 3, 3])
pbag([1, 2, 2, 2, 3, 3])
)	rN   r   rO   r   rP   r5   r,   maxrQ   )r   rG   rR   rS   rT   r,   rX   s   &&     r   __or__PBag.__or__   sx     %&&!!%%'!&!8!8!:DJJt$E5.H#4L "; F%%'((r   c                0   \        V\        4      '       g   \        # \        4       P	                  4       pV P
                  P                  4        F,  w  r4\        WAP                  V4      4      pV^ 8  g   K(  WRV&   K.  	  \        VP                  4       4      # )zv
Intersection: Only keep elements that are present in both PBags.

>>> pbag([1, 2, 2, 2]) & pbag([2, 3, 3])
pbag([2])
)
rN   r   rO   r
   rP   r   r5   minr,   rQ   )r   rG   rR   rS   r,   rX   s   &&    r   __and__PBag.__and__   su     %&&!!!<<113KD5++d"34H!|'t 4 F%%'((r   c                ,    \        V P                  4      # )z
Hash based on value of elements.

>>> m = pmap({pbag([1, 2]): "it's here!"})
>>> m[pbag([2, 1])]
"it's here!"
>>> pbag([1, 1, 2]) in m
False
)hashr   r1   s   &r   __hash__PBag.__hash__   s     DLL!!r   r   N)r   __weakref__)__name__
__module____qualname____firstlineno____doc__	__slots__r   r    r$   r(   r,   r2   r9   r<   rA   rH   rK   __le____gt____ge__rU   rY   r]   ra   re   __static_attributes____classdictcell__)__classdict__s   @r   r   r      sw     , +I=(
,.	#.-3 FFF))$) ) 
" 
"r   r   c                     \        V 4      # )z
Construct a persistent bag.

Takes an arbitrary number of arguments to insert into the new persistent
bag.

>>> b(1, 2, 3, 2)
pbag([1, 2, 2, 3])
)pbagelementss   *r   brx      s     >r   c                b    V '       g   \         # \        \        \        V \	        4       4      4      # )z
Convert an iterable to a persistent bag.

Takes an iterable with elements to insert.

>>> pbag([1, 2, 3, 2])
pbag([1, 2, 2, 3])
)_EMPTY_PBAGr   r   r   r
   rv   s   &r   ru   ru      s$     '46:;;r   N)collections.abcr   r   r   r   	functoolsr   typingr   r	   pyrsistent._pmapr
   r   r   r   registerrx   ru   rz    r   r   <module>r      s    @ @  # !v&?\"74= \"~ 
  4    $  t    $ 
< 46lr   