Ë
   r®Føˆw6ã                   ó6   — d Z ddlZddlmc mZ  G d„ d«      Zy)zKThis module implements various useful common functions for shrinking tasks.é    Nc                   óª   — e Zd ZdZddddœd„Zedefd„«       Zdefd„Z	d	„ Z
d
„ Zd„ Zdeddfd„Zed„ «       Zd„ Zd„ Zd„ Zd„ Zd„ Zdefd„Zd„ Zd„ Zy)ÚShrinkerz A Shrinker object manages a single value and a predicate it should
    satisfy, and attempts to improve it in some direction, making it smaller
    and simpler.FN)ÚfullÚdebugÚnamec                óþ   —  | j                   di |¤Ž | j                  |«      | _        | j                  | _        || _        d| _        || _        || _        | j                  | j                  «      h| _	        || _
        y )Nr   © )ÚsetupÚmake_immutableÚcurrentÚinitialr   Úchangesr   Ú_Shrinker__predicateÚmake_canonicalÚ_Shrinker__seenÚdebugging_enabled)Úselfr   Ú	predicater   r   r   Úkwargss          út/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/hypothesis/internal/conjecture/shrinking/common.pyÚ__init__zShrinker.__init__   sp   € ð 	ˆ�
‰
Ñ�VÒØ×*Ñ*¨7Ó3ˆŒØ—|‘|ˆŒØˆŒ	ØˆŒØˆŒ	à$ˆÔØ×*Ñ*¨4¯<©<Ó8Ð9ˆŒØ!&ˆÕó    Úreturnc                 ó,   — t        | j                  «      S ©N)Úlenr   ©r   s    r   ÚcallszShrinker.calls(   s   € ä�4—;‘;ÓÐr   c                 ó®   — dj                  t        | «      j                  | j                  €dn| j                  ›d�| j                  | j
                  «      S )Nz {}({}initial={!r}, current={!r})Ú z, )ÚformatÚtypeÚ__name__r   r   r   r   s    r   Ú__repr__zShrinker.__repr__,   sI   € Ø1×8Ñ8Ü�‹J×ÑØ—)‘)Ð#‰B¨D¯I©I¨=¸Ð);Ø�L‰LØ�L‰Ló	
ð 	
r   c                  ó   — y)z�Runs initial setup code.

        Convenience function for children that doesn't require messing
        with the signature of init.
        Nr	   )r   Úargsr   s      r   r
   zShrinker.setup4   ó   � r   c                 óZ   ‡ ‡—  ‰ j                   | |‰ j                  «      ˆˆ fd„fi |¤Ž y)z~Delegates shrinking to another shrinker class, by converting the
        current value to and from it with provided functions.c                 ó2   •— ‰j                   ‰| «      «      S r   )Úconsider)ÚvÚconvert_fromr   s    €€r   ú<lambda>z#Shrinker.delegate.<locals>.<lambda>A   s   ø€ �d—m‘m¡L°£OÓ4€ r   N)Úcall_shrinkerr   )r   Úother_classÚ
convert_tor,   r   s   `  ` r   ÚdelegatezShrinker.delegate;   s1   ù€ ð 	ˆ×ÑØÙ�t—|‘|Ó$Ü4ñ	
ð ó		
r   c                 ó*   —  |j                   ||fi |¤ŽS )z”Calls another shrinker class, passing through the relevant context
        variables.

        Note we explicitly do not pass through full.
        )Úshrink)r   r/   r   r   r   s        r   r.   zShrinker.call_shrinkerE   s   € ð "ˆ{×!Ñ! '¨9Ñ?¸Ñ?Ð?r   r&   c                 ó8   — | j                   rt        d| g|¢­Ž  y y )NÚDEBUG)r   Úprint)r   r&   s     r   r   zShrinker.debugN   s   € Ø×!Ò!Ü�'˜4Ð' $Ô'ð "r   c                 óN   —  | ||fi |¤Ž}|j                  «        |j                  S )z‹Shrink the value ``initial`` subject to the constraint that it
        satisfies ``predicate``.

        Returns the shrunk value.
        )Úrunr   )Úclsr   r   r   Úshrinkers        r   r3   zShrinker.shrinkR   s*   € ñ �w 	Ñ4¨VÑ4ˆØ�‰ŒØ×ÑÐr   c                 óü   — | j                  «       ry| j                  r>d}| j                  |k7  r=| j                  }| j                  «        | j                  |k7  rŒ,n| j                  «        | j	                  d«       y)z©Run for an appropriate number of steps to improve the current value.

        If self.full is True, will run until no further improvements can
        be found.
        NéÿÿÿÿÚCOMPLETE)Úshort_circuitr   r   Úrun_stepr   )r   Úprevs     r   r8   zShrinker.run]   sb   € ð ×ÑÔØØ�9Š9ØˆDØ—,‘, $Ò&Ø—|‘|�Ø—‘”ð —,‘, $Ô&ð �M‰MŒOØ�
‰
�:Õr   c                 óN  — | j                  |«      }| j                  d|›�«       | j                  |«      }|| j                  | j                  «      k(  ry|| j                  v ry| j                  j                  |«       | j                  |«       | j                  || j                  «      s"| j                  d|›d| j                  ›�«       y| j                  |«      r1| j                  d|›�«       | xj                  dz  c_	        || _        y| j                  d|›d�«       y)	zþTry using ``value`` as a possible candidate improvement.

        Return True if self.current is canonically equal to value after the call, either because
        the value was incorporated as an improvement or because it had that value already.
        zconsidering TFz	Rejected z  as no better than self.current=zshrinking to é   z not satisfying predicate)
r   r   r   r   r   ÚaddÚcheck_invariantsÚleft_is_betterr   r   )r   ÚvalueÚ	canonicals      r   r*   zShrinker.considern   s  € ð ×#Ñ# EÓ*ˆØ�
‰
�\ % Ð+Ô,Ø×'Ñ'¨Ó.ˆ	Ø˜×+Ñ+¨D¯L©LÓ9Ò9ØØ˜Ÿ™Ñ#ØØ�‰�‰˜	Ô"Ø×Ñ˜eÔ$Ø×"Ñ" 5¨$¯,©,Ô7Ø�J‰J˜ 5 )Ð+L¸t¿|¹|¸oÐNÔOØØ×Ñ˜EÔ"Ø�J‰J˜ u iÐ0Ô1Ø�LŠL˜AÑ�LØ ˆDŒLØà�J‰J˜ 5 )Ð+DÐEÔFØr   c                 ó   — |S )a-  Convert immutable value into a canonical and hashable, but not necessarily equal,
        representation of itself.

        This representation is used only for tracking already-seen values, not passed to the
        shrinker.

        Defaults to just returning the (immutable) input value.
        r	   ©r   rF   s     r   r   zShrinker.make_canonical‰   s	   € ð ˆr   c                 ó   — |S )z¹Convert value into an immutable representation of itself.

        It is these immutable versions that the shrinker will work on.

        Defaults to just returning the value.
        r	   rI   s     r   r   zShrinker.make_immutable”   s	   € ð ˆr   c                  ó   — y)zŒMake appropriate assertions about the value to ensure that it is
        valid for this shrinker.

        Does nothing by default.
        Nr	   rI   s     r   rD   zShrinker.check_invariants�   r'   r   c                  ó   — y)z›Possibly attempt to do some shrinking.

        If this returns True, the ``run`` method will terminate early
        without doing any more work.
        Fr	   r   s    r   r>   zShrinker.short_circuit¤   s   € ð r   c                 ó   — t         ‚)zpReturns True if the left is strictly simpler than the right
        according to the standards of this shrinker.©ÚNotImplementedError)r   ÚleftÚrights      r   rE   zShrinker.left_is_better¬   ó
   € ô "Ð!r   c                 ó   — t         ‚)z[Run a single step of the main shrink loop, attempting to improve the
        current value.rN   r   s    r   r?   zShrinker.run_step±   rR   r   )r#   Ú
__module__Ú__qualname__Ú__doc__r   ÚpropertyÚintr   Ústrr$   r
   r1   r.   Úobjectr   Úclassmethodr3   r8   r*   r   r   rD   Úboolr>   rE   r?   r	   r   r   r   r      s¤   „ ñð ØØô'ð* ð �sò  ó ð ð
˜#ó 
òò
ò@ð(˜6ð ( dó (ð ñ ó ð òò"ò6	òòð˜tó ò"ó
"r   r   )rV   ÚbuiltinsÚ@py_builtinsÚ_pytest.assertion.rewriteÚ	assertionÚrewriteÚ
@pytest_arr   r	   r   r   ú<module>rc      s   ðñ R÷ „ ÷ f"ò f"r   