Ë
   ÒøÌr¥‘Dã                   ó  — d dl Zd dlmc mZ d dlZd dlmZ d dl	m
Z
 d dlmZmZmZ d dlmZ  ed«      Z ed«      Z e
dd	¬
«       G d„ deeef   «      «       Z G d„ deeef   «      Z G d„ deeef   «      Z G d„ deeef   «      Zy)é    N)ÚOrderedDict)Ú	dataclass)ÚAnyÚGenericÚTypeVar)ÚInvalidArgumentÚKÚVTF)ÚslotsÚfrozenc                   óZ   — e Zd ZU eed<   eed<   eed<   dZeed<   ede	edf   fd„«       Z
y	)
ÚEntryÚkeyÚvalueÚscorer   ÚpinsÚreturn.c                 ó>   — | j                   dk(  rd| j                  fS y)Nr   )é   )r   r   ©Úselfs    ú^/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/hypothesis/internal/cache.pyÚsort_keyzEntry.sort_key   s    € à�9‰9˜Š>à�t—z‘z�?Ð"ð ó    N)Ú__name__Ú
__module__Ú__qualname__r	   Ú__annotations__r
   Úintr   ÚpropertyÚtupler   © r   r   r   r      s;   … à	
ƒFØƒHØƒJØ€Dˆ#ƒMàð˜%  S ™/ò ó ñr   r   c                   ó�  — e Zd ZdZdZdefd„Zedee	ef   fd„«       Z
edeee	ef      fd„«       Zd!d	„Zdefd
„Zde	defd„Zde	defd„Zde	deddfd„Zd„ Zde	deddfd„Zde	ddfd„Zde	defd„Zd!d„Zdefd„Zde	dedefd„Zde	dededefd„Zde	dededefd„Zd!d„Z deddfd„Z!dededdfd„Z"deddfd„Z#dededefd „Z$y)"ÚGenericCacheaÉ  Generic supertype for cache implementations.

    Defines a dict-like mapping with a maximum size, where as well as mapping
    to a value, each key also maps to a score. When a write would cause the
    dict to exceed its maximum size, it first evicts the existing key with
    the smallest score, then adds the new key to the map. If due to pinning
    no key can be evicted, ValueError is raised.

    A key has the following lifecycle:

    1. key is written for the first time, the key is given the score
       self.new_entry(key, value)
    2. whenever an existing key is read or written, self.on_access(key, value,
       score) is called. This returns a new score for the key.
    3. After a key is evicted, self.on_evict(key, value, score) is called.

    The cache will be in a valid state in all of these cases.

    Implementations are expected to implement new_entry and optionally
    on_access and on_evict to implement a specific scoring strategy.
    )Ú_threadlocalÚmax_sizer&   c                 ód   — |dk  rt        d«      ‚|| _        t        j                  «       | _        y )Nr   z Cache size must be at least one.)r   r&   Ú	threadingÚlocalr%   )r   r&   s     r   Ú__init__zGenericCache.__init__A   s-   € Ø�qŠ=Ü!Ð"DÓEÐEà ˆŒô &ŸO™OÓ-ˆÕr   r   c                 óœ   — 	 | j                   j                  S # t        $ r* i | j                   _        | j                   j                  cY S w xY w©N)r%   Úkeys_to_indicesÚAttributeErrorr   s    r   r-   zGenericCache.keys_to_indicesN   sH   € ð	5Ø×$Ñ$×4Ñ4Ð4øÜò 	5Ø02ˆD×ÑÔ-Ø×$Ñ$×4Ñ4Ò4ð	5úó   ‚ ˜0AÁ
Ac                 óœ   — 	 | j                   j                  S # t        $ r* g | j                   _        | j                   j                  cY S w xY wr,   )r%   Údatar.   r   s    r   r1   zGenericCache.dataV   sH   € ð	*Ø×$Ñ$×)Ñ)Ð)øÜò 	*Ø%'ˆD×ÑÔ"Ø×$Ñ$×)Ñ)Ò)ð	*úr/   Nc                 ó0  — t        | j                  dd«      r| j                  j                  d„ ¬«       | j                  j                  «        t        | j                  «      D ]  \  }}|| j                  |j                  <   Œ  d| j                  _        yy)a¢  An exception raised partway through a mutation - most plausibly a
        RecursionError below a deeply recursive strategy - can leave the heap
        property or the key index broken.  We note the interruption and
        rebuild both here, on the next operation, from the surviving entries
        (a sorted list is heap-ordered), rather than attempting a repair at
        the moment the stack overflowed.
        ÚinterruptedFc                 ó   — | j                   S r,   )r   )Úes    r   ú<lambda>z5GenericCache._repair_if_interrupted.<locals>.<lambda>g   s
   € ¨¯©€ r   ©r   N)	Úgetattrr%   r1   Úsortr-   ÚclearÚ	enumerater   r3   )r   Úir5   s      r   Ú_repair_if_interruptedz#GenericCache._repair_if_interrupted^   s~   € ô �4×$Ñ$ m°UÔ;Ø�I‰I�N‰NÑ3ˆNÔ4Ø× Ñ ×&Ñ&Ô(Ü! $§)¡)Ó,ò 0‘��1Ø./�×$Ñ$ Q§U¡UÒ+ð0à,1ˆD×ÑÕ)ð <r   c                 ó  — | j                  «        | j                  }t        |«      }| j                  }t        |«      }||k(  }|�s¨t	        j
                  d|fd||f«      dt        j                  «       v st	        j                  t        «      rt	        j                  t        «      nddt        j                  «       v st	        j                  | «      rt	        j                  | «      ndt	        j                  |«      t	        j                  |«      dt        j                  «       v st	        j                  t        «      rt	        j                  t        «      nddt        j                  «       v st	        j                  | «      rt	        j                  | «      ndt	        j                  |«      t	        j                  |«      dœz  }dd|iz  }t        t	        j                  |«      «      ‚d x}x}x}x}}t        | j                  «      S )N©ú==©z‘%(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.keys_to_indices
})
} == %(py12)s
{%(py12)s = %(py7)s(%(py10)s
{%(py10)s = %(py8)s.data
})
}Úlenr   ©Úpy0Úpy1Úpy3Úpy5Úpy7Úpy8Úpy10Úpy12úassert %(py14)sÚpy14)r=   r-   rB   r1   Ú
@pytest_arÚ_call_reprcompareÚ@py_builtinsÚlocalsÚ_should_repr_global_nameÚ	_safereprÚAssertionErrorÚ_format_explanation)r   Ú@py_assert2Ú@py_assert4Ú@py_assert9Ú@py_assert11Ú@py_assert6Ú@py_format13Ú@py_format15s           r   Ú__len__zGenericCache.__len__m   s  € Ø×#Ñ#Ô%Ø×'Ñ'Ð:ŒsÐ'Ó(Ð:°·	±	Ð:¬C°	«NÐ:Ð(¨NÑ:×:×:Ö:Ð(¨N×:×:×:×:×:Ñ:Œs×:×:Ó:Œs×:×:×:×:×:Ò:�4×:×:Ó:�4×:×:Ô:Ð'×:×:Ò:Ð(×:×:×:×:×:Ð:¬C×:×:Ó:¬C×:×:×:×:×:Ò:°×:×:Ó:°×:×:Ô:°	×:×:Ò:¨N×:×:×:×:×:×:×:Ü�4—9‘9‹~Ðr   r   c                 ó>   — | j                  «        || j                  v S r,   )r=   r-   ©r   r   s     r   Ú__contains__zGenericCache.__contains__r   s   € Ø×#Ñ#Ô%Ø�d×*Ñ*Ð*Ð*r   c                 óØ   — | j                  «        | j                  |   }| j                  |   }	 | j                  |«       |j                  S # t        $ r d| j
                  _        ‚ w xY w)NT)r=   r-   r1   Ú!_GenericCache__entry_was_accessedÚBaseExceptionr%   r3   r   )r   r   r<   Úresults       r   Ú__getitem__zGenericCache.__getitem__v   sl   € Ø×#Ñ#Ô%Ø× Ñ  Ñ%ˆØ—‘˜1‘ˆð	Ø×%Ñ% aÔ(ð �|‰|Ðøô ò 	Ø,0ˆD×ÑÔ)Øð	ús   °A ÁA)r   c           	      óZ  — | j                  «        d }	 | j                  |   }| j                  |   }|j                  }||k(  }|sÚt	        j
                  d|fd||f«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      nddœz  }dd|iz  }	t        t	        j                  |	«      «      ‚d x}}||_        	 | j                  |«       |��:| j                  d	   |ur÷|j4                  }| j                  d	   }
|
j4                  }||k  }|sÁt	        j
                  d|fd||f«      dt        j                  «       v st	        j                  |«      rt	        j                  |«      ndt	        j                  |«      t	        j                  |
«      t	        j                  |«      dœz  }dd|iz  }t        t	        j                  |«      «      ‚d x}x}x}
}| j7                  |j                  |j                  |j8                  «       y y # t        $ r d| j                  _        ‚ w xY w# t"        $ �r t%        ||| j'                  ||«      «      }t)        | j                  «      | j*                  k\  rS| j                  d	   }|j,                  d	kD  rt/        d
«      d ‚| j                  |j                  = d	}|| j                  d	<   n0t)        | j                  «      }| j                  j1                  |«       	 || j                  |<   | j3                  |«       n# t        $ r d| j                  _        ‚ w xY wY �Œmw xY w)Nr?   )z+%(py2)s
{%(py2)s = %(py0)s.key
} == %(py4)sÚentryr   )rD   Úpy2Úpy4zassert %(py6)sÚpy6Tr   z>Cannot increase size of cache where all keys have been pinned.©ú<=©zN%(py2)s
{%(py2)s = %(py0)s.sort_key
} <= %(py7)s
{%(py7)s = %(py5)s.sort_key
}Úevicted©rD   rh   rG   rH   zassert %(py9)sÚpy9)r=   r-   r1   r   rN   rO   rP   rQ   rR   rS   rT   rU   r   rb   rc   r%   r3   ÚKeyErrorr   Ú	new_entryrB   r&   r   Ú
ValueErrorÚappendÚ_GenericCache__balancer   Úon_evictr   )r   r   r   rn   r<   rg   Ú@py_assert1Ú@py_assert3Ú@py_format5Ú@py_format7rW   rZ   Ú@py_format8Ú@py_format10s                 r   Ú__setitem__zGenericCache.__setitem__�   s¯  € Ø×#Ñ#Ô%Øˆð	Ø×$Ñ$ SÑ)ˆAð, —I‘I˜a‘LˆEØ—9‘9Ð#�9 Ñ#×#×#Õ#�9 ×#×#×#×#×#Ñ#�5×#×#Ó#�5×#×#Ô#�9×#×#×#×#×#Ð# ×#×#Ó# ×#×#×#×#×#×#Ó#ØˆEŒKðØ×)Ñ)¨!Ô,ð
 ÑØ�y‰y˜‰| 5Ñ(Ø×'Ñ'Ð@¨4¯9©9°Q©<Ð@¨<×+@Ñ+@Ð@Ð'Ð+@Ñ@×@×@Õ@Ð'Ð+@×@×@×@×@×@Ñ@�w×@×@Ó@�w×@×@Ô@Ð'×@×@Ò@¨<×@×@Ò@Ð+@×@×@×@×@×@×@Õ@Ø�M‰M˜'Ÿ+™+ w§}¡}°g·m±mÕDð øô	 !ò Ø04�×!Ñ!Ô-Øðûô5 ó 	Ü˜#˜u d§n¡n°S¸%Ó&@ÓAˆEÜ�4—9‘9‹~ §¡Ò.ØŸ)™) A™,�Ø—<‘< !Ò#Ü$ØXóàð ð ×(Ñ(¨¯©Ð5Ø�Ø$�—	‘	˜!’ä˜Ÿ	™	“N�Ø—	‘	× Ñ  Ô'ðØ,-�×$Ñ$ SÑ)Ø—‘˜qÕ!øÜ ò Ø04�×!Ñ!Ô-Øðúò "ð!	ús6   ”J Ä+I: É:JÊCN*Í& NÎN*ÎN#Î#N*Î)N*c                 ó,   — t        | j                  «      S r,   )Úiterr-   r   s    r   Ú__iter__zGenericCache.__iter__©   s   € Ü�D×(Ñ(Ó)Ð)r   c                 óö   — || |<   | j                   |   }| j                  |   }|xj                  dz  c_        |j                  dk(  r	 | j                  |«       yy# t        $ r d| j
                  _        ‚ w xY w)a-  Mark ``key`` as pinned (with the given value). That is, it may not
        be evicted until ``unpin(key)`` has been called. The same key may be
        pinned multiple times, possibly changing its value, and will not be
        unpinned until the same number of calls to unpin have been made.
        r   TN)r-   r1   r   ru   rc   r%   r3   )r   r   r   r<   rg   s        r   ÚpinzGenericCache.pin¬   sz   € ð ˆˆS‰	à× Ñ  Ñ%ˆØ—	‘	˜!‘ˆØ�
Š
�a‰�
Ø�:‰:˜Š?ðØ—‘˜qÕ!ð øô !ò Ø04�×!Ñ!Ô-Øðús   Á	A ÁA8c                 óH  — | j                  «        | j                  |   }| j                  |   }|j                  dk(  rt	        d|›d�«      ‚|xj                  dz  c_        |j                  dk(  r	 | j                  |«       yy# t        $ r d| j                  _        ‚ w xY w)z†Undo one previous call to ``pin(key)``. The value stays the same.
        Once all calls are undone this key may be evicted as normal.r   zKey z has not been pinnedr   TN)	r=   r-   r1   r   rs   ru   rc   r%   r3   )r   r   r<   rg   s       r   ÚunpinzGenericCache.unpin¾   s�   € ð 	×#Ñ#Ô%Ø× Ñ  Ñ%ˆØ—	‘	˜!‘ˆØ�:‰:˜Š?Ü˜t C 7Ð*>Ð?Ó@Ð@Ø�
Š
�a‰�
Ø�:‰:˜Š?ðØ—‘˜qÕ!ð øô !ò Ø04�×!Ñ!Ô-Øðús   Á2B ÂB!c                 óX   — | j                   |   }| j                  |   j                  dkD  S )z,Returns True if the key is currently pinned.r   )r-   r1   r   )r   r   r<   s      r   Ú	is_pinnedzGenericCache.is_pinnedÎ   s+   € à× Ñ  Ñ%ˆØ�y‰y˜‰|× Ñ  1Ñ$Ð$r   c                 óV   — | j                   dd…= | j                  j                  «        y)z3Remove all keys, regardless of their pinned status.N)r1   r-   r:   r   s    r   r:   zGenericCache.clearÓ   s   € à�I‰I’aˆLØ×Ñ×"Ñ"Õ$r   c                 óR   — ddj                  d„ | j                  D «       «      z   dz   S )Nú{z, c              3   óR   K  — | ]  }|j                   ›d |j                  ›�–— Œ! y­w)z: N)r   r   )Ú.0r5   s     r   ú	<genexpr>z(GenericCache.__repr__.<locals>.<genexpr>Ù   s#   è ø€ ÒL¸Q !§%¡% ¨"¨Q¯W©W¨KÔ8ÑLùs   ‚%'ú})Újoinr1   r   s    r   Ú__repr__zGenericCache.__repr__Ø   s%   € Ø�T—Y‘YÑLÀ$Ç)Á)ÔLÓLÑLÈsÑRÐRr   c                 ó   — t         ‚)zŽCalled when a key is written that does not currently appear in the
        map.

        Returns the score to associate with the key.
        )ÚNotImplementedError©r   r   r   s      r   rr   zGenericCache.new_entryÛ   s
   € ô "Ð!r   r   c                 ó   — |S )zƒCalled every time a key that is already in the map is read or
        written.

        Returns the new score for the key.
        r"   ©r   r   r   r   s       r   Ú	on_accesszGenericCache.on_accessã   s	   € ð ˆr   c                  ó   — y)z`Called after a key has been evicted, with the score it had had at
        the point of eviction.Nr"   r”   s       r   rv   zGenericCache.on_evictë   s   � r   c                 ó  — | j                   }t        |«      }| j                  }t        |«      }||k(  }|�s¨t        j                  d|fd||f«      dt        j                  «       v st        j                  t        «      rt        j                  t        «      nddt        j                  «       v st        j                  | «      rt        j                  | «      ndt        j                  |«      t        j                  |«      dt        j                  «       v st        j                  t        «      rt        j                  t        «      nddt        j                  «       v st        j                  | «      rt        j                  | «      ndt        j                  |«      t        j                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚dx}x}x}x}}t        | j                  «      D �]
  \  }}	| j                   |	j                     }
|
|k(  }|s™t        j                  d|fd	|
|f«      t        j                  |
«      d
t        j                  «       v st        j                  |«      rt        j                  |«      nd
dœz  }dd|iz  }t        t        j                  |«      «      ‚dx}
}|dz  dz   |dz  dz   fD �]3  }|t        | j                  «      k  sŒ|	j                  }| j                  |   }|j                  }||k  }|sát        j                  d|fd||f«      dt        j                  «       v st        j                  |	«      rt        j                  |	«      ndt        j                  |«      t        j                  |«      t        j                  |«      dœz  }t        j                  | j                  «      dz   d|iz  }t        t        j                  |«      «      ‚dx}x}x}}�Œ6 �Œ y)zµDebugging method for use in tests.

        Asserts that all of the cache's invariants hold. When everything
        is working correctly this should be an expensive no-op.
        r?   rA   rB   r   rC   rL   rM   N)z%(py1)s == %(py3)sr<   )rE   rF   úassert %(py5)srG   é   r   rk   rm   r5   ro   z
>assert %(py9)srp   )r-   rB   r1   rN   rO   rP   rQ   rR   rS   rT   rU   r;   r   r   Ú_format_assertmsg)r   rV   rW   rX   rY   rZ   r[   r\   r<   r5   Ú@py_assert0Ú@py_format4Ú@py_format6Újrw   rx   r{   r|   s                     r   Úcheck_validzGenericCache.check_validï   s^  € ð ×'Ñ'Ð:ŒsÐ'Ó(Ð:°·	±	Ð:¬C°	«NÐ:Ð(¨NÑ:×:×:Ö:Ð(¨N×:×:×:×:×:Ñ:Œs×:×:Ó:Œs×:×:×:×:×:Ò:�4×:×:Ó:�4×:×:Ô:Ð'×:×:Ò:Ð(×:×:×:×:×:Ð:¬C×:×:Ó:¬C×:×:×:×:×:Ò:°×:×:Ó:°×:×:Ô:°	×:×:Ò:¨N×:×:×:×:×:×:×:Ü˜dŸi™iÓ(ó 	J‰DˆAˆqØ×'Ñ'¨¯©Ñ.Ð3Ð.°!Ñ3×3×3Õ3Ð.°!×3×3Ó3Ð.×3×3×3×3×3Ð3°!×3×3Ó3°!×3×3×3×3×3×3Ó3Ø˜!‘e˜a‘i  Q¡¨¡Ð+ó J�Ø”s˜4Ÿ9™9“~Ó%ØŸ:™:ÐI¨¯©°1©ÐI¨×)>Ñ)>ÐI˜:Ð)>Ñ>×I×IÕI˜:Ð)>×I×I×I×I×IÑI˜1×I×IÓI˜1×I×IÔI˜:×I×IÒI¨×I×IÒIÐ)>×I×I×IÀÇ	Á	×I×I×I×I×I×IÔIòJñ	Jr   r<   c                 óô   — | j                   |   }| j                  |j                  |j                  |j                  «      }||j                  k7  r)||_        |j
                  dk(  r| j                  |«       y y y ©Nr   )r1   r•   r   r   r   r   ru   )r   r<   rg   Ú	new_scores       r   Ú__entry_was_accessedz!GenericCache.__entry_was_accessedü   sc   € Ø—	‘	˜!‘ˆØ—N‘N 5§9¡9¨e¯k©k¸5¿;¹;ÓGˆ	Ø˜Ÿ™Ò#Ø#ˆEŒKð �z‰z˜QŠØ—‘˜qÕ!ð ð	 $r   rž   c                 ób  — ||k  }|sÆt        j                  d|fd||f«      dt        j                  «       v st        j                  |«      rt        j
                  |«      nddt        j                  «       v st        j                  |«      rt        j
                  |«      nddœz  }dd|iz  }t        t        j                  |«      «      ‚d }| j                  |   }|j                  }| j                  |   }|j                  }	||	k  }
|
s”t        j                  d|
fd||	f«      t        j
                  |«      t        j
                  |«      t        j
                  |«      t        j
                  |	«      d	œz  }d
d|iz  }t        t        j                  |«      «      ‚d x}x}x}
x}}	| j                  |   | j                  |   c| j                  |<   | j                  |<   || j                  | j                  |   j                  <   || j                  | j                  |   j                  <   y )N)ú<)z%(py0)s < %(py2)sr<   rž   )rD   rh   zassert %(py4)sri   )zM%(py3)s
{%(py3)s = %(py1)s.sort_key
} < %(py8)s
{%(py8)s = %(py6)s.sort_key
})rE   rF   rj   rI   úassert %(py10)srJ   )rN   rO   rP   rQ   rR   rS   rT   rU   r1   r   r-   r   )r   r<   rž   rw   Ú@py_format3ry   r›   rV   Ú@py_assert5Ú@py_assert7rW   Ú@py_format9Ú@py_format11s                r   Ú__swapzGenericCache.__swap  sA  € Ø�1‰u���ˆq�1�����‰ˆq��‹ˆq�����Š�1��‹�1������‰Ø�y‰y˜‰|Ð<ˆ|×$Ñ$Ð< t§y¡y°¡|Ð< |×'<Ñ'<Ð<Ð$Ð'<Ñ<×<×<Õ<Ð$Ð'<×<×<Ó<ˆ|×<×<Ò<Ð$×<×<Ò< |×<×<Ò<Ð'<×<×<×<×<×<×<×<Ø%)§Y¡Y¨q¡\°4·9±9¸Q±<Ð"ˆ�	‰	�!‰�d—i‘i ‘lØ12ˆ×Ñ˜TŸY™Y q™\×-Ñ-Ñ.Ø12ˆ×Ñ˜TŸY™Y q™\×-Ñ-Ò.r   c                 óø  ‡ — |dz
  dz  x}dk\  r6‰ j                  ||«      r‰ j                  ||«       |}nn|dz
  dz  x}dk\  rŒ6d|z  dz   d|z  dz   fD �cg c]  }|t        ‰ j                  «      k  sŒ|‘Œ c}x}rst	        |ˆ fd„¬«      }‰ j                  ||«      r‰ j                  ||«       |}nyd|z  dz   d|z  dz   fD �cg c]  }|t        ‰ j                  «      k  sŒ|‘Œ c}x}rŒryyc c}w c c}w )a  When we have made a modification to the heap such that
        the heap property has been violated locally around i but previously
        held for all other indexes (and no other values have been modified),
        this fixes the heap so that the heap property holds everywhere.r   r™   r   c                 ó6   •— ‰j                   |    j                  S r,   )r1   r   )rž   r   s    €r   r6   z(GenericCache.__balance.<locals>.<lambda>  s   ø€ ¸¿¹À1¹×9NÑ9N€ r   r7   N)Ú_GenericCache__out_of_orderÚ_GenericCache__swaprB   r1   Úmin)r   r<   Úparentrž   ÚchildrenÚsmallest_childs   `     r   Ú	__balancezGenericCache.__balance  s  ø€ ð ˜a™% A™Ð%ˆv¨!Ò+Ø×"Ñ" 6¨1Ô-Ø—‘˜F AÔ&Ø‘àð ˜a™% A™Ð%ˆv¨!Ó+ð ()¨1¡u¨q¡y°!°a±%¸!±)Ð&<ÖS ÀÄCÈÏ	É	ÃNÓ@Rš1ÒSÐSˆhÐSÜ  Ó/NÔOˆNØ×"Ñ" 1 nÔ5Ø—‘˜A˜~Ô.Ø"‘àð ()¨1¡u¨q¡y°!°a±%¸!±)Ð&<ÖS ÀÄCÈÏ	É	ÃNÓ@Rš1ÒSÐSˆhÓSùÒSùÒSs   ÁC2Á5C2ÃC7Ã&C7c                 ó‚  — d}||z
  }d}||z  }||k(  }|sît        j                  d|fd||f«      dt        j                  «       v st        j                  |«      rt        j
                  |«      nddt        j                  «       v st        j                  |«      rt        j
                  |«      ndt        j
                  |«      t        j
                  |«      dœz  }dd	|iz  }	t        t        j                  |	«      «      ‚d
x}x}x}x}}| j                  |   j                  | j                  |   j                  k  S )zeReturns True if the indices i, j are in the wrong order.

        i must be the parent of j.
        r   r™   r?   )z+%(py0)s == ((%(py2)s - %(py4)s) // %(py7)s)r<   rž   )rD   rh   ri   rH   r¦   rJ   N)
rN   rO   rP   rQ   rR   rS   rT   rU   r1   r   )
r   r<   rž   rx   r¨   rZ   Ú@py_assert8rw   rª   r«   s
             r   Ú__out_of_orderzGenericCache.__out_of_order"  sÅ   € ð
 Ð �Q˜‘UÐ ˜qÐ �U˜q‘LÐ ˆq�LÑ × × Õ ˆq�L× × × × × Ñ ˆq× × Ó ˆq× × × × × Ò �Q× × Ó �Q× × Ô ˜× × Ò ˜q× × × × × × × Ø�y‰y˜‰|×$Ñ$ t§y¡y°¡|×'<Ñ'<Ñ<Ð<r   ©r   N)%r   r   r   Ú__doc__Ú	__slots__r   r*   r    Údictr	   r-   Úlistr   r
   r1   r=   r]   Úboolr`   re   r}   r€   r‚   r„   r†   r:   Ústrr�   rr   r   r•   rv   rŸ   rb   r°   ru   r¯   r"   r   r   r$   r$   (   sÏ  „ ñð, -€Ið. ó .ð ð5  a¨ f¡ò 5ó ð5ð ð*�d˜5  A ™;Ñ'ò *ó ð*ó2ð˜ó ð
+ ð + dó +ð	˜qð 	 Qó 	ð&E˜qð &E¨ð &E¨tó &EòP*ð�qð  ð  tó ð$˜ð ˜tó ð %˜Qð % 4ó %ó
%ð
S˜#ó Sð"˜Qð " qð "¨Só "ð˜Qð  qð °ð ¸ó ð"˜Að " að "°ð "¸ó "óJð" cð "¨dó "ð3˜ð 3 ð 3¨ó 3ð˜3ð  4ó ð*= ð =¨ð =°ô =r   r$   c                   ód   ‡ — e Zd ZdZdZdefˆ fd„Zdefd„Zdede	de
fd	„Zdede	d
e
de
fd„Zˆ xZS )ÚLRUReusedCachea‹  The only concrete implementation of GenericCache we use outside of tests
    currently.

    Adopts a modified least-recently used eviction policy: It evicts the key
    that has been used least recently, but it will always preferentially evict
    keys that have never been accessed after insertion. Among keys that have been
    accessed, it ignores the number of accesses.

    This retains most of the benefits of an LRU cache, but adds an element of
    scan-resistance to the process: If we end up scanning through a large
    number of keys without reusing them, this does not evict the existing
    entries in preference for the new ones.
    )Ú__tickr&   c                 ó2   •— t         ‰| �  |«       d| _        y r¡   )Úsuperr*   Ú_LRUReusedCache__tick)r   r&   Ú	__class__s     €r   r*   zLRUReusedCache.__init__<  s   ø€ Ü‰Ñ˜Ô"Øˆ�r   r   c                 óD   — | xj                   dz  c_         | j                   S ©Nr   )rÅ   r   s    r   ÚtickzLRUReusedCache.tick@  s   € Ø�Š�qÑ�Ø�{‰{Ðr   r   r   c                 ó&   — d| j                  «       fS rÈ   ©rÉ   r’   s      r   rr   zLRUReusedCache.new_entryD  ó   € Ø�4—9‘9“;ÐÐr   r   c                 ó&   — d| j                  «       fS )Nr™   rË   r”   s       r   r•   zLRUReusedCache.on_accessG  rÌ   r   )r   r   r   rº   r»   r   r*   rÉ   r	   r
   r   rr   r•   Ú__classcell__)rÆ   s   @r   rÁ   rÁ   +  sb   ø„ ñð €Ið õ ð�có ð ˜Qð   qð  ¨Só  ð ˜Qð   qð  °ð  ¸÷  r   rÁ   c                   óŽ   — e Zd ZdZdeddfd„Zedeee	f   fd„«       Z
dede	ddfd	„Zdede	fd
„Zd„ Zdefd„Zdedefd„Zdd„Zy)ÚLRUCachea  
    This is a drop-in replacement for a GenericCache (despite the lack of inheritance)
    in performance critical environments. It turns out that GenericCache's heap
    balancing for arbitrary scores can be quite expensive compared to the doubly
    linked list approach of lru_cache or OrderedDict.

    This class is a pure LRU and does not provide any sort of affininty towards
    the number of accesses beyond recency. If soft-pinning entries which have been
    accessed at least once is important, use LRUReusedCache.
    r&   r   Nc                 ó�  — d}||kD  }|s™t        j                  d|fd||f«      dt        j                  «       v st        j                  |«      rt        j
                  |«      ndt        j
                  |«      dœz  }dd|iz  }t        t        j                  |«      «      ‚d x}}|| _        t        j                  «       | _        y )Nr   )ú>)z%(py0)s > %(py3)sr&   )rD   rF   r˜   rG   )rN   rO   rP   rQ   rR   rS   rT   rU   r&   r(   r)   r%   )r   r&   rV   rw   rœ   r�   s         r   r*   zLRUCache.__init__a  sp   € ØÐˆx˜!‰|××Õˆx˜!×××××Ñˆx××Óˆx××Ô˜!××××××ÑØ ˆŒÜ%ŸO™OÓ-ˆÕr   c                 ó¬   — 	 | j                   j                  S # t        $ r2 t        «       | j                   _        | j                   j                  cY S w xY wr,   )r%   Úcacher.   r   r   s    r   rÔ   zLRUCache.cachef  sJ   € ð	+Ø×$Ñ$×*Ñ*Ð*øÜò 	+Ü&1£mˆD×ÑÔ#Ø×$Ñ$×*Ñ*Ò*ð	+ús   ‚ ˜8AÁAr   r   c                 ó  — || j                   |<   | j                   j                  |«       t        | j                   «      | j                  kD  r@| j                   j	                  d¬«       t        | j                   «      | j                  kD  rŒ?y y )NF)Úlast)rÔ   Úmove_to_endrB   r&   Úpopitemr’   s      r   r}   zLRUCache.__setitem__n  s`   € Øˆ�
‰
�3‰Ø�
‰
×Ñ˜sÔ#ä�$—*‘*‹o §¡Ò-Ø�J‰J×Ñ EÐÔ*ô �$—*‘*‹o §¡Õ-r   c                 óZ   — | j                   |   }| j                   j                  |«       |S r,   )rÔ   r×   )r   r   Úvals      r   re   zLRUCache.__getitem__u  s&   € Ø�j‰j˜‰oˆØ�
‰
×Ñ˜sÔ#Øˆ
r   c                 ó,   — t        | j                  «      S r,   )r   rÔ   r   s    r   r€   zLRUCache.__iter__z  s   € Ü�D—J‘JÓÐr   c                 ó,   — t        | j                  «      S r,   )rB   rÔ   r   s    r   r]   zLRUCache.__len__}  s   € Ü�4—:‘:‹Ðr   c                 ó   — || j                   v S r,   )rÔ   r_   s     r   r`   zLRUCache.__contains__€  s   € Ø�d—j‘jÐ Ð r   c                  ó   — y r,   r"   r   s    r   rŸ   zLRUCache.check_valid„  s   € Ør   r¹   )r   r   r   rº   r   r*   r    r   r	   r
   rÔ   r}   re   r€   r]   r¾   r`   rŸ   r"   r   r   rÐ   rÐ   K  s”   „ ñ	ð*. ð .¨ó .ð
 ð+�{ 1 a 4Ñ(ò +ó ð+ð+˜qð +¨ð +¨tó +ð˜qð  Qó ò
 ð˜ó ð! ð ! dó !ôr   rÐ   )ÚbuiltinsrP   Ú_pytest.assertion.rewriteÚ	assertionÚrewriterN   r(   Úcollectionsr   Údataclassesr   Útypingr   r   r   Úhypothesis.errorsr   r	   r
   r   r$   rÁ   rÐ   r"   r   r   ú<module>rç      s›   ð÷ „ Ó Ý #Ý !ß (Ñ (å -áˆCƒL€ÙˆCƒL€ñ �˜eÔ$ôˆG�A�q�D‰Mó ó %ðô"@=�7˜1˜a˜4‘=ô @=ôF �\ ! Q $Ñ'ô  ô@:ˆw�q˜!�t‰}õ :r   