
    i                        S r SSKJr  SSKrSSKJr  SSKJr  SSK	J
r
  SSK	Jr  SS	K	Jr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr   " S S\\\4   \\\4   5      r " S S\\\4   5      rg)z3Provide :class:`MutableBidict` and :class:`bidict`.    )annotationsN   )MutableBidirectionalMapping)
BidictBase)ON_DUP_DROP_OLD)ON_DUP_RAISE)OnDup)DT)KT)MISSING)ODT)VT)
MapOrItemsc                  H   \ rS rSrSr\R                  (       a  \SS j5       r\SS j5       r	SS jr
SS jrSS jr\4SS jjrSS	 jrSS
 jr\R"                  SS j5       r\R"                  SSS jj5       r\4SS jjrSS jrSS S jjrSS S jjr\4S!S jjrS"S jrSrg)#MutableBidict"   z.Base class for mutable bidirectional mappings.c                    g N selfs    K/home/admin/cozy_coffee/venv/lib/python3.13/site-packages/bidict/_bidict.pyinverseMutableBidict.inverse'   s    47    c                    g r   r   r   s    r   invMutableBidict.inv*   s    03r   c                V    U R                   R                  U5      nU R                  U	 U$ r   )_fwdmpop_invmr   keyvals      r   _popMutableBidict._pop-   s$    jjnnS!JJsO
r   c                &    U R                  U5        g)u#   *x.__delitem__(y)　⟺　del x[y]*N)r&   r   r$   s     r   __delitem__MutableBidict.__delitem__2   s    		#r   c                8    U R                  XU R                  S9  g)a  Set the value for *key* to *val*.

If *key* is already associated with *val*, this is a no-op.

If *key* is already associated with a different value,
the old value will be replaced with *val*,
as with dict's :meth:`__setitem__`.

If *val* is already associated with a different key,
an exception is raised
to protect against accidental removal of the key
that's currently associated with *val*.

Use :meth:`put` instead if you want to specify different behavior in
the case that the provided key or value duplicates an existing one.
Or use :meth:`forceput` to unconditionally associate *key* with *val*,
replacing any existing items as necessary to preserve uniqueness.

:raises bidict.ValueDuplicationError: if *val* duplicates that of an
    existing item.

:raises bidict.KeyAndValueDuplicationError: if *key* duplicates the key of an
    existing item and *val* duplicates the value of a different
    existing item.
on_dupN)putr.   r#   s      r   __setitem__MutableBidict.__setitem__6   s    4 	$++.r   c                (    U R                  X44US9  g)a  Associate *key* with *val*, honoring the :class:`OnDup` given in *on_dup*.

For example, if *on_dup* is :attr:`~bidict.ON_DUP_RAISE`,
then *key* will be associated with *val* if and only if
*key* is not already associated with an existing value and
*val* is not already associated with an existing key,
otherwise an exception will be raised.

If *key* is already associated with *val*, this is a no-op.

:raises bidict.KeyDuplicationError: if attempting to insert an item
    whose key only duplicates an existing item's, and *on_dup.key* is
    :attr:`~bidict.RAISE`.

:raises bidict.ValueDuplicationError: if attempting to insert an item
    whose value only duplicates an existing item's, and *on_dup.val* is
    :attr:`~bidict.RAISE`.

:raises bidict.KeyAndValueDuplicationError: if attempting to insert an
    item whose key duplicates one existing item's, and whose value
    duplicates another existing item's, and *on_dup.val* is
    :attr:`~bidict.RAISE`.
r-   N_update)r   r$   r%   r.   s       r   r/   MutableBidict.putR   s    0 	sj]62r   c                ,    U R                  X[        S9  g)zAssociate *key* with *val* unconditionally.

Replace any existing mappings containing key *key* or value *val*
as necessary to preserve uniqueness.
r-   N)r/   r   r#   s      r   forceputMutableBidict.forceputl   s     	/2r   c                l    U R                   R                  5         U R                  R                  5         g)zRemove all items.N)r    clearr"   r   s    r   r:   MutableBidict.cleart   s"    



r   c                   g r   r   r)   s     r   r!   MutableBidict.popy   s    %(r   c                   g r   r   r   r$   defaults      r   r!   r=   {   s    =@r   c               ^     U R                  U5      $ ! [         a    U[        L a  e Us $ f = f)u   *x.pop(k[, d]) → v*

Remove specified key and return the corresponding value.

:raises KeyError: if *key* is not found and no *default* is provided.
)r&   KeyErrorr   r?   s      r   r!   r=   ~   s4    	99S>! 	'!N	s    ,,c                Z    U R                   R                  5       u  pU R                  U	 X4$ )ur   *x.popitem() → (k, v)*

Remove and return some item as a (key, value) pair.

:raises KeyError: if *x* is empty.
)r    popitemr"   r#   s      r   rD   MutableBidict.popitem   s*     ::%%'JJsOxr   r   c               "    U R                  XS9  g)zCLike calling :meth:`putall` with *self.on_dup* passed for *on_dup*.)kwNr3   r   argrG   s      r   updateMutableBidict.update   s    S r   c               ,    U R                  X[        S9  g)zLike a bulk :meth:`forceput`.)rG   r.   N)r4   r   rH   s      r   forceupdateMutableBidict.forceupdate   s    S8r   c                "    U R                  XS9  g)zuLike a bulk :meth:`put`.

If one of the given items causes an exception to be raised,
none of the items is inserted.
r-   Nr3   )r   itemsr.   s      r   putallMutableBidict.putall   s     	U*r   c                (    U R                  U5        U $ )zReturn self|=other.)rJ   )r   others     r   __ior__MutableBidict.__ior__   s    Er   N)returnzMutableBidict[VT, KT])r$   r   rW   r   )r$   r   rW   None)r$   r   r%   r   rW   rX   )r$   r   r%   r   r.   r	   rW   rX   )rW   rX   ).)r$   r   r@   r
   rW   VT | DT)r$   r   r@   zODT[DT]rW   rY   )rW   ztuple[KT, VT])r   )rI   MapOrItems[KT, VT]rG   r   rW   rX   )rP   rZ   r.   r	   rW   rX   )rT   zt.Mapping[KT, VT]rW   zMutableBidict[KT, VT])__name__
__module____qualname____firstlineno____doc__tTYPE_CHECKINGpropertyr   r   r&   r*   r0   r   r/   r7   r:   overloadr!   r   rD   rJ   rM   rQ   rU   __static_attributes__r   r   r   r   r   "   s    8	7 
7	3 
3
/8 5A 343
 ZZ( (ZZ@ @.5 	!9 AM +r   r   c                  h    \ rS rSrSr\R                  (       a  \SS j5       r\SS j5       r	Sr
gSr
g)bidict   zThe main bidirectional mapping type.

See :ref:`intro:Introduction` and :ref:`basic-usage:Basic Usage`
to get started (also available at https://bidict.rtfd.io).
c                    g r   r   r   s    r   r   bidict.inverse   s    -0r   c                    g r   r   r   s    r   r   
bidict.inv   s    ),r   r   N)rW   zbidict[VT, KT])r[   r\   r]   r^   r_   r`   ra   rb   r   r   rd   r   r   r   rf   rf      s1     		0 
0	, 
, r   rf   )r_   
__future__r   typingr`   _abcr   _baser   _dupr   r   r	   _typingr
   r   r   r   r   r   r   rf   r   r   r   <module>rr      sj    : "  -  !        JJr2v&(CBF(K JZ-]2r6" -r   