§
    Hºi%x  ã            
       óz  — d Z ddlmZmZ ddlmZmZmZmZm	Z	m
Z
mZ dZ e
d¦  «        Z G d„ dee         ¦  «        Z e
de¬	¦  «        Zd
edefd„Zd
edefd„Z G d„ d¦  «        Z G d„ deeef         ¦  «        Z G d„ deeef         ¦  «        Z G d„ de¦  «        Z G d„ deeef         ¦  «        Z e
d¦  «        Z G d„ deeeef         ¦  «        Z G d„ deeef         eeeeef         f         eeef         ¦  «        Z G d„ deee         ¦  «        Z G d„ d eee         ee         ¦  «        Zd!S )"zµ
A BTree in the style of Cormen, Leiserson, and Rivest's "Algorithms" book, with
copy-on-write node updates, cursors, and optional space optimization for mostly-in-order
insertion.
é    )ÚMutableMappingÚ
MutableSet)ÚAnyÚCallableÚGenericÚOptionalÚTupleÚTypeVarÚcasté   ÚKTc                   ó   — e Zd ZdZdefd„ZdS )ÚElementz+All items stored in the BTree are Elements.Úreturnc                 ó   — t           ‚)zFThe key for this element; the returned type must implement comparison.)ÚNotImplementedError©Úselfs    úN/home/mmwave/public_html/mmwave/venv/lib/python3.11/site-packages/dns/btree.pyÚkeyzElement.key   s   € å!Ð!ó    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   © r   r   r   r      s5   € € € € € Ø5Ð5ð"�Rð "ð "ð "ð "ð "ð "r   r   ÚET)ÚboundÚtr   c                 ó   — | dz
  S )z[The minimum number of keys in a non-root node for a BTree with the specified
    ``t``
    é   r   ©r   s    r   Ú_MINr#      s   € ð ˆq‰5€Lr   c                 ó   — d| z  dz
  S )zGThe maximum number of keys in node for a BTree with the specified ``t``é   r!   r   r"   s    r   Ú_MAXr&   #   s   € àˆq‰5�1‰9Ðr   c                   ó   — e Zd ZdZd„ ZdS )Ú_CreatorzÓA _Creator class instance is used as a unique id for the BTree which created
    a node.

    We use a dedicated creator rather than just a BTree reference to avoid circularity
    that would complicate GC.
    c                 ó$   — t          | ¦  «        d›S )NÚx©Úidr   s    r   Ú__str__z_Creator.__str__0   s   € Ý�T‘(”(ˆˆÐr   N)r   r   r   r   r-   r   r   r   r(   r(   (   s-   € € € € € ðð ðð ð ð ð r   r(   c            	       ó&  — e Zd ZdZg d¢Zdededefd„Zdefd„Z	defd	„Z
d
edeeef         fd„Zdeddfd„Zd
edeed         ef         fd„Zd
ededz  fd„Zdeddfd„Zdedededz  fd„Zdededf         fd„Zdddedefd„Zdddedefd„Zdddeddddfd„Zdddeddfd„Zdefd„Zdefd „Zdddeddfd!„Zd
eded         d"edz  dedz  fd#„Zd$eegdf         ddfd%„Z d$edgdf         ddfd&„Z!deded         fd'„Z"deddfd(„Z#d)„ Z$dS )*Ú_NodezFA Node in the BTree.

    A Node (leaf or internal) of the BTree.
    ©r   ÚcreatorÚis_leafÚeltsÚchildrenr   r1   r2   c                 ó\   — |dk    sJ ‚|| _         || _        || _        g | _        g | _        d S )Né   r0   )r   r   r1   r2   s       r   Ú__init__z_Node.__init__<   s6   € Ø�AŠvˆvˆvˆvØˆŒØˆŒØˆŒØ ˆŒ	Ø-/ˆŒˆˆr   r   c                 ó®   — t          | j        ¦  «        t          | j        ¦  «        k    sJ ‚t          | j        ¦  «        t          | j        ¦  «        k    S )z/Does this node have the maximal number of keys?)Úlenr3   r&   r   r   s    r   Ú
is_maximalz_Node.is_maximalD   ó>   € å�4”9‰~Œ~¥ d¤f¡¤Ò-Ð-Ð-Ð-Ý�4”9‰~Œ~¥ d¤f¡¤Ò-Ð-r   c                 ó®   — t          | j        ¦  «        t          | j        ¦  «        k    sJ ‚t          | j        ¦  «        t          | j        ¦  «        k    S )z/Does this node have the minimal number of keys?)r9   r3   r#   r   r   s    r   Ú
is_minimalz_Node.is_minimalI   r;   r   r   c                 ón  — t          | j        ¦  «        }|dk    r*|| j        |dz
                                ¦   «         k    r|dfS d}t          | j        ¦  «        }|dz
  }d}||k    rK||z   dz  }| j        |                              ¦   «         }||k    r|}d}n||k     r|}|dz
  }n|dz   }||k    °K||fS )z×Get the index of the ``Element`` matching ``key`` or the index of its
        least successor.

        Returns a tuple of the index and an ``equal`` boolean that is ``True`` iff.
        the key was found.
        r   r!   Fr%   T)r9   r3   r   )r   r   ÚlÚiÚrÚequalÚmÚks           r   Úsearch_in_nodez_Node.search_in_nodeN   sß   € õ �”	‰NŒNˆØˆqŠ5ˆ5�S˜4œ9 Q¨¡UÔ+×/Ò/Ñ1Ô1Ò1Ð1à�e�8ˆOØˆÝ�”	‰NŒNˆØ�‰EˆØˆØ�1ŠfˆfØ�Q‘˜1‘ˆAØ”	˜!”× Ò Ñ"Ô"ˆAØ�aŠxˆxØ�Ø�ØØ�q’�Ø�Ø˜‘E��à˜‘E�ð �1Šfˆfð �%ˆxˆr   Úindexz_Node[KT, ET]c                 ó‚   — | j         rJ ‚| j        |         }|                     | j        ¦  «        }|r|| j        |<   |S |S ©N)r2   r4   Ú	maybe_cowr1   )r   rF   ÚchildÚcloneds       r   Úmaybe_cow_childz_Node.maybe_cow_childk   sM   € Ø”<ÐÐÐØ”˜eÔ$ˆØ—’ ¤Ñ.Ô.ˆØð 	Ø#)ˆDŒM˜%Ñ ØˆMàˆLr   c                 ó¤   — |                       |¦  «        \  }}|r| |fS | j        rdS |                      |¦  «        }|                     |¦  «        S )zÜGet the node associated with key and its index, doing
        copy-on-write if we have to descend.

        Returns a tuple of the node and the index, or the tuple ``(None, 0)``
        if the key was not found.
        ©Nr   )rE   r2   rL   Ú	_get_node)r   r   r@   rB   rJ   s        r   rO   z_Node._get_nodeu   sa   € ð ×&Ò& sÑ+Ô+‰ˆˆ5Øð 	(Ø˜!�9ÐØŒ\ð 	(Ø�9à×(Ò(¨Ñ+Ô+ˆEØ—?’? 3Ñ'Ô'Ð'r   Nc                 ó¢   — |                       |¦  «        \  }}|r| j        |         S | j        rdS | j        |                              |¦  «        S )z8Get the element associated with *key* or return ``None``N)rE   r3   r2   r4   Úget)r   r   r@   rB   s       r   rQ   z	_Node.get…   sW   € à×&Ò& sÑ+Ô+‰ˆˆ5Øð 	-Ø”9˜Q”<ÐØŒ\ð 	-Ø�4à”= Ô#×'Ò'¨Ñ,Ô,Ð,r   c                 ó   — |dk    rdS | j         |dz
           }t          |j        ¦  «        t          | j        ¦  «        k    rdS |                      |dz
  ¦  «        }t          |j        ¦  «        t          | j        ¦  «        k     rG|                     | |dz
  ¦  «        sdS t          |j        ¦  «        t          | j        ¦  «        k     °EdS dS )a-  Try to minimize the number of Nodes in a BTree where the insertion
        is done in-order or close to it, by stealing as much as we can from our
        right sibling.

        If we don't do this, then an in-order insertion will produce a BTree
        where most of the nodes are minimal.
        r   Nr!   )r4   r9   r3   r&   r   rL   Útry_right_steal)r   rF   Úlefts      r   Úoptimize_in_order_insertionz!_Node.optimize_in_order_insertion�   s¾   € ð �AŠ:ˆ:ØˆFØŒ}˜U Q™YÔ'ˆÝˆtŒy‰>Œ>�T $¤&™\œ\Ò)Ð)ØˆFØ×#Ò# E¨A¡IÑ.Ô.ˆÝ�$”)‰nŒn�t D¤F™|œ|Ò+Ð+Ø×'Ò'¨¨e°a©iÑ8Ô8ð Ø�õ �$”)‰nŒn�t D¤F™|œ|Ò+Ð+Ð+Ð+Ð+Ð+r   ÚelementÚin_orderc                 óð  — |                       ¦   «         rJ ‚	 |                     ¦   «         }|                      |¦  «        \  }}|r| j        |         }|| j        |<   |S | j        r| j                             ||¦  «         d S |                      |¦  «        }|                      ¦   «         r | j        |                     ¦   «         Ž  Œ²| 	                    ||¦  «        }|r|  
                    |¦  «         |S rH   )r:   r   rE   r3   r2   ÚinsertrL   ÚadoptÚsplitÚinsert_nonfullrU   )	r   rV   rW   r   r@   rB   ÚoldrJ   Úoelts	            r   r\   z_Node.insert_nonfull¡   s  € Ø—?’?Ñ$Ô$Ð$Ð$Ð$ð	Ø—+’+‘-”-ˆCØ×*Ò*¨3Ñ/Ô/‰HˆAˆuØð à”i ”l�Ø&�”	˜!‘Ø�
Ø”ð Ø”	× Ò   GÑ,Ô,Ð,Ø�tà×,Ò,¨QÑ/Ô/�Ø×#Ò#Ñ%Ô%ð Ø�D”J §¢¡¤Ð.Ð.ð Ø×+Ò+¨G°XÑ>Ô>�Øð 8Ø×4Ò4°QÑ7Ô7Ð7Ø�r   c                 óz  — |                       ¦   «         sJ ‚|                      | j        | j        | j        ¦  «        }t          | j        t          | j        ¦  «        dz   d…         ¦  «        |_        | j        t          | j        ¦  «                 }t          | j        dt          | j        ¦  «        …         ¦  «        | _        | j        slt          | j        t          | j        ¦  «        dz   d…         ¦  «        |_        t          | j        dt          | j        ¦  «        dz   …         ¦  «        | _        | ||fS )zASplit a maximal node into two minimal ones and a central element.r!   N)	r:   Ú	__class__r   r1   r2   Úlistr3   r#   r4   )r   ÚrightÚmiddles      r   r[   z_Node.splitº   sü   € à�ŠÑ Ô Ð Ð Ð Ø—’˜tœv t¤|°T´\ÑBÔBˆÝ˜$œ)¥D¨¬¡L¤L°1Ñ$4Ð$6Ð$6Ô7Ñ8Ô8ˆŒ
Ø”�4 ¤™<œ<Ô(ˆÝ˜œ >¥T¨$¬&¡\¤\ >Ô2Ñ3Ô3ˆŒ	ØŒ|ð 	DÝ! $¤-µ°T´V±´¸qÑ0@Ð0BÐ0BÔ"CÑDÔDˆEŒNÝ  ¤Ð/Aµ°d´f±´ÀÑ1AÐ/AÔ!BÑCÔCˆDŒMØ�V˜UÐ"Ð"r   Úparentc                 ó´  — |dk    rÑ|j         |dz
           }|                     ¦   «         s­|                     |dz
  ¦  «        }|j        |dz
           }|j                             ¦   «         |j        |dz
  <   | j                             d|¦  «         |j        s=| j        rJ ‚|j                              ¦   «         }| j                              d|¦  «         dS dS )z—Try to steal from this Node's left sibling for balancing purposes.

        Returns ``True`` if the theft was successful, or ``False`` if not.
        r   r!   TF)r4   r=   rL   r3   ÚpoprY   r2   )r   rd   rF   rT   ÚeltrJ   s         r   Útry_left_stealz_Node.try_left_stealÆ   sÕ   € ð
 �AŠ:ˆ:Ø”? 5¨1¡9Ô-ˆDØ—?’?Ñ$Ô$ð 	Ø×-Ò-¨e°a©iÑ8Ô8�Ø”k %¨!¡)Ô,�Ø)-¬¯ª©¬�”˜E A™IÑ&Ø”	× Ò   CÑ(Ô(Ð(Ø”|ð 3Ø#œ|Ð+Ð+Ð+Ø œM×-Ò-Ñ/Ô/�EØ”M×(Ò(¨¨EÑ2Ô2Ð2Ø�tØˆur   c                 óÒ  — |dz   t          |j        ¦  «        k     rË|j        |dz            }|                     ¦   «         s§|                     |dz   ¦  «        }|j        |         }|j                             d¦  «        |j        |<   | j                             |¦  «         |j        s=| j        rJ ‚|j                             d¦  «        }| j                             |¦  «         dS dS )z˜Try to steal from this Node's right sibling for balancing purposes.

        Returns ``True`` if the theft was successful, or ``False`` if not.
        r!   r   TF)r9   r4   r=   rL   r3   rf   Úappendr2   )r   rd   rF   rb   rg   rJ   s         r   rS   z_Node.try_right_stealÙ   sá   € ð
 �1‰9•s˜6œ?Ñ+Ô+Ò+Ð+Ø”O E¨A¡IÔ.ˆEØ×#Ò#Ñ%Ô%ð 	Ø×.Ò.¨u°q©yÑ9Ô9�Ø”k %Ô(�Ø%*¤Z§^¢^°AÑ%6Ô%6�”˜EÑ"Ø”	× Ò  Ñ%Ô%Ð%Ø”}ð 0Ø#œ|Ð+Ð+Ð+Ø!œN×.Ò.¨qÑ1Ô1�EØ”M×(Ò(¨Ñ/Ô/Ð/Ø�tØˆur   rT   rc   rb   c                 ó‚  — |                       ¦   «         rJ ‚| j        rJ ‚|                     ¦   «         }|                      |¦  «        \  }}|rJ ‚| j                             ||¦  «         t          | j        ¦  «        dk    r||g| _        dS | j        |         |k    sJ ‚| j                             |dz   |¦  «         dS )zÒAdopt left, middle, and right into our Node (which must not be maximal,
        and which must not be a leaf).  In the case were we are not the new root,
        then the left child must already be in the Node.r   r!   N)r:   r2   r   rE   r3   rY   r9   r4   )r   rT   rc   rb   r   r@   rB   s          r   rZ   z_Node.adoptì   sÎ   € ð —?’?Ñ$Ô$Ð$Ð$Ð$Ø”<ÐÐÐØ�jŠj‰lŒlˆØ×&Ò& sÑ+Ô+‰ˆˆ5ØÐÐÐØŒ	×Ò˜˜FÑ#Ô#Ð#ÝˆtŒ}ÑÔ Ò"Ð"à! 5˜MˆDŒMˆMˆMà”= Ô# tÒ+Ð+Ð+Ð+ØŒM× Ò   Q¡¨Ñ.Ô.Ð.Ð.Ð.r   c                 ó2  — |j                              |dz   ¦  «        }| j                             |j                             |¦  «        ¦  «         | j                             |j        ¦  «         | j        s!| j                              |j         ¦  «         dS dS )z>Merge this node's parent and its right sibling into this node.r!   N)r4   rf   r3   rj   Úextendr2   )r   rd   rF   rb   s       r   Úmergez_Node.mergeý   s‰   € à”×#Ò# E¨A¡IÑ.Ô.ˆØŒ	×Ò˜œŸš¨Ñ/Ô/Ñ0Ô0Ð0ØŒ	×Ò˜œÑ$Ô$Ð$ØŒ|ð 	1ØŒM× Ò  ¤Ñ0Ô0Ð0Ð0Ð0ð	1ð 	1r   c                 óh   — | j         r| j        d         S | j        d                              ¦   «         S )z"The least element in this subtree.r   )r2   r3   r4   Úminimumr   s    r   rp   z_Node.minimum  s1   € àŒ<ð 	.Ø”9˜Q”<Ðà”= Ô#×+Ò+Ñ-Ô-Ð-r   c                 óh   — | j         r| j        d         S | j        d                              ¦   «         S )z%The greatest element in this subtree.éÿÿÿÿ)r2   r3   r4   Úmaximumr   s    r   rs   z_Node.maximum  s1   € àŒ<ð 	/Ø”9˜R”=Ð à”= Ô$×,Ò,Ñ.Ô.Ð.r   c                 ó  — |j         rJ ‚|                      ||¦  «        rdS |                      ||¦  «        rdS |dk    r|                      ||¦  «         dS |                     |dz
  ¦  «        }|                     ||dz
  ¦  «         dS )z¶This Node is minimal, and we want to make it non-minimal so we can delete.
        We try to steal from our siblings, and if that doesn't work we will merge
        with one of them.Nr   r!   )r2   rh   rS   rn   rL   )r   rd   rF   rT   s       r   Úbalancez_Node.balance  s¦   € ð ”>Ð!Ð!Ð!Ø×Ò˜v uÑ-Ô-ð 	ØˆFØ×Ò ¨Ñ.Ô.ð 	ØˆFà�AŠ:ˆ:à�JŠJ�v˜uÑ%Ô%Ð%Ð%Ð%ð ×)Ò)¨%°!©)Ñ4Ô4ˆDØ�JŠJ�v˜u q™yÑ)Ô)Ð)Ð)Ð)r   Úexactc                 óB  — |�|                       ¦   «         rJ ‚|                      |¦  «        \  }}d}|r€|�| j        |         |urt          d¦  «        ‚| j        r| j                             |¦  «        S d}|}| j        |dz                                 ¦   «         }|                     ¦   «         }|dz   }| j        r|�t          d¦  «        ‚dS |  	                    |¦  «        }|                      ¦   «         rU| 
                    | |¦  «         |                      |¦  «        \  }}|rJ ‚| j        |         }|                      ¦   «         rJ ‚|                     || |¦  «        }	|�9|                      |¦  «        \  }
}|
€J ‚|	€J ‚|
j        |         }|	|
j        |<   |}	|	S )zÁDelete an element matching *key* if it exists.  If *exact* is not ``None``
        then it must be an exact match with that element.  The Node must not be
        minimal unless it is the root.Nz'exact delete did not match existing eltr!   zexact delete had no match)r=   rE   r3   Ú
ValueErrorr2   rf   r4   rp   r   rL   ru   ÚdeleterO   )r   r   rd   rv   r@   rB   Úoriginal_keyÚleast_successorrJ   rg   Únoder^   s               r   ry   z_Node.delete&  sÏ  € ð ˆ~ T§_¢_Ñ%6Ô%6ˆ~ˆ~ˆ~Ø×&Ò& sÑ+Ô+‰ˆˆ5ØˆØð 	àÐ  T¤Y¨q¤\¸Ð%>Ð%>Ý Ð!JÑKÔKÐKØŒ|ð (Ø”y—}’} QÑ'Ô'Ð'ð ˆEØˆLØ"œm¨A°©EÔ2×:Ò:Ñ<Ô<ˆOØ!×%Ò%Ñ'Ô'ˆCØ�A‘ˆAØŒ<ð 	àÐ Ý Ð!<Ñ=Ô=Ð=Ø�4à×$Ò$ QÑ'Ô'ˆØ×ÒÑÔð 	*Ø�MŠM˜$ Ñ"Ô"Ð"à×*Ò*¨3Ñ/Ô/‰HˆAˆuØÐÐÐØ”M !Ô$ˆEØ×'Ò'Ñ)Ô)Ð)Ð)Ð)Ø�lŠl˜3  eÑ,Ô,ˆØÐ#Ø—n’n \Ñ2Ô2‰GˆD�!ØÐ#Ð#Ð#Ø�?�?�?Ø”9˜Q”<ˆDØˆDŒI�a‰LØˆCØˆ
r   Úvisitc                 óð   — t          | j        ¦  «        D ]7\  }}| j        s | j        |                              |¦  «          ||¦  «         Œ8| j        s"| j        d                              |¦  «         dS dS )z-Call *visit* on all of the elements in order.rr   N)Ú	enumerater3   r2   r4   Úvisit_in_order)r   r}   r@   rg   s       r   r€   z_Node.visit_in_orderU  sˆ   € å ¤	Ñ*Ô*ð 	ð 	‰FˆAˆsØ”<ð 7Ø”˜aÔ ×/Ò/°Ñ6Ô6Ð6ØˆE�#‰JŒJˆJˆJØŒ|ð 	4ØŒM˜"Ô×,Ò,¨UÑ3Ô3Ð3Ð3Ð3ð	4ð 	4r   c                 ól   —  || ¦  «         | j         s| j        D ]}|                     |¦  «         ŒdS dS )z?Visit nodes in preorder.  This method is only used for testing.N)r2   r4   Ú_visit_preorder_by_node)r   r}   rJ   s      r   r‚   z_Node._visit_preorder_by_node^  sU   € àˆˆd‰ŒˆØŒ|ð 	5Øœð 5ð 5�Ø×-Ò-¨eÑ4Ô4Ð4Ð4ð	5ð 	5ð5ð 5r   c                 óB   — | j         |ur|                      |¦  «        S dS )zœReturn a clone of this Node if it was not created by *creator*, or ``None``
        otherwise (i.e. copy for copy-on-write if we haven't already copied it).N)r1   Úclone)r   r1   s     r   rI   z_Node.maybe_cowe  s(   € ð Œ<˜wÐ&Ð&Ø—:’:˜gÑ&Ô&Ð&à�4r   c                 óÒ   — |                       | j        || j        ¦  «        }|j                             | j        ¦  «         | j        s|j                             | j        ¦  «         |S )z+Make a shallow-copy duplicate of this node.)r`   r   r2   r3   rm   r4   )r   r1   rK   s      r   r„   z_Node.clonem  sZ   € à—’ ¤¨°´Ñ>Ô>ˆØŒ×Ò˜4œ9Ñ%Ô%Ð%ØŒ|ð 	2ØŒO×"Ò" 4¤=Ñ1Ô1Ð1Øˆr   c                 ó¬   — | j         s(dd                     d„ | j        D ¦   «         ¦  «        z   }nd}t          | ¦  «        d›d| j        › d| j        › |› �S )Nú c                 ó0   — g | ]}t          |¦  «        d ›‘ŒS )r*   r+   )Ú.0Úcs     r   ú
<listcomp>z!_Node.__str__.<locals>.<listcomp>w  s"   € Ð&KÐ&KÐ&K¸­"¨Q©%¬% | |Ð&KÐ&KÐ&Kr   Ú r*   )r2   Újoinr4   r,   r1   r3   )r   r4   s     r   r-   z_Node.__str__u  sh   € ØŒ|ð 	Ø˜SŸXšXÐ&KÐ&K¸T¼]Ð&KÑ&KÔ&KÑLÔLÑLˆHˆHàˆHÝ�T‘(”(ÐCÐCÐC˜tœ|ÐCÐC¨d¬iÐC¸ÐCÐCÐCr   )%r   r   r   r   Ú	__slots__Úintr(   Úboolr7   r:   r=   r   ÚtuplerE   rL   r	   r   rO   r   rQ   rU   r\   r[   rh   rS   rZ   rn   rp   rs   ru   ry   r   r€   r‚   rI   r„   r-   r   r   r   r/   r/   4   s¬  € € € € € ðð ð
 @Ð?Ð?€Ið0˜#ð 0¨ð 0¸4ð 0ð 0ð 0ð 0ð.˜Dð .ð .ð .ð .ð
.˜Dð .ð .ð .ð .ð
 "ð ¨¨s°D¨yÔ)9ð ð ð ð ð: Sð ¨_ð ð ð ð ð(˜Rð ( E¨(°?Ô*CÀSÐ*HÔ$Ið (ð (ð (ð (ð -�rð -˜b 4™ið -ð -ð -ð -ð°ð ¸ð ð ð ð ð$ bð °Dð ¸RÀ$¹Yð ð ð ð ð2
#�u˜_¨b°/ÐAÔBð 
#ð 
#ð 
#ð 
#ð _ð ¸Sð ÀTð ð ð ð ð& oð ¸cð Àdð ð ð ð ð&/˜/ð /°2ð /¸oð /ÐRVð /ð /ð /ð /ð"1˜Oð 1°Cð 1¸Dð 1ð 1ð 1ð 1ð.˜ð .ð .ð .ð .ð/˜ð /ð /ð /ð /ð*˜oð *°cð *¸dð *ð *ð *ð *ð&-Øð-Ø'¨Ô8ð-ØACÀdÁð-à	ˆd‰ð-ð -ð -ð -ð^4 H¨b¨T°4¨ZÔ$8ð 4¸Tð 4ð 4ð 4ð 4ð5¨X°Ð6GÈÐ6MÔ-Nð 5ÐSWð 5ð 5ð 5ð 5ð ð ¨h°Ô.Gð ð ð ð ð˜Xð ¨/ð ð ð ð ðDð Dð Dð Dð Dr   r/   c                   ó    — e Zd ZdZdd„Zdd„Zdd„Zd	„ Zd
„ Zde	dz  fd„Z
de	dz  fd„Zdededdfd„Zddededdfd„Zdd„Zdd„Zd„ Zd„ ZdS )ÚCursorzÍA seekable cursor for a BTree.

    If you are going to use a cursor on a mutable BTree, you should use it
    in a ``with`` block so that any mutations of the BTree automatically park
    the cursor.
    ÚbtreeúBTree[KT, ET]c                 ó„   — || _         d | _        d| _        d| _        d| _        g | _        d| _        d | _        d| _        d S )Nr   FT)	r”   Úcurrent_nodeÚcurrent_indexÚrecurseÚ
increasingÚparentsÚparkedÚparking_keyÚparking_key_read)r   r”   s     r   r7   zCursor.__init__…  sM   € ØˆŒ
Ø*.ˆÔð #$ˆÔØˆŒØˆŒØ02ˆŒØˆŒØ&*ˆÔØ %ˆÔÐÐr   r   Nc                 óð   — | j         €J ‚| j         j        s`| j                             | j         | j        f¦  «         | j         j        | j                 | _         | j         €J ‚d| _        | j         j        ¯^d S d S rN   )r—   r2   r›   rj   r˜   r4   r   s    r   Ú_seek_leastzCursor._seek_least“  s“   € ð Ô Ð,Ð,Ð,ØÔ#Ô+ð 	#ØŒL×Ò Ô!2°DÔ4FÐ GÑHÔHÐHØ $Ô 1Ô :¸4Ô;MÔ NˆDÔØÔ$Ð0Ð0Ð0Ø!"ˆDÔð	 Ô#Ô+ð 	#ð 	#ð 	#ð 	#ð 	#r   c                 ó  — | j         €J ‚| j         j        sw| j                             | j         | j        f¦  «         | j         j        | j                 | _         | j         €J ‚t          | j         j        ¦  «        | _        | j         j        ¯ud S d S rH   )r—   r2   r›   rj   r˜   r4   r9   r3   r   s    r   Ú_seek_greatestzCursor._seek_greatest�  s¡   € ð Ô Ð,Ð,Ð,ØÔ#Ô+ð 	=ØŒL×Ò Ô!2°DÔ4FÐ GÑHÔHÐHØ $Ô 1Ô :¸4Ô;MÔ NˆDÔØÔ$Ð0Ð0Ð0Ý!$ TÔ%6Ô%;Ñ!<Ô!<ˆDÔð	 Ô#Ô+ð 	=ð 	=ð 	=ð 	=ð 	=r   c                 ó&   — | j         s	d| _         dS dS )a§  Park the cursor.

        A cursor must be "parked" before mutating the BTree to avoid undefined behavior.
        Cursors created in a ``with`` block register with their BTree and will park
        automatically.  Note that a parked cursor may not observe some changes made when
        it is parked; for example a cursor being iterated with next() will not see items
        inserted before its current position.
        TN)rœ   r   s    r   ÚparkzCursor.park§  s#   € ð Œ{ð 	ØˆDŒKˆKˆKð	ð 	r   c                 óÂ   — | j         rW| j        �@| j        }| j        r	| j         }n| j        }|                      | j        |¦  «         || _        d| _         d | _        d S d S ©NF)rœ   r�   rš   rž   Úseek)r   rš   Úbefores      r   Ú_maybe_unparkzCursor._maybe_unpark³  s{   € ØŒ;ð 	$ØÔÐ+à!œ_�
ØÔ(ð -ð "&¤Ð0�F�Fð
 "œ_�FØ—	’	˜$Ô*¨FÑ3Ô3Ð3Ø",�”ØˆDŒKØ#ˆDÔÐÐð!	$ð 	$r   c                 óÚ  — |                       ¦   «          d| _        | j        €b| j        dk    rdS | j        dk    sJ ‚| j        j        | _        t          | j        j        j        ¦  «        | _        |                      ¦   «          	 | j	        r"| j
        s|                      ¦   «          d| _	        d| _
        | xj        dz  c_        | j        dk    rL| j        j        | j                 }| j        j        sd| _	        |                     ¦   «         | _        d| _        |S t          | j        ¦  «        dk    r'| j                             ¦   «         \  | _        | _        nd| _        d| _        dS Œç)zAGet the previous element, or return None if on the left boundary.Nr   r!   TF)r©   r�   r—   r˜   r”   Úrootr9   r3   r¢   r™   rš   r2   r   rž   r›   rf   ©r   rg   s     r   ÚprevzCursor.prevÆ  su  € à×ÒÑÔÐØˆÔØÔÐ$àÔ! QÒ&Ð&à�tàÔ)¨QÒ.Ð.Ð.Ð.ð %)¤J¤O�Ô!Ý%(¨¬¬Ô)=Ñ%>Ô%>�Ô"Ø×#Ò#Ñ%Ô%Ð%ð	 ØŒ|ð %Ø”ð *ð ×'Ò'Ñ)Ô)Ð)Ø$�”Ø#ˆDŒOØÐÔ !Ñ#ÐÔØÔ! QÒ&Ð&ØÔ'Ô,¨TÔ-?Ô@�ØÔ(Ô0ð (Ø#'�D”LØ#&§7¢7¡9¤9�Ô Ø(,�Ô%Ø�
å�t”|Ñ$Ô$ qÒ(Ð(Ø<@¼L×<LÒ<LÑ<NÔ<NÑ9�DÔ% tÔ'9Ð'9à(,�DÔ%Ø)*�DÔ&Ø˜4ð-	 r   c                 óÐ  — |                       ¦   «          d| _        | j        €F| j        dk    rdS | j        dk    sJ ‚| j        j        | _        d| _        |                      ¦   «          	 | j        r"| j        r|                      ¦   «          d| _        d| _        | j        t          | j        j
        ¦  «        k     r\| j        j
        | j                 }| xj        dz  c_        | j        j        sd| _        |                     ¦   «         | _        d| _        |S t          | j        ¦  «        dk    r'| j                             ¦   «         \  | _        | _        nd| _        d| _        dS Œþ)z>Get the next element, or return None if on the right boundary.Nr!   r   TF)r©   r�   r—   r˜   r”   r«   r    r™   rš   r9   r3   r2   r   rž   r›   rf   r¬   s     r   ÚnextzCursor.nextî  st  € à×ÒÑÔÐØˆÔØÔÐ$àÔ! QÒ&Ð&à�tàÔ)¨QÒ.Ð.Ð.Ð.ð %)¤J¤O�Ô!Ø%&�Ô"Ø× Ò Ñ"Ô"Ð"ð	 ØŒ|ð %Ø”?ð 'ð ×$Ò$Ñ&Ô&Ð&Ø$�”Ø"ˆDŒOØÔ!¥C¨Ô(9Ô(>Ñ$?Ô$?Ò?Ð?ØÔ'Ô,¨TÔ-?Ô@�ØÐ"Ô" aÑ'Ð"Ô"ØÔ(Ô0ð (Ø#'�D”LØ#&§7¢7¡9¤9�Ô Ø(,�Ô%Ø�
å�t”|Ñ$Ô$ qÒ(Ð(Ø<@¼L×<LÒ<LÑ<NÔ<NÑ9�DÔ% tÔ'9Ð'9à(,�DÔ%Ø)*�DÔ&Ø˜4ð-	 r   r¨   r@   c                 ó0   — |r	|| _         d S |dz   | _         d S )Nr!   )r˜   )r   r¨   r@   s      r   Ú_adjust_for_beforezCursor._adjust_for_before  s*   € Øð 	'Ø!"ˆDÔÐÐà!" Q¡ˆDÔÐÐr   Tr   c                 ó€  — | j         j        | _        | j        €J ‚d| _        g | _        || _        d| _        || _        d| _        | j        j	        s¯| j         
                    |¦  «        \  }}|rC|                      ||¦  «         |r|                      ¦   «          n|                      ¦   «          dS | j                             | j        |f¦  «         | j        j        |         | _        | j        €J ‚| j        j	        ¯¯| j         
                    |¦  «        \  }}|r|                      ||¦  «         dS || _        dS )a½  Seek to the specified key.

        If *before* is ``True`` (the default) then the cursor is positioned just
        before *key* if it exists, or before its least successor if it doesn't.  A
        subsequent next() will retrieve this value.  If *before* is ``False``, then
        the cursor is positioned just after *key* if it exists, or its greatest
        precessessor if it doesn't.  A subsequent prev() will return this value.
        NF)r”   r«   r—   r™   r›   rš   rœ   r�   rž   r2   rE   r±   r¢   r    rj   r4   r˜   )r   r   r¨   r@   rB   s        r   r§   zCursor.seek  sc  € ð !œJœOˆÔØÔ Ð,Ð,Ð,ØˆŒØˆŒØ ˆŒØˆŒØˆÔØ %ˆÔØÔ#Ô+ð 	1ØÔ(×7Ò7¸Ñ<Ô<‰HˆAˆuØð Ø×'Ò'¨°Ñ2Ô2Ð2Øð 'Ø×'Ò'Ñ)Ô)Ð)Ð)à×$Ò$Ñ&Ô&Ð&Ø�ØŒL×Ò Ô!2°AÐ 6Ñ7Ô7Ð7Ø $Ô 1Ô :¸1Ô =ˆDÔØÔ$Ð0Ð0Ð0ð Ô#Ô+ð 	1ð Ô$×3Ò3°CÑ8Ô8‰ˆˆ5Øð 	#Ø×#Ò# F¨AÑ.Ô.Ð.Ð.Ð.à!"ˆDÔÐÐr   c                 óh   — d| _         d| _        d| _        d| _        g | _        d| _        d| _        dS )z”Seek to the left boundary (i.e. just before the least element).

        A subsequent next() will return the least element if the BTree isn't empty.Nr   FT©r—   r˜   r™   rš   r›   rœ   r�   r   s    r   Ú
seek_firstzCursor.seek_first?  s>   € ð !ˆÔØˆÔØˆŒØˆŒØˆŒØˆŒØˆÔÐÐr   c                 óh   — d| _         d| _        d| _        d| _        g | _        d| _        d| _        dS )z£Seek to the right boundary (i.e. just after the greatest element).

        A subsequent prev() will return the greatest element if the BTree isn't empty.
        Nr!   Fr´   r   s    r   Ú	seek_lastzCursor.seek_lastK  s>   € ð
 !ˆÔØˆÔØˆŒØˆŒØˆŒØˆŒØˆÔÐÐr   c                 ó:   — | j                              | ¦  «         | S rH   )r”   Úregister_cursorr   s    r   Ú	__enter__zCursor.__enter__X  s   € ØŒ
×"Ò" 4Ñ(Ô(Ð(Øˆr   c                 ó:   — | j                              | ¦  «         dS r¦   )r”   Úderegister_cursor)r   Úexc_typeÚ	exc_valueÚ	tracebacks       r   Ú__exit__zCursor.__exit__\  s   € ØŒ
×$Ò$ TÑ*Ô*Ð*Øˆur   )r”   r•   ©r   N)T)r   r   r   r   r7   r    r¢   r¤   r©   r   r­   r¯   r�   r�   r±   r   r§   rµ   r·   rº   rÀ   r   r   r   r“   r“   }  sV  € € € € € ðð ð&ð &ð &ð &ð#ð #ð #ð #ð=ð =ð =ð =ð
ð 
ð 
ð$ð $ð $ð&& �b˜4‘ið & ð & ð & ð & ðP& �b˜4‘ið & ð & ð & ð & ðP'¨ð '°#ð '¸$ð 'ð 'ð 'ð 'ð!#ð !#˜ð !# Dð !#°Dð !#ð !#ð !#ð !#ðF
 ð 
 ð 
 ð 
 ð ð  ð  ð  ðð ð ðð ð ð ð r   r“   c                   ó   — e Zd ZdZdS )Ú	ImmutablezThe BTree is immutable.N)r   r   r   r   r   r   r   rÃ   rÃ   a  s   € € € € € Ø!Ð!Ð!Ð!r   rÃ   c                   óT  — e Zd ZdZeddœdeded          fd„Zd„ Zdd	„Z	d de
dede
dz  fd„Zdede
dz  fd„Zdede
dz  de
dz  fd„Zdede
dz  fd„Zde
de
dz  fd„Zd„ Zdee
gdf         ddfd„Zdeegdf         ddfd„Zdeee
f         fd„Zdeddfd„Zdeddfd„Zd„ Zd„ ZdS )!ÚBTreez2An in-memory BTree with copy-on-write and cursors.N©r   Úoriginalr   rÇ   c                ón  — t          ¦   «         | _        d| _        |  |  |  t          ¦   «         | _        |�<|j        st          d¦  «        ‚|j        | _        |j        | _        |j        | _        dS |dk     rt          d¦  «        ‚|| _        t          | j        | j        d¦  «        | _        d| _        dS )zýCreate a BTree.

        If *original* is not ``None``, then the BTree is shallow-cloned from
        *original* using copy-on-write.  Otherwise a new BTree with the specified
        *t* value is created.

        The BTree is not thread-safe.
        FNzoriginal BTree is not immutabler6   zt must be >= 3Tr   )
r(   r1   Ú
_immutableÚsetÚcursorsrx   r   r«   Úsizer/   )r   r   rÇ   s      r   r7   zBTree.__init__h  s²   € õ  ‘z”zˆŒØˆŒØˆØÐØˆÝ$'¡E¤EˆŒØÐØÔ&ð DÝ Ð!BÑCÔCÐCØ”ZˆDŒFØ œˆDŒIØ œˆDŒIˆIˆIà�1ŠuˆuÝ Ð!1Ñ2Ô2Ð2ØˆDŒFÝ˜dœf d¤l°DÑ9Ô9ˆDŒIØˆDŒIˆIˆIr   c                 ó&   — | j         s	d| _         dS dS )z®Make the BTree immutable.

        Attempts to alter the BTree after making it immutable will raise an
        Immutable exception.  This operation cannot be undone.
        TN)rÉ   r   s    r   Úmake_immutablezBTree.make_immutable†  s#   € ð Œð 	#Ø"ˆDŒOˆOˆOð	#ð 	#r   r   c                 ó^   — | j         rt          ‚| j        D ]}|                     ¦   «          Œd S rH   )rÉ   rÃ   rË   r¤   ©r   Úcursors     r   Ú_check_mutable_and_parkzBTree._check_mutable_and_park�  s;   € ØŒ?ð 	ÝˆOØ”lð 	ð 	ˆFØ�KŠK‰MŒMˆMˆMð	ð 	r   Frg   rW   c                 óš  — |                       ¦   «          | j                             | j        ¦  «        }|r|| _        | j                             ¦   «         rH| j        }t          | j        | j        d¦  «        | _         | j        j        |                     ¦   «         Ž  | j         	                    ||¦  «        }|€| xj
        dz  c_
        |S )aE  Insert the element into the BTree.

        If *in_order* is ``True``, then extra work will be done to make left siblings
        full, which optimizes storage space when the the elements are inserted in-order
        or close to it.

        Returns the previously existing element at the element's key or ``None``.
        FNr!   )rÒ   r«   rI   r1   r:   r/   r   rZ   r[   r\   rÌ   )r   rg   rW   rK   Úold_rootr^   s         r   Úinsert_elementzBTree.insert_element™  s»   € ð 	×$Ò$Ñ&Ô&Ð&Ø”×$Ò$ T¤\Ñ2Ô2ˆØð 	ØˆDŒIØŒ9×ÒÑ!Ô!ð 	/Ø”yˆHÝ˜dœf d¤l°EÑ:Ô:ˆDŒIØˆDŒIŒO˜XŸ^š^Ñ-Ô-Ð.Ð.ØŒy×'Ò'¨¨XÑ6Ô6ˆØˆ<àˆIŒI˜‰NˆIŒIØˆr   r   c                 ó6   — | j                              |¦  «        S )zhGet the element matching *key* from the BTree, or return ``None`` if it
        does not exist.
        )r«   rQ   ©r   r   s     r   Úget_elementzBTree.get_element°  s   € ð Œy�}Š}˜SÑ!Ô!Ð!r   rv   c                 ó˜  — |                       ¦   «          | j                             | j        ¦  «        }|r|| _        | j                             |d |¦  «        }|�o| xj        dz  c_        t          | j        j        ¦  «        dk    rB| j        j        s6t          | j        j	        ¦  «        dk    sJ ‚| j        j	        d         | _        |S )Nr!   r   )
rÒ   r«   rI   r1   ry   rÌ   r9   r3   r2   r4   )r   r   rv   rK   rg   s        r   Ú_deletezBTree._delete¶  sÁ   € Ø×$Ò$Ñ&Ô&Ð&Ø”×$Ò$ T¤\Ñ2Ô2ˆØð 	ØˆDŒIØŒi×Ò˜s D¨%Ñ0Ô0ˆØˆ?àˆIŒI˜‰NˆIŒIÝ�4”9”>Ñ"Ô" aÒ'Ð'ð ”yÔ(ð 6Ý˜tœyÔ1Ñ2Ô2°aÒ7Ð7Ð7Ð7Ø $¤	Ô 2°1Ô 5�D”IØˆ
r   c                 ó.   — |                       |d¦  «        S )z‚Delete the element matching *key* from the BTree.

        Returns the matching element or ``None`` if it does not exist.
        N)rÚ   r×   s     r   Ú
delete_keyzBTree.delete_keyÇ  s   € ð
 �|Š|˜C Ñ&Ô&Ð&r   rV   c                 ób   — |                       |                     ¦   «         |¦  «        }||u sJ ‚|S )zwDelete *element* from the BTree.

        Returns the matching element or ``None`` if it was not in the BTree.
        )rÚ   r   )r   rV   Údelts      r   Údelete_exactzBTree.delete_exactÎ  s1   € ð
 �|Š|˜GŸKšK™MœM¨7Ñ3Ô3ˆØ�wˆˆˆˆØˆr   c                 ó   — | j         S rH   )rÌ   r   s    r   Ú__len__zBTree.__len__×  ó
   € ØŒyÐr   r}   c                 ó:   — | j                              |¦  «         dS )zBCall *visit*(element) on all elements in the tree in sorted order.N)r«   r€   ©r   r}   s     r   r€   zBTree.visit_in_orderÚ  s   € àŒ	× Ò  Ñ'Ô'Ð'Ð'Ð'r   c                 ó:   — | j                              |¦  «         d S rH   )r«   r‚   rä   s     r   r‚   zBTree._visit_preorder_by_nodeÞ  s   € ØŒ	×)Ò)¨%Ñ0Ô0Ð0Ð0Ð0r   c                 ó    — t          | ¦  «        S )zCreate a cursor.)r“   r   s    r   rÑ   zBTree.cursorá  s   € å�d‰|Œ|Ðr   rÑ   c                 ó:   — | j                              |¦  «         dS )z4Register a cursor for the automatic parking service.N)rË   ÚaddrÐ   s     r   r¹   zBTree.register_cursorå  s   € àŒ×Ò˜Ñ Ô Ð Ð Ð r   c                 ó:   — | j                              |¦  «         dS )z7Deregister a cursor from the automatic parking service.N)rË   ÚdiscardrÐ   s     r   r¼   zBTree.deregister_cursoré  s   € àŒ×Ò˜VÑ$Ô$Ð$Ð$Ð$r   c                 ó.   — |                       | ¬¦  «        S )N)rÇ   ©r`   r   s    r   Ú__copy__zBTree.__copy__í  s   € Ø�~Š~ tˆ~Ñ,Ô,Ð,r   c              #   óÄ   K  — |                       ¦   «         5 }	 |                     ¦   «         }|€n|                     ¦   «         V — Œ.	 d d d ¦  «         d S # 1 swxY w Y   d S rH   )rÑ   r¯   r   )r   rÑ   rg   s      r   Ú__iter__zBTree.__iter__ð  sª   è è € Ø�[Š[‰]Œ]ð 	 ˜fð Ø—k’k‘m”m�Ø�;ØØ—g’g‘i”i���ð	 ð ð		 ð 	 ð 	 ñ 	 ô 	 ð 	 ð 	 ð 	 ð 	 ð 	 ð 	 ð 	 øøøð 	 ð 	 ð 	 ð 	 ð 	 ð 	 s   —0AÁAÁArÁ   )F)r   r   r   r   Ú	DEFAULT_Tr�   r   r7   rÎ   rÒ   r   r�   rÕ   r   rØ   rÚ   rÜ   rß   rá   r   r€   r/   r‚   r“   rÑ   r¹   r¼   rí   rï   r   r   r   rÅ   rÅ   e  s6  € € € € € Ø<Ð<à#,ÈDð ð ð ˜Sð ¸ÀÔ8Ið ð ð ð ð<#ð #ð #ðð ð ð ðð  "ð °ð ÀÀdÁð ð ð ð ð."˜rð " b¨4¡ið "ð "ð "ð "ð˜2ð  b¨4¡ið °B¸±Ið ð ð ð ð"'˜bð ' R¨$¡Yð 'ð 'ð 'ð 'ð Bð ¨2°©9ð ð ð ð ðð ð ð( H¨b¨T°4¨ZÔ$8ð (¸Tð (ð (ð (ð (ð1¨X°u°g¸t°mÔ-Dð 1Èð 1ð 1ð 1ð 1ð˜˜r 2˜vœð ð ð ð ð! fð !°ð !ð !ð !ð !ð%¨ð %°4ð %ð %ð %ð %ð-ð -ð -ð ð  ð  ð  ð  r   rÅ   ÚVTc                   óF   — e Zd ZdZdedefd„Zdefd„Zdefd„Zd„ Z	d	„ Z
d
S )ÚKVz/The BTree element type used in a ``BTreeDict``.r   Úvaluec                 ó"   — || _         || _        d S rH   ©Ú_keyÚ_value)r   r   rô   s      r   r7   zKV.__init__ÿ  s   € ØˆŒ	ØˆŒˆˆr   r   c                 ó   — | j         S rH   ©r÷   r   s    r   r   zKV.key  râ   r   c                 ó   — | j         S rH   )rø   r   s    r   rô   zKV.value  s
   € ØŒ{Ðr   c                 ó(   — d| j         › d| j        › d�S ©NzKV(z, ú)rö   r   s    r   r-   z
KV.__str__	  ó   € Ø0�T”YÐ0Ð0 $¤+Ð0Ð0Ð0Ð0r   c                 ó(   — d| j         › d| j        › d�S rý   rö   r   s    r   Ú__repr__zKV.__repr__  rÿ   r   N)r   r   r   r   r   rñ   r7   r   rô   r-   r  r   r   r   ró   ró   ü  s�   € € € € € Ø9Ð9ð˜Bð  rð ð ð ð ð�Rð ð ð ð ð�rð ð ð ð ð1ð 1ð 1ð1ð 1ð 1ð 1ð 1r   ró   c                   ót   ‡ — e Zd ZdZedddœdededz  defˆ fd„Zd	e	d
e
fd„Zd	e	de
d
dfd„Zd	e	d
dfd„Zˆ xZS )Ú	BTreeDictzA MutableMapping implemented with a BTree.

    Unlike a normal Python dict, the BTreeDict may be mutated while iterating.
    NF©r   rÇ   rW   r   rÇ   rW   c                ó\   •— t          ¦   «                              ||¬¦  «         || _        d S ©NrÆ   ©Úsuperr7   rW   ©r   r   rÇ   rW   r`   s       €r   r7   zBTreeDict.__init__  ó-   ø€ õ 	‰Œ×Ò˜1 xÐÑ0Ô0Ð0Ø ˆŒˆˆr   r   r   c                 óŒ   — |                       |¦  «        }|€t          ‚t          t          |¦  «                             ¦   «         S rH   )rØ   ÚKeyErrorr   ró   rô   )r   r   rg   s      r   Ú__getitem__zBTreeDict.__getitem__   s9   € Ø×Ò˜sÑ#Ô#ˆØˆ;ÝˆNå�˜C‘=”=×&Ò&Ñ(Ô(Ð(r   rô   c                 ó\   — t          ||¦  «        }|                      || j        ¦  «         d S rH   )ró   rÕ   rW   )r   r   rô   rg   s       r   Ú__setitem__zBTreeDict.__setitem__'  s-   € Ý��e‰nŒnˆØ×Ò˜C ¤Ñ/Ô/Ð/Ð/Ð/r   c                 ó>   — |                       |¦  «        €t          ‚d S rH   )rÜ   r  r×   s     r   Ú__delitem__zBTreeDict.__delitem__+  s!   € Ø�?Š?˜3ÑÔÐ'ÝˆNð (Ð'r   )r   r   r   r   rð   r�   rÅ   r�   r7   r   rñ   r  r  r  Ú__classcell__rì   s   @r   r  r    së   ø€ € € € € ðð ð Ø!%Øð!ð !ð !ð ð!ð ˜$‘,ð	!ð
 ð!ð !ð !ð !ð !ð !ð)˜rð ) bð )ð )ð )ð )ð0˜rð 0¨"ð 0°ð 0ð 0ð 0ð 0ð˜rð  dð ð ð ð ð ð ð ð r   r  c                   ó*   — e Zd ZdZdefd„Zdefd„ZdS )ÚMemberz.The BTree element type used in a ``BTreeSet``.r   c                 ó   — || _         d S rH   rú   r×   s     r   r7   zMember.__init__3  s   € ØˆŒ	ˆ	ˆ	r   r   c                 ó   — | j         S rH   rú   r   s    r   r   z
Member.key6  râ   r   N)r   r   r   r   r   r7   r   r   r   r   r  r  0  sP   € € € € € Ø8Ð8ð˜Bð ð ð ð ð�Rð ð ð ð ð ð r   r  c                   óp   ‡ — e Zd ZdZedddœdededz  defˆ fd„Zd	e	d
efd„Z
ded
dfd„Zded
dfd„Zˆ xZS )ÚBTreeSetzyA MutableSet implemented with a BTree.

    Unlike a normal Python set, the BTreeSet may be mutated while iterating.
    NFr  r   rÇ   rW   c                ó\   •— t          ¦   «                              ||¬¦  «         || _        d S r  r  r	  s       €r   r7   zBTreeSet.__init__@  r
  r   r   r   c                 ó0   — |                       |¦  «        d uS rH   )rØ   r×   s     r   Ú__contains__zBTreeSet.__contains__J  s   € Ø×Ò Ñ$Ô$¨DÐ0Ð0r   rô   c                 óZ   — t          |¦  «        }|                      || j        ¦  «         d S rH   )r  rÕ   rW   )r   rô   rg   s      r   rè   zBTreeSet.addM  s+   € Ý�U‰mŒmˆØ×Ò˜C ¤Ñ/Ô/Ð/Ð/Ð/r   c                 ó0   — |                       |¦  «         d S rH   )rÜ   )r   rô   s     r   rê   zBTreeSet.discardQ  s   € Ø�Š˜ÑÔÐÐÐr   )r   r   r   r   rð   r�   rÅ   r�   r7   r   r  r   rè   rê   r  rì   s   @r   r  r  :  sä   ø€ € € € € ðð ð Ø!%Øð!ð !ð !ð ð!ð ˜$‘,ð	!ð
 ð!ð !ð !ð !ð !ð !ð1 ð 1¨ð 1ð 1ð 1ð 1ð0˜ð 0 ð 0ð 0ð 0ð 0ð˜Rð  Dð ð ð ð ð ð ð ð r   r  N)r   Úcollections.abcr   r   Útypingr   r   r   r   r	   r
   r   rð   r   r   r   r�   r#   r&   r(   r/   r“   Ú	ExceptionrÃ   rÅ   rñ   ró   r  r  r  r   r   r   ú<module>r!     s  ððð ð 7Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ Ià€	à€WˆT�]„]€ð"ð "ð "ð "ð "ˆg�bŒkñ "ô "ð "ð €WˆT˜Ð!Ñ!Ô!€ðˆCð �Cð ð ð ð ðˆCð �Cð ð ð ð ð
	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ðFDð FDð FDð FDð FDˆG�B˜�FŒOñ FDô FDð FDðR
að að að að aˆW�R˜�VŒ_ñ aô að aðH"ð "ð "ð "ð "�	ñ "ô "ð "ðQ ð Q ð Q ð Q ð Q ˆG�B˜�FŒOñ Q ô Q ð Q ðh €WˆT�]„]€ð1ð 1ð 1ð 1ð 1ˆ�'˜"˜b˜&”/ñ 1ô 1ð 1ð(ð ð ð ð �˜˜B˜”  r¨2¨b°"¨f¬: ~Ô!6¸ÀrÈ2ÀvÔ8Nñ ô ð ð@ð ð ð ð ˆW�g˜b”kñ ô ð ðð ð ð ð ˆu�g˜b”k :¨b¤>ñ ô ð ð ð r   