403Webshell
Server IP : 50.21.180.56  /  Your IP : 216.73.216.224
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : ws67922704 ( 67922704)
PHP Version : 8.5.13
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/lib/python3/dist-packages/breezy/bzr/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/lib/python3/dist-packages/breezy/bzr/__pycache__/chk_map.cpython-313.pyc
�

p��gA���SrSSKrSSKrSSKJrJrJr SSKJrJrJ	r	 SSK
JrJrJ
r
JrJr Sr\\S4r\r\\/\4r\\r\R0"5rS\lS	rS
rSrSrS
\S\4Sjr\R@\\\/\44"5r!\!RES\5 "SS5r#"SS5r$\%"5r&"SS\$5r'"SS\$5r(Sr)"SS5r*S"Sjr+SSK,J-r-J.r.J/r/J0r0J1r1 \!RES\05 \!RES \15 S!r6g!\2a*r3\
Rh"\35 SSK5J-r-J.r.J/r/J0r0J1r1 Sr3C3NSSr3C3ff=f)#a�Persistent maps from tuple_of_strings->string using CHK stores.

Overview and current status:

The CHKMap class implements a dict from tuple_of_strings->string by using a trie
with internal nodes of 8-bit fan out; The key tuples are mapped to strings by
joining them by \x00, and \x00 padding shorter keys out to the length of the
longest key. Leaf nodes are packed as densely as possible, and internal nodes
are all an additional 8-bits wide leading to a sparse upper tree.

Updates to a CHKMap are done preferentially via the apply_delta method, to
allow optimisation of the update operation; but individual map/unmap calls are
possible and supported. Individual changes via map/unmap are buffered in memory
until the _save method is called to force serialisation of the tree.
apply_delta records its changes immediately by performing an implicit _save.

Todo:
-----
Densely packed upper nodes.

�N)�Callable�	Generator�Iterator)r�Optional�Union�)�errors�	lru_cache�osutils�registry�tracei@.c�x�[[SS5nUc%[R"[5nU[lU$)z�Get the per-thread page cache.

We need a function to do this because in a new thread the _thread_caches
threading.local object does not have the cache initialized yet.
�
page_cacheN)�getattr�_thread_cachesr
�LRUSizeCache�_PAGE_CACHE_SIZEr)rs �4/usr/lib/python3/dist-packages/breezy/bzr/chk_map.py�
_get_cacherAs7�����t�<�J����+�+�,<�=�
�$.��!���c�4�[5R5 g�N)r�clear�rr�clear_cacherOs���L���r�2��key�returnc�$�SRU5$)zDMap the key tuple into a search string that just uses the key bytes.���join�rs r�_search_key_plainr%Ys���<�<���rsplainc	���\rSrSr%SrSrS\S'S$S\\S\\	4S	jjr
S
rS%SjrS
\
\S4SS4SjrS\S\4SjrS&S\S\S\4SjjrS'S
SS\S\\4Sjjr\S(S\S\S\\	4Sjj5r\S(S\S\S\\	4Sjj5r\S(S\S\S\\	4Sjj5rSrS$S\\S\\\\44SjjrS\4Sjr S\4Sjr!S\SS4Sjr"S r#S'S\SS4S!jjr$S%S"jr%S#r&Sr'g))�CHKMap�bz=A persistent map from string to string backed by a CHK store.)�
_root_node�_search_key_func�_store�Noder)N�root_key�search_key_funcc�~�XlUc[nX0lUc[US9UlgURU5Ulg)a7Create a CHKMap object.

:param store: The store the CHKMap is stored in.
:param root_key: The root key of the map. None to create an empty
    CHKMap.
:param search_key_func: A function mapping a key => bytes. These bytes
    are then used by the internal nodes to split up leaf nodes into
    multiple pages.
N�r.)r+r%r*�LeafNoder)�	_node_key)�self�storer-r.s    r�__init__�CHKMap.__init__hs<�����"�/�O� /����&��G�D�O�"�n�n�X�6�D�Orc���SnUVVVs1sHup4oTcM
UbM[U5iM nnnn[URUS95nU(a&[R"USRU55eUH$up8n	UcMX8:wdMUR
USS9 SnM& UHup�nUcMURX�5 M U(aUR5 UR5$s snnnf)z�Apply a delta to the map.

:param delta: An iterable of old_key, new_key, new_value tuples.
    If new_key is not None, then new_key->new_value is inserted
    into the map; if old_key is not None, then the old mapping
    of old_key is removed.
F��
key_filterz&New items are already in the map {!r}.��check_remapT)
�tuple�list�	iteritemsr	�InconsistentDeltaDelta�format�unmap�map�_check_remap�_save)r3�delta�has_deletes�oldr�value�	new_items�existing_new�new�_value�_olds           r�apply_delta�CHKMap.apply_delta�s�����16�
�05�,�C�e�J�S�J�E�#�J��	�
��D�N�N�i�N�@�A����/�/��?�F�F�|�T��
�!&��C�f���3�:��
�
�3�E�
�2�"��!&�!&��D�u�������$�!&�������z�z�|���%
s�	C&�C&�C&rc��[UR[5(a!URUR5Ulgg)z1Ensure that the root node is an object not a key.N)�
isinstancer)r<�	_get_node�r3s r�_ensure_root�CHKMap._ensure_root�s,���d�o�o�u�-�-�"�n�n�T�_�_�=�D�O�.r�nodec�z�[U[5(a%URU5n[X!URS9$U$)z�Get a node.

Note that this does not update the _items dict in objects containing a
reference to this node. As such it does not prevent subsequent IO being
performed.

:param node: A tuple key or node object.
:return: A node object.
r0)rQr<�_read_bytes�_deserialiser*)r3rV�bytess   rrR�CHKMap._get_node�s9���d�E�"�"��$�$�T�*�E���T�=R�=R�S�S��Krrc���[5U$![aJ URRU/SS5n[	U5RS5nU[5U'Us$f=f)N�	unorderedT�fulltext)r�KeyErrorr+�get_record_stream�next�get_bytes_as)r3r�streamrZs    rrX�CHKMap._read_bytes�sb��	��<��$�$���	��[�[�2�2�C�5�+�t�L�F���L�-�-�j�9�E� %�J�L����L�		�s��AA#�"A#�include_keys�encodingc�^�UR5 U4SjnURURSSUUS9nURS5 SR	U5$)z+Return the tree in a string representation.c�&>�URT5$r)�decode)�xrfs �rri�!CHKMap._dump_tree.<locals>.decode�s����8�8�H�%�%rr�)�prefix�indentrire�
)rT�_dump_tree_noder)�appendr#)r3rerfri�ress  `  r�
_dump_tree�CHKMap._dump_tree�sY�������	&��"�"��O�O����%�#�
��	�
�
�2���y�y��~�rc
��/nU(dSnO0UR5nUbSRU"US55nOSnURSRX4"U5URRU55 [U[5(aw[URUR55 [URR55H*up)URURU	UUS-UUS95 M, U$[URR55HKup�URSR[U
Vs/sH
o�"U5PM sn5U"U555 MM U$s snf)	zAFor this node and all children, generate a string representation.rlz {}rz Nonez{}{!r} {}{}z  )rirez      {!r} {!r})rr@rq�	__class__�__name__rQ�InternalNoder=�_iter_nodesr+�sorted�_items�items�extendrpr<)
r3rVrmrnrire�result�key_str�node_key�subrrH�kes
             rrp�CHKMap._dump_tree_node�sU������G��x�x�z�H��#��,�,�v�h�q�k�':�;��!���
�
�� � ���v�����(?�(?��
�	
�
�d�L�)�)���!�!�$�+�+�.�/�%�d�k�k�&7�&7�&9�:����
�
��(�(�����
�%�%1�)��� ;�&�
�%�T�[�[�%6�%6�%8�9�
���
�
�%�,�,��C�8�C�b�v�b�z�C�8�9�6�%�=���:��
��9s�E9�maximum_size�	key_widthc��URUUUUUS9n[U[5(d#[SR	[U555eU$)a�Create a CHKMap in store with initial_value as the content.

:param store: The store to record initial_value in, a VersionedFiles
    object with 1-tuple keys supporting CHK key generation.
:param initial_value: A dict to store in store. Its keys and values
    must be bytestrings.
:param maximum_size: The maximum_size rule to apply to nodes. This
    determines the size at which no new data is added to a single node.
:param key_width: The number of elements in each key_tuple being stored
    in this map.
:param search_key_func: A function mapping a key => bytes. These bytes
    are then used by the internal nodes to split up leaf nodes into
    multiple pages.
:return: The root chk of the resulting CHKMap.
)r�r�r.zwe got a {} instead of a tuple)�_create_directlyrQr<�AssertionErrorr@�type)�clsr4�
initial_valuer�r�r.r-s       r�	from_dict�CHKMap.from_dict�s]��0�'�'���%��+�(�
���(�E�*�*� �0�7�7��X��G��
��rc���U"USUS9nURRU5 XFRl/nUR5Hup�UR	SX�45 M URU5n
U
$)Nr0)r)�set_maximum_size�
_key_widthr|rqrN)r�r4r�r�r�r.r~rErrHr-s           r�_create_via_map�CHKMap._create_via_mapsr���U�D�/�B�����*�*�<�8�'0���$���'�-�-�/�J�C��L�L�$��+�,�0��%�%�e�,���rc�^
�[US9m
T
RU5 UT
lUR5VVs0sHupg[	U5U_M snnT
l[
U
4SjT
R
R555T
l[T
R
5T
l	T
R5 T
R5 T
RS:�a�U(a~T
R5U:�ajT
RU5up�[U	5S:Xa[S5e[X�S9m
T
RU5 UT
lU	Hup�T
R!X�5 M [#T
R%U55nUS$s snnf)Nr0c3�J># �UHupTRX5v� M g7fr)�_key_value_len)�.0rrHrVs   �r�	<genexpr>�*CHKMap._create_directly.<locals>.<genexpr>=s%����
�>Q�
��D����+�+�>Q�s� #�z!Failed to split using node._split���)r1r�r�r|r<r{�sum�	_raw_size�len�_len�_compute_search_prefix�_compute_serialised_prefix�
_current_size�_splitr�rx�add_noder=�	serialise)r�r4r�r�r�r.r�valrm�node_details�split�subnode�keysrVs             @rr��CHKMap._create_directly/s?�����8�����l�+�#���7D�7J�7J�7L�M�7L�8�3�u�S�z�3��7L�M����
�>B�k�k�>O�>O�>Q�
�
�������$��	��#�#�%��'�'�)��9�9�q�=�\�d�.@�.@�.B�\�.Q�#'�;�;�u�#5� �F��<� �A�%�$�%H�I�I���H�D��!�!�,�/�'�D�O�".����
�
�e�-�#/��D�N�N�5�)�*���B�x���#Ns�E7c#�P^^^^^^^^# �TRTR5TRTR5:XagTR5 TR5 [5mTRnTRn/m/mSmUU4SjmUUUU4SjmUUUUUUU4SjnU"USUS5 [5mU4SjnSnT(dT(GaPUS-
nT(dbTH[upxp�U"U
5(aMTR	U	5n	UbX�S4v� M1U	RTR5Hup�X�S4v� M
 M] gT(ddTH]upxp�U"U
5(aMTR	U	5n	Ub	USU	4v� M2U	RTR5Hup�USU4v� M M_ gTSSTSS:aB[R"T5up�p�U"U
5(aGM#Ub	USU	4v� GOT"X�TT5 GM<TSSTSS:�aA[R"T5up�p�U"U
5(aGMwUbX�S4v� GO�T"X�TT5 GM�TSScS	n
OS
n
TSScS	nOS
nU
(dRU(dK[R"T5n[R"T5nUSUS:waUSUSUS4v� GMTRTSS5TRTSS5:Xa/[R"T5 [R"T5 GMcU
(alU(ae[R"T5unnnn[R"T5unnnnUU:wa[SRUU55eU"UUUU5 GM�U
(a3[R"T5up�p�U"U
5(aGMT"X�TT5 U(a3[R"T5up�p�U"U
5(aGM@T"X�TT5 T(aGMET(aGMOgg7f)
z�Iterate over the changes between basis and self.

:return: An iterator of tuples: (key, old_value, new_value). Old_value
    is None for keys only in self; new_value is None for keys only in
    basis.
Nc��URU5n[U[5(a\URU4nURR5H/upEUR
U5n[R"X6XEU45 M1 gURU4nURR5Hupx[R"X7SX�45 M  gr)	rRrQr1�_keyr{r|r*�heapq�heappush)	rV�path�a_map�pendingrrH�
search_keyrm�childs	         r�process_node�)CHKMap.iter_changes.<locals>.process_nodexs����?�?�4�(�D��$��)�)��	�	�4�(��"&�+�+�"3�"3�"5�J�C�"&�!6�!6�s�!;�J��N�N�7��T�,J�K�	#6��	�	�4�(��%)�[�[�%6�%6�%8�M�F��N�N�7�T�5�,G�H�&9rc�f>�[URR55n[URR55nURS4nX#-
HupV[R
"TUSXd45 M! URS4nX2-
HupV[R
"TUSXd45 M! gr)�setr{r|r�r�r�)	�	self_node�
basis_node�
self_items�basis_itemsr�rmr��
basis_pending�self_pendings	       ��r�process_common_internal_nodes�:CHKMap.iter_changes.<locals>.process_common_internal_nodes�s�����Y�-�-�3�3�5�6�J��j�/�/�5�5�7�8�K��N�N�D�)�D�!+�!9�
�����|�f�d�E�-H�I�":��O�O�T�*�D�!,�!9�
�����}�v�t�U�.I�J�":rc�>�[URR55n[URR55nURS4nX#-
H/upVT
R	U5n[
R"TXuXd45 M1 URS4nX2-
H/upVTR	U5n[
R"T	XuXd45 M1 gr)r�r{r|r�r*r�r�)r�r�r�r�r�rrHrm�basisr�r3r�s        ����r�process_common_leaf_nodes�6CHKMap.iter_changes.<locals>.process_common_leaf_nodes�s�����Y�-�-�3�3�5�6�J��j�/�/�5�5�7�8�K��N�N�D�)�D�(�6�
���.�.�s�3�����|�f�5�-G�H�7��O�O�T�*�D�)�6�
���/�/��4�����}�v�E�.H�I�7rc�>>�T	RU5nTRU5n[U[5(a[U[5(a	T"X5 g[U[5(a[U[5(a	T"X5 gT"XT	T
5 T"X#TT5 gr)rRrQrxr1)r��	self_pathr��
basis_pathr�r�r�r�r�r3r�s    �������r�process_common_prefix_nodes�8CHKMap.iter_changes.<locals>.process_common_prefix_nodes�s�������y�1�I�����4�J��)�\�2�2�z��L�8�8�.�i�D��I�x�0�0�Z�
�H�5U�5U�)�)�@��Y�4��F��Z�U�M�Jrc�,>�UbUupUT;agUbMg)NTFr)�key_pathr�
excluded_keyss  �r�check_excluded�+CHKMap.iter_changes.<locals>.check_excluded�s*����&� (�
���-�'���&�rrr�TFrz{!r} != {!r})r2r)rTr�rRr>r+r��heappopr�r@)r3r�r�r�r�r��loop_counter�_prefixrrVr�rHrm�	read_self�
read_basis�self_details�
basis_details�self_prefix�_r��basis_prefixr�r�r�r�r�r�r�s``                    @@@@@@r�iter_changes�CHKMap.iter_changesOs����:�>�>�$�/�/�*�d�n�n�U�=M�=M�.N�N������
������
��O�O�	��%�%�
����
�	I� 	K�
	J�
	J�	K�	K� 	$�I�t�Z��F���
�	����m��A��L��0=�,�G�$�%�d�+�+� � �?�?�4�0�D���"�$�/�/�+/�.�.����*F�J�C�#&�t�"4�4�+G�1>��"�0<�,�G�$�%�d�+�+� ��>�>�$�/�D���"�D�$�/�/�+/�.�.����*E�J�C�#&��e�"4�4�+F�1=��
 ��?�1�%�
�a�(8��(;�;�.3�m�m�L�.I�+�F��%�d�+�+� ���"�D�$�/�/�$�T��|�D� �!�!�_�Q�'�-��*:�1�*=�=�.3�m�m�M�.J�+�F��%�d�+�+� ���"�$�/�/�$�T��
�F� �$�A��q�)�1�$(�	�$)�	�$�Q�'��*�2�%)�
�%*�
�$�Z�',�}�}�\�'B��(-�
�
�m�(D�
�'��?�m�A�.>�>�#/��?�M�!�4D�l�ST�o�"V�V� ��~�~�l�1�o�a�&8�9�T�^�^�%�a�(��+�>��
�
�
�l�3��
�
�m�4� � �Z�@E�}�}�(�@�<��Q�	�9�CH�-�-�)�C�?��a��Z�'�,�6�"0� .� 5� 5�k�<� P�#��4�%�y�*�j��!� �27�-�-��2M�/��T�)�$�/�/�$�$�T��|�D�!�27�-�-�
�2N�/��T�)�$�/�/�$�$�T��
�F�_�l�m�m�s�P
P&�P&�$P&r9c��UR5 UbUVs/sHn[U5PM nnURRURUS9$s snf)z*Iterate over the entire CHKMap's contents.r8)rTr<r)r>r+)r3r9rs   rr>�CHKMap.iteritems2sQ��	
�����!�0:�;�
��%��*�
�J�;����(�(�����(�L�L��<s�Ac�L�[UR[5(aUR$[UR[5(a.URc[	S5eURR
$[	SR
[UR555e)zReturn the key for this map.zNo root nodezInvalid root node type: {!r})rQr)r<r,r�r�r@r�rSs rr�
CHKMap.key;sw���d�o�o�u�-�-��?�?�"�
�����
.�
.����&�$�^�4�4��?�?�'�'�'� �.�5�5�d�4�?�?�6K�L��
rc�L�UR5 [UR5$r)rTr�r)rSs r�__len__�CHKMap.__len__Hs�������4�?�?�#�#rc���[U5nUR5 URRURX5up4[U5S:XaUSSUlg[
X0RS9UlURRUSSR5 USSRURl
UH upVURRXV5 M" g)z_Map a key tuple to value.

:param key: A key to map.
:param value: The value to assign to key.
r�rr0N)r<rTr)rBr+r�rxr*r�r�r�r�)r3rrHrmr�r�rVs       rrB�
CHKMap.mapLs����C�j������#���2�2�4�;�;��K����|���!�*�1�o�a�0�D�O�*��(=�(=��D�O�
�O�O�,�,�\�!�_�Q�-?�-L�-L�M�)5�a���);�)F�)F�D�O�O�&�+������(�(��5� ,rc��[U[5(aU$[U[5(aUR$[	SR[
U555e)z4Get the key for a node whether it's a tuple or node.�Invalid node type: {!r})rQr<r,r�r�r@r�)r3rVs  rr2�CHKMap._node_keyasF���d�E�"�"��K�
��d�
#�
#��9�9�� �!:�!A�!A�$�t�*�!M�N�Nrc��[U5nUR5 [UR[5(a%URRURXS9nO&URRURU5nX0lg)zRemove key from the map.r:N)r<rTrQr)rxrAr+)r3rr;�unmappeds    rrA�CHKMap.unmapjsd���C�j�������d�o�o�|�4�4����,�,�T�[�[�#�,�W�H����,�,�T�[�[�#�>�H�"�rc��UR5 [UR[5(a+URR	UR
5Ulgg)z Check if nodes can be collapsed.N)rTrQr)rxrCr+rSs rrC�CHKMap._check_remapts>�������d�o�o�|�4�4�"�o�o�:�:�4�;�;�G�D�O�5rc��[UR[5(aUR$[URR	UR
55nUS$)z=Save the map completely.

:return: The key of the root node.
r�)rQr)r<r=r�r+)r3r�s  rrD�CHKMap._savezsE��
�d�o�o�u�-�-��?�?�"��D�O�O�-�-�d�k�k�:�;���B�x�rr)rN)Fzutf-8�T)rr�N)(rw�
__module__�__qualname__�__firstlineno__�__doc__�	__slots__�__annotations__r�Key�
SearchKeyFuncr5rNrTrrRrZrX�bool�strrsr=rp�classmethod�intr�r�r�r��	KeyFilterrr<r>rr�rBr2rArCrD�__static_attributes__rrrr'r'bs��G�<�I���48�	7��3�-�7�"�-�0�	7�0�<>��e�C��K�0��V�� �s��u���t��s��QT��$JN�(��(�BF�(�	
�c��(�T�
��37�
"��	"�
�"�"�-�0�
"��"�H�
��37�
��	�
��"�-�0�
���"�
��37�
��	�
��"�-�0�
���>`G�H15�M�"�9�-�M�	�%��U�
�#�	$�M��S��$��$�6�s�6�d�6�*O�#��#�4�#�H�	rr'c	��\rSrSrSrSrSSjrSrS\4Sjr	S\
4Sjr\S\
4S	j5r
S
r\S5r\S5rS\\4S
jrSS\\S\\\\44SjjrS\SSSS4SjrS\S\\\\\S444SjrS\SS4SjrSrg)r,i�z�Base class defining the protocol for CHK Map nodes.

:ivar _raw_size: The total size of the serialized key:value data, before
    adding the header bytes, and without prefix compression.
)r{r�r�r��
_maximum_sizer�r*�_search_prefixc�d�SUlSUlSUlXlSUl0UlSUlg)zCCreate a node.

:param key_width: The width of keys for this node.
Nr)r�r�r�r�r�r{r�)r3r�s  rr5�
Node.__init__�s5��
��	���	����#��������"��rc	�&�[[UR55n[U5S:�aUSSS-nSR	UR
RURURURURURU5$)Nr��...]z3{}(key:{} len:{} size:{} max:{} prefix:{} items:{}))r�rzr{r�r@rvrwr�r�r�r�r��r3�	items_strs  r�__repr__�
Node.__repr__�s{����t�{�{�+�,�	��y�>�B��!�#�2���/�I�D�K�K��N�N�#�#��I�I��I�I��N�N��������
�	
rrc��UR$)zReturn the key for this node.)r�rSs rr�Node.key�����y�y�rc��UR$)z(Return the number of items in this node.)r�rSs rr��Node.__len__�rrc��UR$)z8What is the upper limit for adding references to a node.�r�rSs rr��Node.maximum_size�s���!�!�!rc��Xlg)zwSet the size threshold for nodes.

:param new_size: The size at which no data is added to a node. 0 for
    unlimited.
Nr)r3�new_sizes  rr��Node.set_maximum_size�s
��&�rc��URU5(aU$Sn[[X55HunupEXE:wdMUS-n O USUS-nU$)z�Given 2 strings, return the longest prefix common to both.

:param prefix: This has been the common prefix for other keys, so it is
    more likely to be the common prefix in this case as well.
:param key: Another string to compare to
r�r�N)�
startswith�	enumerate�zip)r�rmr�pos�left�right�commons       r�
common_prefix�Node.common_prefix�s`���>�>�&�!�!��M���"+�C��,<�"=��C��$��}��q����#>��	�#��'�"���
rc�^�SnUH$nUcUnM
URX#5nU(aM$ g U$)z�Given a list of keys, find their common prefix.

:param keys: An iterable of strings.
:return: The longest common prefix of all keys.
Nr)r)r�r�rrs    r�common_prefix_for_keys�Node.common_prefix_for_keys�sC���
��C��$� #�
���-�-�m�A�M� �=����rc��[S5e)z�Serialise the node into the store.

:param store: The store to serialise into.
:return: An iterable of keys that were written to the store.
z+serialise must be implemented in subclasses��NotImplementedError)r3r4s  rr��Node.serialise�s��"�"O�P�PrNr9c��[S5e)��Iterate over items in the node.

:param key_filter: A filter to apply to the node. It should be a
    list/set/dict or similar repeatedly iterable container.
z+iteritems must be implemented in subclassesr")r3r4r9s   rr>�Node.iteritems�s��"�"O�P�PrrmrVc��[S5e)��Add a child node with prefix prefix, and node node.

:param prefix: The search key prefix for node.
:param node: The node being added.
z*add_node must be implemented in subclassesr"�r3rmrVs   rr��
Node.add_nodes��"�"N�O�Orrc��[S5e)�Map key to value.z%map must be implemented in subclassesr"�r3r4rrHs    rrB�Node.maps��!�"I�J�Jrc��[S5e)�Unmap key from the node.z'unmap must be implemented in subclassesr"�r3r4rs   rrA�
Node.unmaps��!�"K�L�Lr)r{r�r�r�r�r�r�)r�r)rwr�r�r�r�r�r5rr�rr�r��propertyr�r�r�rrrr�rr�r<rZr>r�r=rBrAr�rrrr,r,�s���	�I�#�"
��S������"�c�"��"�&�����$����$Q�(�3�-�Q�8<�Q�!)�)�!4�Q�	�%��U�
�#�	$�Q�P�s�P�&�P�T�P�K�c�K�U�3��U�3��;�=O�8P�3P�-Q�K�M��M��Mrr,c���\rSrSrSrSrSSjrSrSr\	SSj5r
SS	jrS
rS\
S\4S
jrS\
4SjrSrS\
4Sjr\S\
S\4Sj5rSrSrSrSrSrSrSrg)r1iz�A node containing actual key:value pairs.

:ivar _items: A dict of key->value items. The key is in tuple form.
:ivar _size: The number of bytes that would be used by serializing all of
    the key/value pairs.
)�_common_serialised_prefixNc�f�[RU5 SUlUc[UlgXlgr)r,r5r6r%r*)r3r.s  rr5�LeafNode.__init__#s*���
�
�d��)-��&��"�$5�D�!�$3�!rc
�<�[[UR55n[U5S:�aUSSS-nSR	UR
RURURURURURURU5$)Nrrrz?{}(key:{} len:{} size:{} max:{} prefix:{} keywidth:{} items:{}))
r�rzr{r�r@rvrwr�r�r�r�r�r�rs  rr�LeafNode.__repr__,s�����t�{�{�+�,�	��y�>�B��!�#�2���/�I�P�W�W��N�N�#�#��I�I��I�I��N�N��������O�O��	
�		
rc�h�URcSnSnO0[UR5nURX R--
nS[[	UR
55-S-[[	UR55-S-[[	UR55-S-U-S-U-$)z�Answer the current serialised size of this node.

This differs from self._raw_size in that it includes the bytes used for
the header.
r�	r�)r6r�r�r�r�r�r�)r3�bytes_for_items�
prefix_lens   rr��LeafNode._current_size;s����)�)�1��O��J�
�T�;�;�<�J�"�n�n�
�Y�Y�0F�G�O�
��#�d�(�(�)�*�
+��
��#�d�o�o�&�'�
(��	
�
�#�d�i�i�.�!�
"��

��
��
��	
�	
rc�,�[U5n[XUS9$)z�Deserialise bytes, with key key, into a LeafNode.

:param bytes: The bytes of the node.
:param key: The key that the serialised node has.
r0)r<�_deserialise_leaf_node�r�rZrr.s    r�deserialise�LeafNode.deserialiseWs���C�j��%�e�/�R�Rrc#�# �Ub�0nUHcn[U5UR:XaX@RU4v� M1UR	[U5[55R
U5 Me U(aPUR5nURR5H!nUHupxUSSUU;dMUv�  M M# ggURR5Shv�N g![a M�f=fN7f)r&Nr)r�r�r{r_�
setdefaultr��addr|)	r3r4r9�filtersr�filters_itemview�item�length�
length_filters	         rr>�LeafNode.iteritemsas�����!��G�!���s�8�t���.��!�;�;�s�#3�3�3��&�&�s�3�x���7�;�;�C�@�"��#*�=�=�?� � �K�K�-�-�/�D�1A�-����7�7�F�+�}�<�"&�J�!�2B�0���{�{�(�(�*�*�*��$�����
+�s:�$C?�C,�A=C?�:,C?�&C=�'C?�,
C:�6C?�9C:�:C?c��[URU55S-[SURS5-5-S-[U5-S-$)Nr�s%d�
)r��_serialise_key�count)r3rrHs   rr��LeafNode._key_value_len�sa��
��#�#�C�(�)��
��%�%�+�+�e�,�,�-�
.��
��%�j�	
�
�
�	
rrrc�$�URU5$r)r*�r3rs  r�_search_key�LeafNode._search_key�s���$�$�S�)�)rc��X RU'U=RURX5-
slU=RS-
slUR	U5nUR
cX0lO!UR
UR
U5UlURU5nUR[LaUR5 URcX@lO!UR
URU5UlURS:�aTUR(aCUR5UR:�a%X@R:wdUR5(dgg)z�Map a key to a value.

This assumes either the key does not already exist, or you have already
removed its size and length from self.

:return: True if adding this node should cause us to split.
r�TF)r{r�r�r�rPr6rrUr��_unknownr�r�r��_are_search_keys_identical)r3rrH�serialised_keyr�s     r�
_map_no_split�LeafNode._map_no_split�s��!���C�����$�-�-�c�9�9���	�	�Q��	��,�,�S�1���)�)�1�-;�*�-1�-?�-?��.�.��.�D�*��%�%�c�*�
����(�*��'�'�)����&�",��"&�"4�"4�T�5H�5H�*�"U�D���I�I��M��"�"��"�"�$�t�'9�'9�9��1�1�1��6�6�8�8��rc�6�UR[La[S5eURn[U5S-n0nURR5GH&upVUR
U5nUSUn[U5U:aUSU[U5-
--
nX�;aD[URS9n	U	RUR5 URU	lX�U'OXHn	U	RXU5up�[U5S:�dM�X�:waURU5 [X�RS9nURUR5 URUlUHup�URX�5 M X�U'GM) U[!UR554$)z�We have overflowed.

Split this node into multiple LeafNodes, return it up the stack so that
the next layer creates a new InternalNode and references the new nodes.

:return: (common_serialised_prefix, [(node_serialised_prefix, node)])
zSearch prefix must be knownr�Nr!r0)r�rXr�r�r{r|rUr1r*r�r�r�rB�poprxr�r=)r3r4r�split_atr~rrHr�rmrV�
sub_prefixr��new_noder�s              rr��LeafNode._split�s�����(�*� �!>�?�?��+�+�
��}�%��)�����+�+�+�+�-�J�C��)�)�#�.�J��	��*�F��6�{�X�%��'�X��F��%;�<�<���#���0E�0E�F���%�%�d�&8�&8�9�"&�/�/���!%�v���~��'+�x�x��E�'B�$�J��<� �1�$��'��J�J�v�&�'��0E�0E����)�)�$�*<�*<�=�&*�o�o��#�#/�K�E��%�%�e�2�$0�!)�v��C.�D�d�6�<�<�>�2�2�2rc��X R;aFU=RURX RU5-slU=RS-slSUlURX#5(aUR
U5$UR[La$[SRUR55eURSU4/4$)r-r�Nz{!r} must be knownr)r{r�r�r�r�r[r�r�rXr�r@r.s    rrB�LeafNode.map�s����+�+���N�N�d�1�1�#�{�{�3�7G�H�H�N��I�I��N�I���	����c�)�)��;�;�u�%�%��"�"�h�.�$�%9�%@�%@��AT�AT�%U�V�V��&�&�#�t��
�5�5rc�$�SRU5$)Nr!r"r$s rrP�LeafNode._serialise_key�s���|�|�C� � rc�F�S/nURSUR-5 URSUR-5 URSUR-5 URc6URS5 [UR5S:wa[S5eO4URSUR4-5 [UR5n[URR55H�upE[R"US-/5nSURU5[U54-nURUR5(d%[S	RURU55eURUWS5 URU5 M� UR!S
SU5un n	SU-4UlS
R%U5n
[U
5UR'5:wa[S5eU
[)5UR"'UR"/$)z�Serialise the LeafNode to store.

:param store: A VersionedFiles honouring the CHK extensions.
:return: An iterable of the keys inserted by this operation.
�	chkleaf:
�%d
NrOrz<If _common_serialised_prefix is None we should have no items�%s
s%s%d
zOWe thought the common prefix was {!r} but entry {!r} does not have it in commonrr�sha1:rzInvalid _current_size)rqr�r�r�r6r�r{r�rzr|r�chunks_to_linesrPrr@r}�	add_linesr�r#r�r)r3r4�linesr>rrH�value_lines�
serialized�sha1r��datas           rr��LeafNode.serialise�s������
���W�t�1�1�1�2�
���W�t���.�/�
���W�t�y�y�(�)��)�)�1��L�L����4�;�;��1�$�$�R���%�

�L�L��D�$B�$B�#D�D�E��T�;�;�<�J� ����!2�!2�!4�5�J�C�!�1�1�5�5�=�/�B�K�&�$�*=�*=�c�*B�C��DT�)U�U�J��(�(��)G�)G�H�H�$�A�AG���6�6�
�B���
�L�L��J�K�0�1��L�L��%�6��_�_�W�b�%�8�
��a����_�&��	��x�x�����t�9��*�*�,�,� �!8�9�9�"&�
��T�Y�Y���	�	�{�rc��/$)�7Return the references to other CHK's held by this node.rrSs r�refs�
LeafNode.refs#s���	rc��URVs/sHoRU5PM nnURU5UlUR$s snf)z�Determine the common search prefix for all keys in this node.

:return: A bytestring of the longest search key prefix that is
    unique within this node.
)r{r*rr�)r3r�search_keyss   rr��LeafNode._compute_search_prefix'sK��>B�[�[�I�[�c�,�,�S�1�[��I�"�9�9�+�F����"�"�"��J��A
c�l�SnURH"nURU5nUcUnMX1:wdM" g g)z�Check to see if the search keys for all entries are the same.

When using a hash as the search_key it is possible for non-identical
keys to collide. If that happens enough, we may try overflow a
LeafNode, but as all are collisions, we must not split.
NFT)r{rU)r3�common_search_keyrr�s    rrY�#LeafNode._are_search_keys_identical1sB��!���;�;�C��)�)�#�.�J� �(�$.�!��0���rc��URVs/sHoRU5PM nnURU5UlUR$s snf)z�Determine the common prefix for serialised keys in this node.

:return: A bytestring of the longest serialised key prefix that is
    unique within this node.
)r{rPrr6)r3r�serialised_keyss   rr��#LeafNode._compute_serialised_prefixAsL��@D�{�{�K�{��.�.�s�3�{��K�)-�)D�)D�_�)U��&��-�-�-��Lr{c�\�U=RURX RU5-slU=RS-slURU	SUlUR5 UR5 U$![a# [R
"SX R5 ef=f)r1zkey %s not found in %rr�N)
r�r�r{r_r
�mutterr�r�r�r�r2s   rrA�LeafNode.unmapKs���	��N�N�d�1�1�#�{�{�3�7G�H�H�N�	
�	�	�Q��	��K�K�����	��#�#�%��'�'�)�����	��L�L�1�3���D��	�s�1A>�>-B+)r6r�r*r�r)rwr�r�r�r�r�r5rr�r�rCr>r�r�rZrUr[r�rB�staticmethod�
SerialisedKeyrPr�rvr�rYr�rAr�rrrr1r1s����/�I�4�

�
�8�S��S�+�B

�*�s�*�u�*�&��&�P/3�b6�c�6��!�C�!�M�!��!�&�P�#�� .�
rr1c�v�\rSrSrSrSrSSjrSSjrSr\	SS	\
\4S
jj5rSS\
\
\S\\\\44SjjrS S\
\S
\
\S\\\\
\
\44SjjrSrSrSrS\S\4SjrS\S\4SjrS\S\\\\44SjrS\
\\\44SjrSSjr S!S\S\!S\4Sjjr"S"Sjr#Sr$g)#rxi[z�A node that contains references to other nodes.

An InternalNode is responsible for mapping search key prefixes to child
nodes.

:ivar _items: serialised_key => node dictionary. node may be a tuple,
    LeafNode or InternalNode.
)�_node_widthNc�r�[RU5 SUlXlUc[UlgX lg)Nr)r,r5r�r�r%r*)r3rmr.s   rr5�InternalNode.__init__gs2���
�
�d�����$���"�$5�D�!�$3�!rrc�8�URc[S5e[U[[45(d#[SR[
U555eURUR5(d$[SRXR55e[U5[UR5S-:wa'[SUS[UR5S-35eU=R[U5-
sl	[UR5(d[U5UlUR[UR5S-:wa1[SURS	[UR5S-35eX RU'SUlg)
r)N�!_search_prefix should not be Noner��(prefixes mismatch: {} must start with {}r�zprefix wrong length: len(z	) is not �node width mismatch: � is not )
r�r�rQr<r,r@r�rr�r�r{r�r�r*s   rr��InternalNode.add_nodersh�����&� �!D�E�E��$���
�.�.� �!:�!A�!A�$�t�*�!M�N�N�� � ��!4�!4�5�5� �:�A�A��/�/���
�
�v�;�#�d�1�1�2�Q�6�6� �+�F�8�9�S��AT�AT�=U�XY�=Y�<Z�[��
�	
�	�	�S��Y��	��4�;�;���"�6�{�D�����s�4�#6�#6�7�!�;�;� �'��(8�(8�'9��#�d�FY�FY�BZ�]^�B^�A_�`��
�#���F����	rc���UR[[UR55-[[UR55-[[UR
55-$)z0Answer the current serialised size of this node.)r�r�r�r�r�r�rSs rr��InternalNode._current_size�sU��
�N�N��#�d�i�i�.�!�
"��#�d�o�o�&�'�
(��#�d�(�(�)�*�
+�	
rr.c�,�[U5n[XUS9$)z�Deserialise bytes to an InternalNode, with key key.

:param bytes: The bytes of the node.
:param key: The key that the serialised node has.
:return: An InternalNode instance.
r0)r<�_deserialise_internal_noderBs    rrC�InternalNode.deserialise�s���C�j��)�%�o�V�Vrr9c#�n# �URXS9Hup4URXS9Shv�N M gN	7f)Nr8)ryr>)r3r4r9rV�node_filters     rr>�InternalNode.iteritems�s:���"&�!1�!1�%�!1�!O��D��~�~�e�~�D�D�D�"P�D�s�'5�3�
5�
batch_sizec	#�\
# �0nSnUc�SnURR5H`upg[U[5(aUS4XG'M"[U[5(aUS4v� M?[SR
[U555e O�[U5S:Xa�UHn O URW5n	[U	5UR:XamSnURU	n[U[5(aX�/4XG'O?[U[5(aXx/4v� g[SR
[U555eU(Gd�0n
0nSnUc[S5eUHinURU5n	UR[U	5[55n
U
RU	5 U
RU	/5RU5 Mk URU;a�[U5S:Xa�X�RnUHpn	URU	nX�n[U[5(aX�4XG'M3[U[5(aX|4v� MO[SR
[U555e O�UR5nURR5H�upg/nUH'unn
USUnUU
;dMUR!U
U5 M) U(dM=[U[5(aXl4XG'MY[U[5(aX|4v� Mu[SR
[U555e U(a�[5nUH�n[#5Un[%UX�R&S9nXHupl[U[5(d#[SR
[U555eXpRU'URU5 X|4v� M� UHnXH	M U(GaUc[U5n[)U5n[+S[U5U5H�nUUUU-nUR-US	S5n/nUH�nUR/S
5n[%UUR0UR&S9nUUR0uplURX|45 [U[5(d#[SR
[U555eXpRU'U[#5UR0'M� UShv�N M� gg![a gf=f![a GM f=f![a GM�f=fN>7f)aIterate over node objects which match key_filter.

:param store: A store to use for accessing content.
:param key_filter: A key filter to filter nodes. Only nodes that might
    contain a key in key_filter will be returned.
:param batch_size: If not None, then we will return the nodes that had
    to be read using get_record_stream in batches, rather than reading
    them all at once.
:return: An iterable of nodes. This function does not have to be fully
    consumed.  (There will be no pending I/O when items are being returned.)
FNTr�r�zkey_filter must not be Noner0rr]r^)r{r|rQr<r,r�r@r�r��_search_prefix_filterr�r_rFr�rGrqr}rrYr*r=�ranger`rbr)r3r4r9r�r��shortcutrmrVr�
search_prefix�prefix_to_keys�length_filters�node_key_filterrL�search_prefixes�length_filters_itemviewrKr`�
found_keysrZ�	key_order�batch_start�batchrc�node_and_filters�records                          rry�InternalNode._iter_nodes�s���(FH�������H� $��� 1� 1� 3����d�E�*�*�"(�$��D�J���d�+�+���*�$�(�)B�)I�)I�$�t�*�)U�V�V�
!4���_��
!�$"���"� �6�6�s�;�M��=�!�T�%5�%5�5� ����;�;�}�5�D�
�d�E�*�*�"/��!7�D�J���d�+�+���+�%��(�)B�)I�)I�$�t�*�)U�V�V��>@�N�<>�N�37�O��!�$�%B�C�C�!�� $� :� :�3� ?�
� .� 9� 9�#�m�:L�c�e� T�
��!�!�-�0��)�)�-��<�C�C�C�H�	"����>�1�c�.�6I�Q�6N�
#1�1A�1A�"B��%4�M�!�#�{�{�=�9��'5�&C�O�!�$��.�.�&3�%E��
�#�D�$�/�/�"�3�3�,�5�<�<�T�$�Z�H���&5�$+9�*>�*>�*@�'�$(�K�K�$5�$5�$7�L�F�&(�O�1H�-��
�%+�G�V�_�
�%��6�+�2�2�>�*�3M�N�2I�'��%�d�E�2�2�*0�)B�D�J�'��d�3�3�"&�"7�7�"0� 9� @� @��d�� L�#��%8����J���0�&�L��-�E�(��s�4I�4I��D�/3�i�+�F�%�d�D�1�1�,�5�<�<�T�$�Z�H���+/�K�K��'��N�N�3�'��/�/�!�""���I�"���!� ��Y�
��T�
�I�$�Q��I��
�C��!�+��j�0H�I���0�0���T�J��#%� �$�F�"�/�/�
�;�E�'��v�z�z�4�;P�;P��D�/3�6�:�:�.>�+�F�$�+�+�T�,C�D�%�d�D�1�1�,�5�<�<�T�$�Z�H���+/�K�K��'�/4�J�L����,�%�,�+�+�' D�
��s �����H$�!� �!��J �����R,�s��C
T,�S6�DT,�8T�B$T,�/T,�A3T,�
T�FT,�+T*�,
T,�6
T�T,�T�T,�
T�T,�T�T,�
T'�"T,�&T'�'T,c��[UR5(d[S5eURU5nUR[UR
5S-:wa1[SURS[UR
5S-35eUR
UR
5(d�URUR
U5n[XPRS9nURUR5 URUlURUR
S[U5S-U5 URXU5$URX/S9VVs/sHupxUPM	 n	nnU	(aU	Sn
OUR!U["5n
[U
5n[%U
["5(aU
R'5nOSnU
RXU5up�[U5S:XGaUSSn
UR(U-
[U
5-UlX�RU'SUlUn[%U
["5(a�Uc([,R."S	5 UR1U5nOXU
R'5nUU-
nUS:�a
U[2:d
U[4:�a)[,R."S
UU5 UR1U5nUR
c[S5eUR
SU4/4$UR!U[5n
X�lUHunnU
RUU5 M UR(U-
[U
5-UlSUlUR
SU4/4$s snnf)
r-z#can't map in an empty InternalNode.r�r�r�r0Nr8rz*checking remap as InternalNode -> LeafNodez,checking remap as size shrunk by %d to be %dr�r)r�r{r�rUr�r�rrrxr*r�r�r�r�rBry�
_new_childr1rQr�r�r�r
r�rC�_INTERESTING_NEW_SIZE�_INTERESTING_SHRINKAGE_LIMIT)r3r4rrHr��
new_prefix�
new_parentrVr��childrenr��old_len�old_sizermr�rar�	shrinkager�s                   rrB�InternalNode.mapZs���4�;�;��� �!F�G�G��%�%�c�*�
����s�4�#6�#6�7�!�;�;� �'��(8�(8�'9��#�d�FY�FY�BZ�]^�B^�A_�`��
��$�$�T�%8�%8�9�9��+�+�D�,?�,?��L�J�%�j�BW�BW�X�J��'�'��(:�(:�;�$(�O�O�J�!����� 3� 3�4I�c�*�o��6I� J�D�Q��>�>�%�e�4�4�(,�(8�(8��5�(8�(Q�R�(Q�W�T�D�(Q��R���Q�K�E��O�O�J��9�E��e�*���e�X�&�&��*�*�,�H��H�$�y�y��U�;����|���!� ��O�A�&�E��	�	�G�+�c�%�j�8�D�I�&+�K�K�
�#��D�I��H��%��*�*��#��L�L�!M�N�#�0�0��7�H� %�2�2�4�H� (�8� 3�I�!�A�
�(�5J�*J�"�%A�A����J�%�$��
$(�#4�#4�U�#;���&�&�.�$�%H�I�I��*�*�c�8�_�,=�=�=�
���
�L�9��%��'�K�E�4��N�N�5�$�'�(��I�I��'�#�e�*�4��	���	��"�"�c�4�[�M�1�1��sSs�Mc��U"5nURUR5 URUlURUlX0RU'U$)z&Create a new child node of type klass.)r�r�r�r*r{)r3r��klassr�s    rr��InternalNode._new_child�sH�����
���t�1�1�2��?�?���!%�!6�!6���"'���J���rc#��# �URR5Hrn[U[5(aM[U[5(a-UR
bM>UR
U5HnUv� M	 M\[SUR35e S/nURSUR-5 URSUR-5 URSUR-5 URc[S5eURSUR4-5 [UR5n[URR!55H�upb[U[5(aUSnO=[U[5(aUR
SnO[SUR35eSXc4-nUR#UR5(d$[S	R%XpR55eURXuS5 M� UR'S
SU5un n	SU-4UlS
R)U5[+5UR
'UR
v� g7f)z�Serialise the node to store.

:param store: A VersionedFiles honouring the CHK extensions.
:return: An iterable of the keys inserted by this operation.
N�=InternalNode._items should only contain tuples or Nodes, not �	chknode:
rir�rjrs%s%s
r�rrrkr)r{�valuesrQr<r,r�r�r�rvrqr�r�r�r�r�rzr|rr@rmr#r)
r3r4rVrrnr>rm�
serialisedrqr�s
          rr��InternalNode.serialise�s����K�K�&�&�(�D��$��&�&���D�$�'�'��9�9�(���>�>�%�0�C��I�1�%�S�TX�Tb�Tb�Sc�d���)����
���W�t�1�1�1�2�
���W�t���.�/�
���W�t�y�y�(�)����&� �!D�E�E�
���W�� 3� 3�5�5�6���,�,�-�
�"�4�;�;�#4�#4�#6�7�L�F��$��&�&��1�g���D�$�'�'��i�i��l��$�S�TX�Tb�Tb�Sc�d���'�&��6�J��(�(��)<�)<�=�=�$�>�E�E�"�$7�$7����

�L�L��K�0�1�!8�"�_�_�W�b�%�8�
��a����_�&��	�"%�(�(�5�/�
��T�Y�Y���i�i��s�I2I4rc�^�URU5SUR--SUR$)z/Return the serialised key for key in this node.r!N�r*r�rTs  rrU�InternalNode._search_key�s7���%�%�c�*�W�t�7G�7G�-G�G��d���
�	
rc�>�URU5SUR$)z6Serialise key for use as a prefix filter in iteritems.Nr�rTs  rr��"InternalNode._search_prefix_filter�s!���$�$�S�)�*<�D�,<�,<�=�=r�offsetc#�# �XR:�a;URR5HnURU5Shv�N M ggN
7f)z�Split this node into smaller nodes starting at offset.

:param offset: The offset to start the new child nodes at.
:return: An iterable of (prefix, node) tuples. prefix is a byte
    prefix for reaching node.
N)r�r{r�r�)r3r�rVs   rr��InternalNode._split�sD����%�%�%����*�*�,���;�;�v�.�.�.�-�&�.�s�AA�A�Ac�d�URc[S5e/nURR5Hwn[	U[
5(aUR
U5 M+[	U[5(a!UR
UR55 Ma[SUR35e U$)ruz unserialised nodes have no refs.r�)
r�r�r{r�rQr<rqr,rrv)r3rvrHs   rrv�InternalNode.refs�s����9�9�� �!C�D�D����[�[�'�'�)�E��%��'�'����E�"��E�4�(�(����E�I�I�K�(�$�S�TY�Tc�Tc�Sd�e���
*��rc�Z�URUR5UlUR$)z�Return the unique key prefix for this node.

:return: A bytestring of the longest search key prefix that is
    unique within this node.
)rr{r�)r3�	extra_keys  rr��#InternalNode._compute_search_prefix
s'��#�9�9�$�+�+�F����"�"�"rr;c��[UR5(d[S5eURX/S9VVs/sHupEUPM	 nnnU(aUSnO[	U5eU=R
S-slUR
X5nSUlURU5n	[U5S:XaURU		SnOX�RU	'[UR5S:Xa&[URR55S$[U[5(aU$U(aURU5$U$s snnf)z+Remove key from this node and its children.z%can't unmap in an empty InternalNode.r8rr�N)r�r{r�ryr_r�rAr�rUr=r�rQrxrC)
r3r4rr;rVr�r�r�r�r�s
          rrA�InternalNode.unmaps���4�;�;��� �!H�I�I�(,�(8�(8��5�(8�(Q�R�(Q�W�T�D�(Q��R���Q�K�E��3�-���	�	�Q��	��;�;�u�*����	��%�%�c�*�
��x�=�A�����J�'��H�'/�K�K�
�#��t�{�{��q� �����*�*�,�-�a�0�0��h��-�-��K���$�$�U�+�+��K��3Ss�D=c��[URS9nURUR5 URUlURUSS9H]up4[
U[5(aUs $URR5H!upVURXV5(dMUs s $ M_ [R"S5 U$)z�Check if all keys contained by children fit in a single LeafNode.

:param store: A store to use for reading more nodes
:return: Either self, or a new LeafNode which should replace self.
r0r)r�zremap generated a new LeafNode)
r1r*r�r�r�ryrQrxr{r|r[r
r�)r3r4�new_leafrVr�rrHs       rrC�InternalNode._check_remap2s���8�D�,A�,A�B���!�!�$�"4�"4�5�"�o�o����'�'��"�'�=�G�D��$��-�-���"�k�k�/�/�1�
���)�)�#�5�5��K�2�	>�	���5�6��r)r�r�r�r*r�)rN)rVr,rNr)NNr�)rr,)%rwr�r�r�r�r�r5r�r�r�rr�rCr=r�rr<rZr>r�r�r,ryrBr�r�r�rUr�rr�rvr�r�rArCr�rrrrxrx[s^���!�I�	4��<
��W�h�}�6M�W��W�8<�E�!)�$�s�)�!4�E�	�5��e��$�	%�E�+/�$(�	n,��Y�'�n,��S�M�	n,�

�5��x��S�	�2�2�3�	4�n,�`L2�\�0�d
�s�
�}�
�>��>��>�	/�S�	/�X�e�M�4�4G�.H�%I�	/��d�5���!3�4�5�� #����$��$��>.rrxc���URS5(a[RXUS9nU$URS5(a[RXUS9nU$[	S5e)z7Helper for repositorydetails - convert bytes to a node.rhr0r�zUnknown node type.)rr1rCrxr�)rrrr.rVs    rrYrYcsh�����}�%�%��#�#�D��#�O��
�K�	
����	'�	'��'�'��?�'�S���K��1�2�2rc�R�\rSrSrSrSSjrSrSrSrSr	S	r
S
rSrSr
S
rg)�CHKMapDifferenceinaUIterate the stored pages and key,value pairs for (new - old).

This class provides a generator over the stored CHK pages and the
(key, value) pairs that are in any of the new maps and not in any of the
old maps.

Note that it may yield chk pages that are common (especially root nodes),
but it won't yield (key,value) pairs that are common.
Nc���XlX lX0lXPl[	UR5Ul[	5Ul[	5UlX@l/Ul	/Ul
/UlSUlgr)
r+�_new_root_keys�_old_root_keys�_pbr��
_all_old_chks�_all_old_items�_processed_new_refsr*�
_old_queue�
_new_queue�_new_item_queue�_state)r3r4�
new_root_keys�
old_root_keysr.�pbs      rr5�CHKMapDifference.__init__ysl����+��+����!��!4�!4�5���!�e���
$'�5�� � /�������� "�����rc#�F# �URRUSS5nUH�nURbURR5 URS:Xa+[
R"URUR5eURS5n[XCRURS9n[U[5(a&[URR55n/nO%/n[URR55nX5Xg4v� M� g7f)Nr]T�absentr^r0)r+r`r��tick�storage_kindr	�NoSuchRevisionrrbrYr*rQrxr=r{r|)r3r�rcr�rZrV�prefix_refsr|s        r�_read_nodes_from_store�'CHKMapDifference._read_nodes_from_store�s�������.�.�t�[�$�G���F��x�x�#����
�
���"�"�h�.��+�+�D�K�K����D�D��'�'�
�3�E���z�z�4�3H�3H��D��$��-�-�#�4�;�;�#4�#4�#6�7���� ���T�[�[�.�.�0�1����2�2�1�s�DD!c�Z�/nURnURUR5Hsup4pVUVs/sHowSU;dM
UPM nnUVs/sHowSPM	 nnURU5 URRU5 URU5 Mu U$s snfs snf�Nr�)r�r�r��updater�r})	r3�old_chks_to_enqueue�all_old_chks�_record�_noder�r|�p_r�new_refss	         r�_read_old_roots� CHKMapDifference._read_old_roots�s��� ���)�)��26�2M�2M����3
�.�G�K�+6�T�+�3�Q��|�9S�3�+�K�T�*5�6�+�3�A��+�H�6�����)�

���&�&�u�-�
 �&�&�{�3�3
� #�"��U��6s�B#�B#�B(c��UHUup4Sn[[U5SS5HnUSUU;dMSn O U(aM:URRU5 MW g)NTrr�F)r�r�r�rq)r3�new_prefixesr�rm�ref�not_interesting�is       r�_enqueue_old�CHKMapDifference._enqueue_old�s\��/�K�F�"�O��3�v�;��2�.���"�1�:��-�&+�O��/����O�O�"�"�3�'�/rc
#�n# �UR(d[UR5UlgUR	5n[UR5R
UR5n[5nURnURU5 URU5GHupVpxUV	s/sH%n	U	SUR;dMU	SU;dM#U	PM' nn	UV	s/sHo�SPM	 n
n	URUV	s/sHo�SPM	 sn	5 URRU
5 UVs/sHo�UR;dMUPM nnURRU5 URUVs/sHo�RUS5PM sn5 URU
5 Uv� GM [U5H:n
UR[S[!U
55Vs/sHo�SUPM	 sn5 M< UR#X15 gs sn	fs sn	fs sn	fs snfs snfs snf7f)z�Read the root pages.

This is structured as a generator, so that the root records can be
yielded up to whoever needs them without any buffering.
Nr�r)r�r=r�r�r�r��
differencer�r�r�r�r}r�r�r*r�r�r�)r3r��new_keysr��processed_new_refsr�r�r�r|r�rvrJrIrmr�s               r�_read_all_roots� CHKMapDifference._read_all_roots�s����"�"�#�4�#6�#6�7�D�O��"�2�2�4���t�*�*�+�6�6�t�7I�7I�J���u��"�5�5���!�!�(�+�15�1L�1L�X�1V�-�F�;�
'��&�C��q�6��!3�!3�3��8;�A��FX�8X��&�
��
'2�2�k�s��F�k�D�2����;� ?�;�C�Q��;� ?�@��O�O�"�"�4�(�+0�S�%�$�t�?R�?R�3R��%�I�S�� � �'�'�	�2����I� V�I�D�!6�!6�t�A�w�!?�I� V�W��%�%�d�+��L�-2W�6�<�(�F����U�1�c�&�k�5J� K�5J�����5J� K�L�)����,�<��5��
3�� ?��T�� V��!L�sa�B.H5�0H�H�H�H5�"H�0H5�H!
�&H5�5H&�H&�,H5�>H+
�AH5�,H0
�:;H5c#��# �[UR5n/UlURnURnURnUR
Vs/sHoUU;dM
UPM nn/UlU(aSU4v� UR
U5nURU5 U(a�[5nURnURU5HGup�p�U(aUVs/sHoUU;dM
UPM nnX�4v� U"UV
s/sHo�SPM	 sn
5 AMI UR
U5nUR
U5nURU5 UnU(aM�ggs snfs snfs sn
f7fr�)	r�r�r�r�r�r�r�r�r�)r3rvr�r�
all_old_itemsrJrI�	next_refs�next_refs_updater�r��p_refsr|r�s              r�_flush_new_queue�!CHKMapDifference._flush_new_queuesS����4�?�?�#������)�)��!�5�5���+�+�
�&*�&:�&:�X�&:�d�-�>W�T�&:�	�X�!�����	�/�!����|�,���!�!�$�'����I�(�/�/��-1�,G�,G��,M�(��6� �/4�Q�e�d�=�7P�T�e�E�Q��m�#� �F�!;�F�S�a�&�F�!;�<��-N�"�,�,�\�:�I�!�,�,�-?�@�I��%�%�i�0��D�5�d��
Y��$R��!;�s>�AE$�	E�E�$A7E$�	E�(E�.
E$�;E
�	AE$�E$c�L�URn/UlURnURU5Hjup4pVURR	U5 UVVs/sHupGXr;dMUPM nnnURRU5 UR	U5 Ml gs snnfr)r�r�r�r�r�r})r3rvr�r�r�r�r|�rs        r�_process_next_old�"CHKMapDifference._process_next_oldAs�����������)�)��.2�.I�.I�$�.O�*�G�����&�&�u�-�"-�G�+�$�!��1F�A�+�D�G��O�O�"�"�4�(�����%�/P��Hs�B �&B c��UR(a#UR5 UR(aM#UR5$r)r�rrrSs r�_process_queues� CHKMapDifference._process_queuesNs/���o�o��"�"�$��o�o�o��$�$�&�&rc#�# �UR5H	nU/4v� M UR5H
upX4v� M g7fr)rr)r3r�r|s   r�process�CHKMapDifference.processSs?����*�*�,�F��"�*��-�!�1�1�3�M�F��-��4�s�=?)r�r�r�r�r�r�r�r�r�r*r�r+r)rwr�r�r�r�r5r�r�r�rrrrrr�rrrr�r�ns8���!�F3�B#�*
(�3=�j)�V&�'�
 rr�c�P�[UUUURUS9nUR5$)a�Given root keys, find interesting nodes.

Evaluate nodes referenced by interesting_root_keys. Ones that are also
referenced from uninteresting_root_keys are not considered interesting.

:param interesting_root_keys: keys which should be part of the
    "interesting" nodes (which will be yielded)
:param uninteresting_root_keys: keys which should be filtered out of the
    result set.
:return: Yield
    (interesting record, {interesting key:values})
)r.r�)r�r*r)r4�interesting_root_keys�uninteresting_root_keysr��iterators     r�iter_interesting_nodesrZs4�� �
����.�.�
��H�����rr�)�_bytes_to_text_keyr�rA�_search_key_16�_search_key_255shash-16-wayshash-255-wayc	��[U[5(d$[SRU[	U555e[U5S:wa[
SU<S[U535e[US[5(d'[SRU[	US555eUSRS5(d[
SRU55eg	)
z�Helper function to assert that a key is properly formatted.

This generally shouldn't be used in production code, but it can be helpful
to debug problems.
zkey {!r} is not tuple but {}r�zkey z should have length 1, not rz$key {!r} should hold a str, not {!r}zsha1:z key {!r} should point to a sha1:N)	rQr<�	TypeErrorr@r�r��
ValueErrorr�rr$s r�
_check_keyr�s����c�5�!�!��6�=�=�c�4��9�M�N�N�
�3�x�1�}��4��w�&A�#�c�(��L�M�M��c�!�f�c�"�"��2�9�9�#�t�C��F�|�L�
�	
��q�6���W�%�%��;�B�B�3�G�H�H�&rr)7r�r��	threading�collections.abcrrr�typingrrrlr	r
rrr
rr<rZr�r�r�r=r��localrrrrr�r�r%�Registry�search_key_registry�registerr'r,�objectrXr1rxrYr�r�_chk_map_pyxrr�rArr�ImportError�e�failed_to_load_extension�_chk_map_pyrrrr�<module>r-s���"�,
��9�9�,�,�:�:�
#���E�3�J����
��#����&�
���I�	����"�� �����
��!���3��=��
�'�'��x���}�8L�/M�(M�N�P�����X�'8�9�a�a�HLM�LM�`�8���t��D
E�4�E�P�i �i �Z?C��2��� ���^�^�<����_�o�>�I�����$�$�Q�'������s�#D�E	� E�E	

Youez - 2016 - github.com/yon3zu
LinuXploit