Ë
    iKêjC ã                   óê  — U d dl Z d dlZd dlmZ d dlmZmZmZ d dlm	Z	 d dl
mZ d dlmZmZmZmZmZ d dlmZmZmZmZmZmZmZmZmZ d dlmZmZmZm Z m!Z!m"Z"m#Z# d d	l$m%Z%m&Z&m'Z'm(Z( d d
l)m*Z*m+Z+m,Z,m-Z-m.Z. d dl/m0Z0m1Z1m2Z2 d dl3m4Z4 erd dl5m6Z6 d dl7m8Z8 eee!z  ge9f   Z:ee;d<   dee   de<e=e<e=df   f   fd„Z> ed¬«      d„ «       Z? e	dd¬«       G d„ d«      «       Z@ G d„ deA«      ZB G d„ d«      ZCy) é    N)Údefaultdict)ÚCallableÚIteratorÚSequence)Ú	dataclass)Ú	lru_cache)ÚTYPE_CHECKINGÚAnyÚLiteralÚ	TypeAliasÚcast)	Ú
ChoiceNodeÚChoiceTÚ	ValueHoleÚchoice_equalÚchoice_from_indexÚ
choice_keyÚchoice_permittedÚchoice_to_indexÚchoices_key)ÚConjectureDataÚConjectureResultÚSpansÚStatusÚ_OverrunÚdraw_choiceÚno_recorded_value)ÚendswithÚfind_integerÚreplace_allÚ
startswith)ÚBytesÚFloatÚIntegerÚOrderingÚString)Ú
ChoiceTreeÚprefix_selection_orderÚrandom_selection_order)ÚMAX_PRECISE_INTEGER)ÚRandom)ÚConjectureRunnerÚShrinkPredicateTÚnodesÚreturn.c                 ó<   — t        | «      t        d„ | D «       «      fS )ai  Returns a sort key such that "simpler" choice sequences are smaller than
    "more complicated" ones.

    We define sort_key so that x is simpler than y if x is shorter than y or if
    they have the same length and map(choice_to_index, x) < map(choice_to_index, y).

    The reason for using this ordering is:

    1. If x is shorter than y then that means we had to make fewer decisions
       in constructing the test case when we ran x than we did when we ran y.
    2. If x is the same length as y then replacing a choice with a lower index
       choice corresponds to replacing it with a simpler/smaller choice.
    3. Because choices drawn early in generation potentially get used in more
       places they potentially have a more significant impact on the final
       result, so it makes sense to prioritise reducing earlier choices over
       later ones.
    c              3   ó\   K  — | ]$  }t        |j                  |j                  «      –— Œ& y ­w©N)r   ÚvalueÚconstraints©Ú.0Únodes     úl/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/hypothesis/internal/conjecture/shrinker.pyú	<genexpr>zsort_key.<locals>.<genexpr>]   s!   è ø€ ÒNÀŒo˜dŸj™j¨$×*:Ñ*:×;ÑNùs   ‚*,)ÚlenÚtuple)r.   s    r8   Úsort_keyr<   I   s#   € ô& 	ˆE‹
ÜÑNÈÔNÓNðð ó    i   )Úmaxsizec                 ó¨  ‡— t        «       }dD ]'  }|j                  t        j                  || «      «       Œ) | j	                  «       | j                  «       | j                  «       fD ]  }|j                  |«       Œ |j                  | «       ‰j                  | «      }t        ˆfd„|D «       «      }|D ��cg c]  \  }}||k  sŒ|‘Œ c}}S c c}}w )uU  Return single-char replacements for ``c`` derived from natural text
    transformations - case mapping (upper, lower, casefold) and unicode
    decomposition (NFD, NFKD). We take each individual character of the
    transformed form so that e.g. ``ÃŸ`` can shrink to ``s`` via casefold
    even though the full case-folded form is two characters.

    Only candidates which are in ``intervals`` and which have a strictly
    smaller index in shrink order than ``c`` are returned, sorted by that
    shrink-order index. Callers must pass a single character that is itself
    in ``intervals``.
    )ÚNFKDÚNFDc              3   óL   •K  — | ]  }|‰v r‰j                  |«      |f–— Œ y ­wr2   )Úindex_from_char_in_shrink_order)r6   ÚcandÚ	intervalss     €r8   r9   z)_natural_simpler_chars.<locals>.<genexpr>u   s1   øè ø€ ò àØ�9Ñð 
×	2Ñ	2°4Ó	8¸$Ô?ñùs   ƒ!$)
ÚsetÚupdateÚunicodedataÚ	normalizeÚupperÚlowerÚcasefoldÚdiscardrC   Úsorted)	ÚcrE   Ú
candidatesÚformÚtransformedÚoriginal_idxÚresultÚidxrD   s	    `       r8   Ú_natural_simpler_charsrV   a   sÂ   ø€ ô ›5€JØò :ˆØ×Ñœ+×/Ñ/°°aÓ8Õ9ð:àŸ™›	 1§7¡7£9¨a¯j©j«lÐ;ò 'ˆØ×Ñ˜+Õ&ð'à×Ñ�qÔØ×<Ñ<¸QÓ?€LÜó àôó €Fð
 #)×?‘Y�S˜$¨C°,Ó,>ŠDÓ?Ð?ùÓ?s   Â8CÃCTF)ÚslotsÚfrozenc                   ó~   — e Zd ZU eed<   dZedz  ed<   dZeed<   dZe	ed<   dZ
e	ed<   dZe	ed	<   dZe	ed
<   d„ Zd„ Zy)Ú
ShrinkPassÚfunctionNÚname© Úlast_prefixr   ÚcallsÚ
misalignedÚshrinksÚ	deletionsc                 óT   — | j                   €| j                  j                  | _         y y r2   )r\   r[   Ú__name__©Úselfs    r8   Ú__post_init__zShrinkPass.__post_init__‰   s"   € Ø�9‰9ÐØŸ™×.Ñ.ˆD�Ið r=   c                 ó,   — t        | j                  «      S r2   )Úhashr\   re   s    r8   Ú__hash__zShrinkPass.__hash__�   s   € Ü�D—I‘I‹Ðr=   )rd   Ú
__module__Ú__qualname__r
   Ú__annotations__r\   Ústrr^   r_   Úintr`   ra   rb   rg   rj   r]   r=   r8   rZ   rZ   }   sR   … àƒMØ€Dˆ#�‰*ÓØ€K�Óð €Eˆ3ƒNØ€J�ÓØ€GˆSÓØ€IˆsÓò/ór=   rZ   c                   ó   — e Zd Zy)ÚStopShrinkingN)rd   rk   rl   r]   r=   r8   rq   rq   ‘   s   „ Ør=   rq   c                   óâ  — e Zd ZdZd„ Zddœdddeez  ded	z  d
eeez  ege	f   d	z  de	de	fd„Z
ed„ «       Zd„ Zedefd„«       Zedefd„«       ZdKd„Zdee   dee	eez  d	z  f   fd„Zdee   de	fd„Zd„ Zdedd	fd„ZedLd„«       ZdKd„ZdKd„ZdKd„Zdededd fd!„ZdKd"„Z d#„ Z!ed$„ «       Z"d%„ Z#d&„ Z$ede%e&e'f   fd'„«       Z(dd(œd)e)d*e	de	fd+„Z*d,e+e)   dd	fd-„Z,edeed.f   fd/„«       Z-edee.d.f   fd0„«       Z/ede0fd1„«       Z1ed2„ «       Z2ed3„ «       Z3d4„ Z4d5„ Z5d6„ Z6d7„ Z7ede8e   fd8„«       Z9d9„ Z:d:„ Z;d;„ Z<ed<„ «       Z=d=ede)fd>„Z>d?„ Z?d@„ Z@dA„ ZAdB„ ZBdC„ ZCdD„ ZDdE„ ZEdF„ ZFdG„ ZGdH„ ZHdI„ ZIdMdJ„ZJy	)NÚShrinkeraŒ  A shrinker is a child object of a ConjectureRunner which is designed to
    manage the associated state of a particular shrink problem. That is, we
    have some initial ConjectureData object and some property of interest
    that it satisfies, and we want to find a ConjectureData object with a
    shortlex (see sort_key above) smaller choice sequence that exhibits the same
    property.

    Currently the only property of interest we use is that the status is
    INTERESTING and the interesting_origin takes on some fixed value, but we
    may potentially be interested in other use cases later.
    However we assume that data with a status < VALID never satisfies the predicate.

    The shrinker keeps track of a value shrink_target which represents the
    current best known ConjectureData object satisfying the predicate.
    It refines this value by repeatedly running *shrink passes*, which are
    methods that perform a series of transformations to the current shrink_target
    and evaluate the underlying test function to find new ConjectureData
    objects. If any of these satisfy the predicate, the shrink_target
    is updated automatically. Shrinking runs until no shrink pass can
    improve the shrink_target, at which point it stops. It may also be
    terminated if the underlying engine throws RunIsComplete, but that
    is handled by the calling code rather than the Shrinker.

    =======================
    Designing Shrink Passes
    =======================

    Generally a shrink pass is just any function that calls
    cached_test_function and/or consider_new_nodes a number of times,
    but there are a couple of useful things to bear in mind.

    A shrink pass *makes progress* if running it changes self.shrink_target
    (i.e. it tries a shortlex smaller ConjectureData object satisfying
    the predicate). The desired end state of shrinking is to find a
    value such that no shrink pass can make progress, i.e. that we
    are at a local minimum for each shrink pass.

    In aid of this goal, the main invariant that a shrink pass much
    satisfy is that whether it makes progress must be deterministic.
    It is fine (encouraged even) for the specific progress it makes
    to be non-deterministic, but if you run a shrink pass, it makes
    no progress, and then you immediately run it again, it should
    never succeed on the second time. This allows us to stop as soon
    as we have run each shrink pass and seen no progress on any of
    them.

    This means that e.g. it's fine to try each of N deletions
    or replacements in a random order, but it's not OK to try N random
    deletions (unless you have already shrunk at least once, though we
    don't currently take advantage of this loophole).

    Shrink passes need to be written so as to be robust against
    change in the underlying shrink target. It is generally safe
    to assume that the shrink target does not change prior to the
    point of first modification - e.g. if you change no bytes at
    index ``i``, all spans whose start is ``<= i`` still exist,
    as do all blocks, and the data object is still of length
    ``>= i + 1``. This can only be violated by bad user code which
    relies on an external source of non-determinism.

    When the underlying shrink_target changes, shrink
    passes should not run substantially more test_function calls
    on success than they do on failure. Say, no more than a constant
    factor more. In particular shrink passes should not iterate to a
    fixed point.

    This means that shrink passes are often written with loops that
    are carefully designed to do the right thing in the case that no
    shrinks occurred and try to adapt to any changes to do a reasonable
    job. e.g. say we wanted to write a shrink pass that tried deleting
    each individual choice (this isn't an especially good pass,
    but it leads to a simple illustrative example), we might do it
    by iterating over the choice sequence like so:

    .. code-block:: python

        i = 0
        while i < len(self.shrink_target.nodes):
            if not self.consider_new_nodes(
                self.shrink_target.nodes[:i] + self.shrink_target.nodes[i + 1 :]
            ):
                i += 1

    The reason for writing the loop this way is that i is always a
    valid index into the current choice sequence, even if the current sequence
    changes as a result of our actions. When the choice sequence changes,
    we leave the index where it is rather than restarting from the
    beginning, and carry on. This means that the number of steps we
    run in this case is always bounded above by the number of steps
    we would run if nothing works.

    Another thing to bear in mind about shrink pass design is that
    they should prioritise *progress*. If you have N operations that
    you need to run, you should try to order them in such a way as
    to avoid stalling, where you have long periods of test function
    invocations where no shrinks happen. This is bad because whenever
    we shrink we reduce the amount of work the shrinker has to do
    in future, and often speed up the test function, so we ideally
    wanted those shrinks to happen much earlier in the process.

    Sometimes stalls are inevitable of course - e.g. if the pass
    makes no progress, then the entire thing is just one long stall,
    but it's helpful to design it so that stalls are less likely
    in typical behaviour.

    The two easiest ways to do this are:

    * Just run the N steps in random order. As long as a
      reasonably large proportion of the operations succeed, this
      guarantees the expected stall length is quite short. The
      book keeping for making sure this does the right thing when
      it succeeds can be quite annoying.
    * When you have any sort of nested loop, loop in such a way
      that both loop variables change each time. This prevents
      stalls which occur when one particular value for the outer
      loop is impossible to make progress on, rendering the entire
      inner loop into a stall.

    However, although progress is good, too much progress can be
    a bad sign! If you're *only* seeing successful reductions,
    that's probably a sign that you are making changes that are
    too timid. Two useful things to offset this:

    * It's worth writing shrink passes which are *adaptive*, in
      the sense that when operations seem to be working really
      well we try to bundle multiple of them together. This can
      often be used to turn what would be O(m) successful calls
      into O(log(m)).
    * It's often worth trying one or two special minimal values
      before trying anything more fine grained (e.g. replacing
      the whole thing with zero).

    c                 óF   ‡ — ˆ fd„}‰ j                   |_         t        |«      S )a2  It's useful during shrinking to have access to derived values of
        the current shrink target.

        This decorator allows you to define these as cached properties. They
        are calculated once, then cached until the shrink target changes, then
        recalculated the next time they are used.c                 ó®   •— 	 | j                   ‰j                     S # t        $ r/ | j                   j                  ‰j                   ‰| «      «      cY S w xY wr2   )Ú_Shrinker__derived_valuesrd   ÚKeyErrorÚ
setdefault)rf   Úfns    €r8   Úacceptz&Shrinker.derived_value.<locals>.accept$  sP   ø€ ðOØ×,Ñ,¨R¯[©[Ñ9Ð9øÜò OØ×,Ñ,×7Ñ7¸¿¹ÁRÈÃXÓNÒNðOús   ƒ œ5AÁA)rd   Úproperty)ry   rz   s   ` r8   Úderived_valuezShrinker.derived_value  s!   ø€ ô	Oð Ÿ+™+ˆŒÜ˜ÓÐr=   F)Úin_target_phaseÚenginer,   ÚinitialÚ	predicateNÚallow_transitionÚexplainr}   c                óÊ  — |€|€J ‚|| _         |xs d„ | _        |xs d„ | _        i | _        t	        |j
                  «      | _        || _        | j                  «        d| _	        d| _
        | j                   j                  | _        | j                   j                  | _        | j                  | _        t!        | j"                  «      | j%                  d«      | j%                  d«      | j%                  d«      | j%                  d	«      | j%                  d
«      t!        | j&                  «      t!        | j(                  «      t!        | j*                  «      t!        | j,                  «      t!        | j.                  «      t!        | j0                  «      t!        | j2                  «      t!        | j4                  «      t!        | j6                  «      g| _        |rdnd| _        || _        y)ae  Create a shrinker for a particular engine, with a given starting
        point and predicate. When shrink() is called it will attempt to find a
        test case for which predicate is True and which is strictly smaller than
        initial.

        Note that initial is a ConjectureData object, and predicate
        takes ConjectureData objects.
        Nc                  ó   — y©NTr]   )Údatas    r8   ú<lambda>z#Shrinker.__init__.<locals>.<lambda>C  ó   � r=   c                  ó   — yr…   r]   )ÚsourceÚdestinations     r8   r‡   z#Shrinker.__init__.<locals>.<lambda>D  rˆ   r=   r   éÈ   ÚXXXXXÚXXXXÚXXXÚXXÚXÚfull)r~   Ú_Shrinker__predicateÚ_Shrinker__allow_transitionrv   r:   ÚchoicesÚinitial_sizeÚshrink_targetÚclear_change_trackingra   Ú	max_stallÚ
call_countÚinitial_callsÚmisaligned_countÚinitial_misalignedÚcalls_at_last_shrinkrZ   Útry_trivial_spansÚnode_programÚpass_to_descendantÚreorder_spansÚminimize_duplicated_choicesÚminimize_individual_choicesÚredistribute_numeric_pairsÚlower_integers_togetherÚlower_duplicated_charactersÚnormalize_unicode_charsÚ!widen_to_span_with_recorded_valueÚshrink_passesÚ_Shrinker__extendÚshould_explain)rf   r~   r   r€   r�   r‚   r}   s          r8   Ú__init__zShrinker.__init__-  sž  € ð( Ð$Ð(8Ð(DÐDÐDØˆŒØ$Ò;Ñ):ˆÔØ"2Ò"XÑ7WˆÔØ&(ˆÔä §¡Ó0ˆÔð %ˆÔØ×"Ñ"Ô$ØˆŒð ˆŒØ!Ÿ[™[×3Ñ3ˆÔØ"&§+¡+×">Ñ">ˆÔØ$(×$6Ñ$6ˆÔ!ô �t×-Ñ-Ó.Ø×Ñ˜gÓ&Ø×Ñ˜gÓ&Ø×Ñ˜gÓ&Ø×Ñ˜gÓ&Ø×Ñ˜gÓ&Ü�t×.Ñ.Ó/Ü�t×)Ñ)Ó*Ü�t×7Ñ7Ó8Ü�t×7Ñ7Ó8Ü�t×6Ñ6Ó7Ü�t×3Ñ3Ó4Ü�t×7Ñ7Ó8Ü�t×3Ñ3Ó4Ü�t×=Ñ=Ó>ð0
ˆÔñ( :I©vÈaˆŒØ%ˆÕr=   c                 ó   — i S r2   r]   re   s    r8   Úcached_calculationszShrinker.cached_calculationsn  s   € àˆ	r=   c                 ó   ‡ ‡— ˆˆ fd„}|S )Nc                 ó¤   •— | j                   g‰¢­}	 ‰j                  |   S # t        $ r$ ‰j                  j                  | | «       «      cY S w xY wr2   )rd   r¯   rw   rx   )ÚfÚ	cache_keyÚkeysrf   s     €€r8   rz   zShrinker.cached.<locals>.accepts  sW   ø€ ØŸ™Ð+ dÑ+ˆIðKØ×/Ñ/°	Ñ:Ð:øÜò KØ×/Ñ/×:Ñ:¸9ÁaÃcÓJÒJðKús   “" ¢*AÁAr]   )rf   r´   rz   s   `` r8   ÚcachedzShrinker.cachedr  s   ù€ õ	Kð ˆr=   r/   c                 ó.   — | j                   j                  S )zWReturn the number of calls that have been made to the underlying
        test function.)r~   rš   re   s    r8   r_   zShrinker.calls|  s   € ð �{‰{×%Ñ%Ð%r=   c                 ó.   — | j                   j                  S r2   )r~   rœ   re   s    r8   r`   zShrinker.misaligned‚  s   € à�{‰{×+Ñ+Ð+r=   c                 ó\   — | j                   | j                  z
  | j                  k\  rt        ‚y r2   )r_   rž   r™   rq   re   s    r8   Úcheck_callszShrinker.check_calls†  s)   € Ø�:‰:˜×1Ñ1Ñ1°T·^±^ÒCÜÐð Dr=   r.   c                 óÌ  — |d t        | j                  «       }t        || j                  «      ryt        d„ |D «       «      ryt	        | j                  «      t	        |«      k  ry| j
                  j                  |D �cg c]  }|j                  ‘Œ c}| j                  ¬«      }| j                  }| j                  |«       | j                  «        || j                  u|fS c c}w )N)TNc              3   ó^   K  — | ]%  }t        |j                  |j                  «       –— Œ' y ­wr2   )r   r3   r4   r5   s     r8   r9   z0Shrinker.cached_test_function.<locals>.<genexpr>”  s%   è ø€ ÒTÀdÔ# D§J¡J°×0@Ñ0@ÓAÔAÑTùs   ‚+-)FN©Úextend)r:   r.   r!   Úanyr<   r~   Úcached_test_functionr3   r«   r—   Úincorporate_test_datar¹   )rf   r.   ÚnrT   Úpreviouss        r8   r¿   zShrinker.cached_test_functionŠ  sÊ   € ð Ð'œ˜DŸJ™J›Ð(ˆä�e˜TŸZ™ZÔ(Øô ÑTÈeÔTÔTØ ô �D—J‘JÓ¤(¨5£/Ò1Ø à—‘×1Ñ1Ø#Ö$˜ˆQ�W‹WÒ$¨T¯]©]ð 2ó 
ˆð ×%Ñ%ˆØ×"Ñ" 6Ô*Ø×ÑÔØ × 2Ñ 2Ð2°FÐ;Ð;ùò %s   Á>C!c                 ó*   — | j                  |«      d   S ©Nr   )r¿   )rf   r.   s     r8   Úconsider_new_nodeszShrinker.consider_new_nodes¤  s   € Ø×(Ñ(¨Ó/°Ñ2Ð2r=   c                 óH  — |j                   t        j                  k  s|| j                  u ry| j	                  |«      ret        |j                  «      t        | j                  j                  «      k  r/| j                  | j                  |«      r| j                  |«       yyyy)z‚Takes a ConjectureData or Overrun object updates the current
        shrink_target if this data represents an improvement over it.N)	Ústatusr   ÚVALIDr—   r“   r<   r.   r”   Úupdate_shrink_target)rf   r†   s     r8   rÀ   zShrinker.incorporate_test_data§  s‰   € ð �;‰;œŸ™Ò%¨°×1CÑ1CÑ)CØà×Ñ˜TÔ"Ü˜Ÿ™Ó$¤x°×0BÑ0B×0HÑ0HÓ'IÒIØ×'Ñ'¨×(:Ñ(:¸DÔAà×%Ñ% dÕ+ð Bð Jð #r=   Úmsgc                 ó:   — | j                   j                  |«       y r2   )r~   Údebug)rf   rÊ   s     r8   rÌ   zShrinker.debug³  s   € Ø�‰×Ñ˜#Õr=   c                 ó.   — | j                   j                  S r2   )r~   Úrandomre   s    r8   rÎ   zShrinker.random¶  s   € à�{‰{×!Ñ!Ð!r=   c                 ó2  — 	 | j                  «        | j                  «        | j                  j
                  �rÎd„ }| j                  t        | j                  j                  «      z
  }| j                  j                  | j                  z
  }| j                  j                  | j                  z
  }| j                  d|› d ||«      › d| j                  › d|› d|› d| j                  › d	�«       d
D �]  }| j                  d«       |r| j                  d«       n| j                  d«       | j                  d«       t!        | j"                  d„ ¬«      D ]ž  }|j$                  dk(  rŒ|j                  dk7  |k7  rŒ&| j                  d|j&                  › d|j$                  › d ||j$                  «      › d|j                  › d|j(                  › d|j*                  › d ||j*                  «      › d	�«       Œ  �Œ | j                  d«       	 | j-                  «        y# t        $ r d| _        Y �Œ	w xY w# | j                  j
                  �rÎd„ }| j                  t        | j                  j                  «      z
  }| j                  j                  | j                  z
  }| j                  j                  | j                  z
  }| j                  d|› d ||«      › d| j                  › d|› d|› d| j                  › d	�«       d
D �]  }| j                  d«       |r| j                  d«       n| j                  d«       | j                  d«       t!        | j"                  d„ ¬«      D ]ž  }|j$                  dk(  rŒ|j                  dk7  |k7  rŒ&| j                  d|j&                  › d|j$                  › d ||j$                  «      › d|j                  › d|j(                  › d|j*                  › d ||j*                  «      › d	�«       Œ  �Œ | j                  d«       w w xY w)z×Run the full set of shrinks and update shrink_target.

        This method is "mostly idempotent" - calling it twice is unlikely to
        have any effect, though it has a non-zero probability of doing so.
        Fc                 ó   — | dk7  rdS dS )Né   ÚsÚ r]   ©rÁ   s    r8   rÒ   zShrinker.shrink.<locals>.sË  s   € Ø"# q¢&˜3Ð0¨bÐ0r=   z]---------------------
Shrink pass profiling
---------------------

Shrinking made a total of z callz
 of which z shrank and z were misaligned. This deleted z choices out of ú.)TFrÓ   zUseful passes:zUseless passes:c                 óJ   — | j                    | j                  | j                  fS r2   )r_   rb   ra   )Úts    r8   r‡   z!Shrinker.shrink.<locals>.<lambda>ã  s   € ¨¯© x°·±¸a¿i¹iÐ&H€ r=   ©Úkeyr   z  * z made z were misaligned, deleting z choiceN)Úinitial_coarse_reductionÚgreedy_shrinkrq   r¬   r~   Úreport_debug_infor–   r:   r—   r•   rš   r›   rœ   r�   rÌ   ra   rN   rª   r_   r\   r`   rb   r‚   )rf   rÒ   Útotal_deletedr_   r`   ÚusefulÚpass_s          r8   ÚshrinkzShrinker.shrinkº  sÙ  € ð.	Ø×)Ñ)Ô+Ø×ÑÔ ð �{‰{×,Ó,ò1ð !%× 1Ñ 1´C¸×8JÑ8J×8RÑ8RÓ4SÑ S�ØŸ™×.Ñ.°×1CÑ1CÑC�Ø!Ÿ[™[×9Ñ9¸D×<SÑ<SÑS�
à—
‘
ð1ð 27°°u¹Q¸u»X¸JÀjØ—|‘|�n L°°ð =Ø,˜oÐ-=¸d×>OÑ>OÐ=PÐPQðSôð ,ó �FØ—J‘J˜r”NÙØŸ
™
Ð#3Õ4àŸ
™
Ð#4Ô5Ø—J‘J˜r”NÜ!'Ø×*Ñ*ÙHô"ò ˜ð !Ÿ;™;¨!Ò+Ø$Ø!ŸM™M¨QÑ.°6Ò9Ø$àŸ
™
Ø" 5§:¡: ,¨f°U·[±[°MÀÁqÈÏÉÃ~ÐFVÐV`Ø$Ÿ}™}˜o¨\¸%×:JÑ:JÐ9Kð L(Ø(-¯©Ð'8¸ÁÀ%Ç/Á/Ó@RÐ?SÐSTðVõòðð* —
‘
˜2•Ø�‰�øôY ò 	(ð #(ˆD×ð	(ûð
 �{‰{×,Ó,ò1ð !%× 1Ñ 1´C¸×8JÑ8J×8RÑ8RÓ4SÑ S�ØŸ™×.Ñ.°×1CÑ1CÑC�Ø!Ÿ[™[×9Ñ9¸D×<SÑ<SÑS�
à—
‘
ð1ð 27°°u¹Q¸u»X¸JÀjØ—|‘|�n L°°ð =Ø,˜oÐ-=¸d×>OÑ>OÐ=PÐPQðSôð ,ó �FØ—J‘J˜r”NÙØŸ
™
Ð#3Õ4àŸ
™
Ð#4Ô5Ø—J‘J˜r”NÜ!'Ø×*Ñ*ÙHô"ò ˜ð !Ÿ;™;¨!Ò+Ø$Ø!ŸM™M¨QÑ.°6Ò9Ø$àŸ
™
Ø" 5§:¡: ,¨f°U·[±[°MÀÁqÈÏÉÃ~ÐFVÐV`Ø$Ÿ}™}˜o¨\¸%×:JÑ:JÐ9Kð L(Ø(-¯©Ð'8¸ÁÀ%Ç/Á/Ó@RÐ?SÐSTðVõòðð* —
‘
˜2•ðM -ús$   ‚ H ÈH,È(H/ È+H,È,H/ È/G'Pc                 óÊ   — | j                   r| j                  j                  sy | j                  j	                  d«      5  | j                  «        d d d «       y # 1 sw Y   y xY w)Nr‚   )r¬   r—   Ú	arg_spansr~   Ú_log_phase_statisticsÚ_explainre   s    r8   r‚   zShrinker.explainò  sL   € Ø×"Ò"¨$×*<Ñ*<×*FÒ*FØØ�[‰[×.Ñ.¨yÓ9ñ 	Ø�M‰MŒO÷	÷ 	ñ 	ús   ¿AÁA"c           	      óh  ‡ ‡‡‡‡‡— ddz  ‰ _         ‰ j                  }‰ j                  Š‰ j                  }‰ j                  j                  Št        t        «      }‰ j                  j                  D �ci c]!  }|‰|   j                  ‰|   j                  f“Œ# c}Š‰ j                  j                  ‰ j                  d t        d„ ‰j                  «       D «       «       ¬«      }t        ‰j                  «       d„ ¬«      D �]¹  \  }\  ŠŠt!        ˆfd„t#        ‰‰«      D «       «      rŒ)t%        ˆˆˆfd„|D «       «      rŒ@t%        ˆˆˆfd	„‰ j                  j&                  D «       «      rŒkt        ‰ j)                  ‰‰«      «      }d
}d}t#        dt+        |«      z   «      D �]  }	|	dz
  t+        |«      z
  |dz  kD  r Œ¾|	t+        |«      k  rt        ||	   «      }
n}g }
t#        ‰‰«      D ]l  }‰|   }|j,                  s>t/        |j0                  |j2                  ‰ j4                  ¬«      }|j7                  |¬«      }|
j9                  |j:                  «       Œn |d ‰ t=        |
«      z   |‰d  z   }‰ j                  j?                  |d¬«      }|j@                  tB        jD                  u r�Œ	tG        tH        |«      }t+        |«      t+        |j                  «      k(  rtK        |j                  ‰‰d  «      �stM        |j                  |j                  d¬«      D ]^  \  }}|j                  |j                  k(  sJ ‚|j                  ‰k  sJ ‚|j                  ‰k(  sŒB|j                  ‰k(  sŒR|j                  } n tO        d«      ‚|d ‰ |j                  ‰| z   |‰d  z   }||   j9                  |j                  ‰| «       ‰ j                  j?                  |«      }|j@                  tB        jD                  u r�ŒWtG        tH        |«      }n!||   j9                  |j                  ‰‰ «       |‰ j                  ur'‰ j                  j&                  jQ                  «          y |j@                  tB        jR                  u r �Œ~‰ jU                  |«      s�Œð|dz  }|dk\  s�Œü|‰ j                  j&                  |<    �Œ¹ �Œ¼ t+        ‰ j                  j&                  «      dk  ry d
}t        ˆˆ fd„|j                  «       D «       «      }t#        d«      D �]  }g }d
}|D ]b  \  \  ŠŠ}|‰cxk  r‰k  sJ d«       ‚ J d«       ‚|jW                  ||‰ «       |jW                  ‰ j4                  jY                  |«      «       ‰}Œd |jW                  ||d  «       ‰ j                  j?                  |«      }|‰ j                  u sJ ‚|j@                  tB        jR                  k(  rd‰ j                  j&                  d <    y ‰ jU                  |«      sŒø|dz  }|dk\  s�Œd‰ j                  j&                  d <    y  y c c}w )Né   éd   c              3   ó&   K  — | ]	  \  }}|–— Œ y ­wr2   r]   )r6   ÚstartÚ_s      r8   r9   z$Shrinker._explain.<locals>.<genexpr>  s   è ø€ Ò#N©h¨e°Q¤EÑ#Nùs   ‚)Úprefixc                 ó8   — | d   d   | d   d   z
   | d   | d   fS ©NrÑ   r   r]   )Úkvs    r8   r‡   z#Shrinker._explain.<locals>.<lambda>  s.   € °"°Q±%¸±(¸RÀ¹UÀ1¹XÑ2EÐ0FÈÈ1ÉÈrÐRSÉuÐ/U€ r=   rØ   c              3   ó<   •K  — | ]  }‰|   j                   –— Œ y ­wr2   )Ú
was_forced©r6   Úir.   s     €r8   r9   z$Shrinker._explain.<locals>.<genexpr>  s   øè ø€ ÒB¨1�5˜‘8×&Õ&ÑBùó   ƒc              3   ó^   •K  — | ]$  }t        |‰d ‰ «      xr t        |‰‰d  «      –— Œ& y ­wr2   )r!   r   )r6   ÚseenÚendr.   ré   s     €€€r8   r9   z$Shrinker._explain.<locals>.<genexpr>  s;   øè ø€ ò àô ˜4  v¨ Ó/ÒO´H¸TÀ5ÈÈÀ;Ó4OÓOñùs   ƒ*-c              3   ón   •K  — | ],  }|�(‰|   j                   ‰k  xr ‰‰|   j                  k  –— Œ. y ­wr2   )ré   rö   )r6   rO   rö   Úspansré   s     €€€r8   r9   z$Shrinker._explain.<locals>.<genexpr>%  s@   øè ø€ ò àØ�=ð �a‘—‘ %Ñ'Ò?¨C°5¸±8·<±<Ñ,?Ó?ñùs   ƒ25r   zor any other generated valueiô  é
   é   )rÎ   ©Ú
with_valuer’   r¼   F©ÚstrictzExpected matching prefixesrÑ   c              3   ób   •K  — | ]&  \  }}|‰j                   j                  v r	‰|   |f–— Œ( y ­wr2   )r—   Úspan_comments)r6   ÚkÚvÚ
arg_rangesrf   s      €€r8   r9   z$Shrinker._explain.<locals>.<genexpr>„  s:   øè ø€ ò '
á��1Ø�D×&Ñ&×4Ñ4Ñ4ð ˜‰]˜AÔñ'
ùó   ƒ,/z#these chunks must be nonoverlappingzDThe test sometimes passed when commented parts were varied together.zAThe test always failed when commented parts were varied together.)-r™   r—   r.   r•   rø   r   Úlistrâ   ré   rö   r~   Úpassing_choice_sequencesÚminÚvaluesrN   ÚitemsÚallÚranger¾   r   Ú_explain_candidatesr:   rð   r   Útyper4   rÎ   ÚcopyÚappendr3   r;   r¿   rÇ   r   ÚOVERRUNr   r   r   ÚzipÚNotImplementedErrorÚclearrÈ   r“   r½   Úchoice)rf   r—   r•   ÚchunksÚ
span_indexÚseen_passing_seqrP   Ún_same_failuresÚnoteÚ	n_attemptÚreplacementrò   r7   r3   ÚattemptrT   Úspan1Úspan2Ú
result_endÚn_same_failures_togetherÚchunks_by_start_indexrê   Únew_choicesÚprev_endÚlsr  rö   r.   rø   ré   s   `                        @@@@@r8   rä   zShrinker._explainø  sú  ý€ Ø˜C™ˆŒØ×*Ñ*ˆØ—
‘
ˆØ—,‘,ˆØ×"Ñ"×(Ñ(ˆÜ7BÄ4Ó7Hˆð #×0Ñ0×:Ñ:ö
àð ˜˜zÑ*×0Ñ0°%¸
Ñ2C×2GÑ2GÐHÑHò
ˆ
ð  Ÿ;™;×?Ñ?Ø—:‘:ÐN¤Ñ#N¸*×:KÑ:KÓ:MÔ#NÓ NÐOð @ó 
Ðô )/Ø×ÑÓÑ$Uô)
ó j	Ñ$ˆJ™˜ ô ÓB´°e¸SÓ0AÔBÔBØô õ à,ôô ð ô õ à×+Ñ+×9Ñ9ôô ð
 ô ˜d×6Ñ6°u¸cÓBÓCˆJð  ˆOØ1ˆDä" 3¬¨Z«Ñ#8Ó9ó F�	ð ˜r‘>¤C¨
£OÑ3°oÈÑ6IÒIáàœs :›Ò.Ü"& z°)Ñ'<Ó"=‘Kð #%�KÜ" 5¨#Ó.ò 7˜Ø$ Q™x˜Ø#ŸšÜ$/Ø $§	¡	¨4×+;Ñ+;ÀDÇKÁKô%˜Eð $(§9¡9¸ 9Ó#>˜DØ#×*Ñ*¨4¯:©:Õ6ð7ð " & 5˜/¬E°+Ó,>Ñ>ÀÈÈÀÑN�ØŸ™×9Ñ9¸'È&Ð9ÓQ�à—=‘=¤F§N¡NÑ2ÙÜÔ.°Ó7�ä˜“L¤C¨¯©Ó$7Ò7Ü  §¡¨u°S°T¨{Õ;ô ),Ø%×+Ñ+¨V¯\©\À%ô)ò 	P™˜˜uð  %Ÿ{™{¨e¯k©kÒ9Ð9Ð9Ø$Ÿ{™{¨eÒ3Ð3Ð3Ø Ÿ;™;¨%Ó/°E·I±IÀÓ4DØ).¯©˜JÙ!ð	Pô 2Ð2NÓOÐOð    ˜Ø Ÿ.™.¨¨zÐ:ñ;à! # $˜-ñ(ð ð
 ˜:Ñ&×-Ñ-¨f¯n©n¸UÀ:Ð.NÔOØ!Ÿ[™[×=Ñ=¸gÓF�Fà—}‘}¬¯©Ñ6Ù Ü!Ô"2°FÓ;‘Fà˜:Ñ&×-Ñ-¨f¯n©n¸UÀ3Ð.GÔHà ¨×(:Ñ(:Ñ:à×&Ñ&×4Ñ4×:Ñ:Ô<ÚØ—=‘=¤F§L¡LÑ0ò Ø×#Ñ# FÖ+Ø# qÑ(�OØ&¨#Ô-ØGK˜×*Ñ*×8Ñ8¸ÑDÚòMFðIj	ô\ ˆt×!Ñ!×/Ñ/Ó0°AÒ5ØØ#$Ð ä &ô '
àŸ™›ô'
ó !
Ðô
 �s“ó 	ˆAà)+ˆKØˆHØ$9ò Ñ ‘�˜˜bØ 5Ô.¨3Ò.ÐUÐ0UÓUÑ.ÐUÐ0UÓUÐ.Ø×"Ñ" 7¨8°EÐ#:Ô;Ø×"Ñ" 4§;¡;×#5Ñ#5°bÓ#9Ô:Ø‘ð	ð
 ×Ñ˜w x yÐ1Ô2à—[‘[×5Ñ5°kÓBˆFð ! D×$6Ñ$6Ñ6Ð6Ð6Ø�}‰}¤§¡Ò,àZð ×"Ñ"×0Ñ0°Ñ6ñ Ø×Ñ Õ'Ø(¨AÑ-Ð(Ø+¨sÔ2à[ð ×&Ñ&×4Ñ4°TÑ:ñ ñ5	ùòM
s   Á2&X/ré   rö   zIterator[tuple[ChoiceT, ...]]c           	   #   ó”  ‡‡K  — | j                   Š| j                  j                  }t        ˆfd„t	        ||«      D «       «      }t        t        ˆfd„t	        ||«      D «       «      «      }|h}t        | j                  j                  D �ch c]   }||   j                  ||   j                  f’Œ" c}«      }|D ]…  \  Š}	‰|	f||fk(  s|	‰z
  ||z
  k7  rŒt        ˆˆfd„t	        ||z
  «      D «       «      |k7  rŒ@t        ˆˆfd„t	        ||z
  «      D «       «      }
t        |
«      }||v rŒq|j                  |«       |
–— Œ‡ yc c}w ­w)aÂ  Yield deterministic candidate replacements for ``nodes[start:end]``.

        Random sampling alone misses cases like ``assert n1 == n2``, where the
        only passing value of ``n1`` is exactly ``n2``'s value. We try
        substituting values from each other arg slice with matching length and
        types, which catches such comparisons. Invalid borrowed values just
        produce an irrelevant test result the outer loop discards.
        c              3   ó<   •K  — | ]  }‰|   j                   –— Œ y ­wr2   ©r  rñ   s     €r8   r9   z/Shrinker._explain_candidates.<locals>.<genexpr>²  s   øè ø€ ÒF¨q˜U 1™XŸ]�]ÑFùró   c              3   ó<   •K  — | ]  }‰|   j                   –— Œ y ­wr2   ©r3   rñ   s     €r8   r9   z/Shrinker._explain_candidates.<locals>.<genexpr>³  s   øè ø€ Ò'R¸1¨¨a©¯­Ñ'Rùró   c              3   óB   •K  — | ]  }‰‰|z      j                   –— Œ y ­wr2   r'  ©r6   Újr.   Ústart2s     €€r8   r9   z/Shrinker._explain_candidates.<locals>.<genexpr>¼  s    øè ø€ ÒI°�e˜F Q™JÑ'×,Õ,ÑIùó   ƒc              3   óB   •K  — | ]  }‰‰|z      j                   –— Œ y ­wr2   r)  r+  s     €€r8   r9   z/Shrinker._explain_candidates.<locals>.<genexpr>À  s    øè ø€ ÒQ¸˜U 6¨A¡:Ñ.×4Õ4ÑQùr.  N)r.   r—   rø   r;   r  r   rN   râ   ré   rö   Úadd)rf   ré   rö   rø   Útarget_typesÚcurrent_keyrõ   rò   r  Úend2ÚborrowedrÙ   r.   r-  s               @@r8   r  zShrinker._explain_candidates¥  s4  ùè ø€ ð —
‘
ˆØ×"Ñ"×(Ñ(ˆÜÓF´E¸%ÀÓ4EÔFÓFˆÜ!¤%Ó'RÄÀeÈSÓ@QÔ'RÓ"RÓSˆØ&1 ]ˆÜØ59×5GÑ5G×5QÑ5QÖR°ˆe�A‰h�n‰n˜e A™hŸl™lÒ+ÒRó
ˆ
ð 'ò 	‰LˆF�DØ˜ˆ~ %¨ Ò-°$¸±-ÀSÈ5Á[Ò1QØäÔI´e¸CÀ%¹KÓ6HÔIÓIØò ð ÜÔQ¼eÀCÈ%ÁKÓ>PÔQÓQˆHÜ˜hÓ'ˆCØ�d‰{ØØ�H‰H�SŒMØ‹Nñ	ùò Sùs   „BEÂ%EÂ1BEc                 ó:   — | j                  | j                  «       y)a+  Run a full set of greedy shrinks (that is, ones that will only ever
        move to a better target) and update shrink_target appropriately.

        This method iterates to a fixed point and so is idempontent - calling
        it twice will have exactly the same effect as calling it once.
        N)Úfixate_shrink_passesrª   re   s    r8   rÛ   zShrinker.greedy_shrinkÇ  s   € ð 	×!Ñ! $×"4Ñ"4Õ5r=   c                 ó$   — | j                  «        y)aê  Performs some preliminary reductions that should not be
        repeated as part of the main shrink passes.

        The main reason why these can't be included as part of shrink
        passes is that they have much more ability to make the test
        case "worse". e.g. they might rerandomise part of it, significantly
        increasing the value of individual nodes, which works in direct
        opposition to the lexical shrinking and will frequently undo
        its work.
        N)Úreduce_each_alternativere   s    r8   rÚ   z!Shrinker.initial_coarse_reductionÐ  s   € ð 	×$Ñ$Õ&r=   c                 ó,  — | j                   j                  D �cg c]  }g ‘Œ }}t        | j                  «      D ]<  \  }}|j                  t        |«      k  sŒ||j                     j                  |«       Œ> t        t        t        |«      «      S c c}w r2   )	r—   r.   Ú	enumeraterø   ré   r:   r  r;   Úmap)rf   rê   rT   rò   Úexs        r8   Úspans_starting_atzShrinker.spans_starting_atÝ  s}   € à"×0Ñ0×6Ñ6Ö7˜’"Ð7ˆÐ7Ü˜tŸz™zÓ*ò 	+‰EˆAˆrà�x‰xœ#˜f›+Ó%Ø�r—x‘xÑ ×'Ñ'¨Õ*ð	+ô ”Sœ Ó'Ó(Ð(ùò 8s   ™	Bc                 óÚ  — d}|t        | j                  j                  «      k  �rÆ| j                  j                  }||   }|j                  dk(  �rq|j                  �sd|j
                  dk  �rT|j                  d   dk(  �rAt        |j
                  t        «      sJ ‚| j                  |d| ||   j                  d¬«      fz   ||dz   d z   «      d   }|| j                  urà|�Þ|j                  t        j                  k\  rÁt        |j                  «      t        |«      k7  }|snt        |dz   t        |«      «      D ]S  }|j                  |   }||   }|j                  |j                  k7  s!t        |j
                  |j                  «      rŒQd} n |r.t        |j
                  «      D ]  }	| j!                  ||	«      sŒ n |dz  }|t        | j                  j                  «      k  r�ŒÅyy)	a½  This is a pass that is designed to rerandomise use of the
        one_of strategy or things that look like it, in order to try
        to move from later strategies to earlier ones in the branch
        order.

        It does this by trying to systematically lower each value it
        finds that looks like it might be the branch decision for
        one_of, and then attempts to repair any changes in shape that
        this causes.
        r   Úintegerrù   Ú	min_valueNrû   rÑ   T)r:   r—   r.   r  rð   r3   r4   Ú
isinstancero   r¿   r  rÇ   r   rÈ   r  r   Útry_lower_node_as_alternative)
rf   rò   r.   r7   Úzero_attemptÚchanged_shaper,  Ú	zero_nodeÚ	orig_noder  s
             r8   r8  z Shrinker.reduce_each_alternativeæ  sÎ  € ð ˆØ”#�d×(Ñ(×.Ñ.Ó/Ó/Ø×&Ñ&×,Ñ,ˆEØ˜‘8ˆDà—	‘	˜YÓ&ØŸ›Ø—J‘J "Ó$Ø×$Ñ$ [Ñ1°QÓ6ä! $§*¡*¬cÔ2Ð2Ð2ð  $×8Ñ8Ø˜"˜1�I  q¡§¡¸! Ó!<Ð >Ñ>ÀÀqÈ1ÁuÀwÀÑOó àñ �ð !¨×(:Ñ(:Ñ:Ø$Ð0Ø$×+Ñ+¬v¯|©|Ò;ä$'¨×(:Ñ(:Ó$;¼sÀ5»zÑ$I�Má(Ü!& q¨1¡u¬c°%«jÓ!9ò 
&˜AØ(4×(:Ñ(:¸1Ñ(=˜IØ(-¨a©˜Ià )§¡°)·.±.Ò @Ü'7Ø$-§O¡O°Y×5JÑ5Jõ("ð 15 Ù %ð
&ñ %Ü!& t§z¡zÓ!2ò &˜AØ#×AÑAÀ!ÀQÕGÙ %ð&ð �‰FˆAð_ ”#�d×(Ñ(×.Ñ.Ó/Ö/r=   c                 ó  — | j                   j                  }| j                  |d| ||   j                  |¬«      fz   ||dz   d z   «      ry|d| ||   j                  |¬«      fz   }| j                   }| j                  |   }t        d«      D ]ï  }| j                  j                  |D �cg c]  }|j                  ‘Œ c}t        |«      ¬«      }	|	j                  t        j                  k  rŒ_| j                  |	«       |D ]{  }
|j                  |
   }|	j                  |
   }|	j                  |j                  |j                    }| j                  |d| |z   ||j                   d z   «       || j                   usŒz  y Œñ yc c}w )zºAttempt to lower `self.shrink_target.nodes[i]` to `v`,
        while rerandomising and attempting to repair any subsequent
        changes to the shape of the test case that this causes.Nrû   rÑ   Té   r¼   F)r—   r.   rÅ   r  r=  r  r~   r¿   r3   r:   rÇ   r   rÈ   rÀ   rø   ré   rö   )rf   rò   r  r.   rë   r   rø   rê   rÁ   Úrandom_attemptr,  Úinitial_spanÚattempt_spanÚcontentss                 r8   rB  z&Shrinker.try_lower_node_as_alternative#  s”  € ð ×"Ñ"×(Ñ(ˆØ×"Ñ"Ø�"�1ˆI˜˜q™Ÿ™°!˜Ó4Ð6Ñ6¸¸qÀ1¹u¸w¸ÑGô
ð à�r˜�˜e A™hŸm™m°q˜mÓ9Ð;Ñ;ˆØ×$Ñ$ˆØ×&Ñ& qÑ)ˆÜ�q“ò 	 ˆAØ!Ÿ[™[×=Ñ=Ø"(Ö)˜Q�—“Ò)´#°e³*ð >ó ˆNð ×$Ñ$¤v§|¡|Ò3ØØ×&Ñ& ~Ô6Øò  �Ø&Ÿ}™}¨QÑ/�Ø-×3Ñ3°AÑ6�Ø)×/Ñ/°×0BÑ0BÀ\×EUÑEUÐV�Ø×'Ñ'Ø˜"˜1�I Ñ(¨5°×1AÑ1AÐ1CÐ+DÑDôð  $×"4Ñ"4Ò4Úñ ð	 ð  ùò *s   Â*F
c                 ó    — t        t        «      S r2   )r   r'   re   s    r8   Úshrink_pass_choice_treesz!Shrinker.shrink_pass_choice_treesB  s   € äœ:Ó&Ð&r=   ©Úrandom_orderÚshrink_passrP  c                ó˜  ‡— | j                   ‰   }|j                  ry| j                  }| j                  }| j                  }t        | j                  j                  «      }‰j                  €J ‚| j                  j                  ‰j                  «       |rt        | j                  «      }nt        ‰j                  «      }	 |j                  |ˆfd„«      ‰_        ‰xj                  | j                  |z
  z  c_        ‰xj                  | j                  |z
  z  c_        ‰xj                  | j                  |z
  z  c_        ‰xj                   |t        | j                  j                  «      z
  z  c_        | j                  j#                  «        y# ‰xj                  | j                  |z
  z  c_        ‰xj                  | j                  |z
  z  c_        ‰xj                  | j                  |z
  z  c_        ‰xj                   |t        | j                  j                  «      z
  z  c_        | j                  j#                  «        w xY w)NFc                 ó&   •— ‰j                  | «      S r2   )r[   )ÚchooserrQ  s    €r8   r‡   zShrinker.step.<locals>.<lambda>Z  s   ø€  × 4Ñ 4°WÓ =€ r=   T)rN  Ú	exhaustedra   r_   r`   r:   r—   r•   r\   r~   Úexplain_next_call_asr)   rÎ   r(   r^   Ústeprb   Úclear_call_explanation)	rf   rQ  rP  ÚtreeÚinitial_shrinksr›   r�   ÚsizeÚselection_orders	    `       r8   rW  zShrinker.stepF  sË  ø€ Ø×,Ñ,¨[Ñ9ˆØ�>Š>ØàŸ,™,ˆØŸ
™
ˆØ!Ÿ_™_ÐÜ�4×%Ñ%×-Ñ-Ó.ˆØ×ÑÐ+Ð+Ð+Ø�‰×(Ñ(¨×)9Ñ)9Ô:áÜ4°T·[±[ÓA‰Oä4°[×5LÑ5LÓMˆOð
	1Ø&*§i¡iØÛ=ó'ˆKÔ#ð
 ×Ò §¡¨mÑ!;Ñ;ÕØ×"Ò" d§o¡oÐ8JÑ&JÑJÕ"Ø×Ò 4§<¡<°/Ñ#AÑAÕØ×!Ò! T¬C°×0BÑ0B×0JÑ0JÓ,KÑ%KÑKÕ!Ø�K‰K×.Ñ.Ô0Øøð ×Ò §¡¨mÑ!;Ñ;ÕØ×"Ò" d§o¡oÐ8JÑ&JÑJÕ"Ø×Ò 4§<¡<°/Ñ#AÑAÕØ×!Ò! T¬C°×0BÑ0B×0JÑ0JÓ,KÑ%KÑKÕ!Ø�K‰K×.Ñ.Õ0ús   ÃF ÆB7I	Úpassesc                 óÖ  — d}|�rdd}i }| j                  «       }| j                  }d}|D �]  }|r| j                  «       }| j                  }d}	d}
|	|
k  r¦t        | j                  d|z  | j                  |z
  z   «      | _        | j                  }| j                  }| j                  ||	|
dz  k\  ¬«      snFd}|| j                  k7  r/|| j                  urd}	nt        || j                  |z
  «      }|	dz  }	|	|
k  rŒ¦| j                  |u rd||<   Œåt        | j                  «      t        |j                  «      k  rd||<   �Œd||<   �Œ |j                  |j                  ¬	«       |r�Œcy
y
)zoRun steps from each pass in ``passes`` until the current shrink target
        is a fixed point of all of them.TFrÑ   r   é   ræ   rO  éÿÿÿÿrØ   N)
Úremove_discardedr_   r—   Úmaxr™   rW  r:   r•   ÚsortÚ__getitem__)rf   r]  Úany_ranÚ
reorderingÚcan_discardÚcalls_at_loop_startÚmax_calls_per_failing_stepÚspÚ	before_spÚfailuresÚmax_failuresÚprevr›   s                r8   r6  zShrinker.fixate_shrink_passesd  sœ  € ð ˆÚØˆGàˆJð ×/Ñ/Ó1ˆKà"&§*¡*Ðð
 *+Ð&àó B'�ÙØ"&×"7Ñ"7Ó"9�Kà ×.Ñ.�	ð
 �Ø!�Ø Ò-ô &)ØŸ™ØÐ6Ñ6ØŸ:™:Ð(;Ñ;ñ=ó&�D”Nð  ×-Ñ-�DØ$(§J¡J�Mð  Ÿ9™9 R°hÀ,ÐRSÑBSÑ6S˜9ÔTð Ø"�Gð
 %¨¯
©
Ò2Ø t×'9Ñ'9Ñ9Ø'(™Hä9<Ø :¸D¿J¹JÈÑ<Vó:Ð6ð %¨™M˜HðY  Ó-ðd ×%Ñ%¨Ñ2Ø%&�J˜r’NÜ˜Ÿ™Ó&¬¨Y×->Ñ->Ó)?Ò?Ø%'�J˜r“Nà%&�J˜r“NðEB'ðH �K‰K˜J×2Ñ2ˆKÔ3õq r=   .c                 ó.   — | j                   j                  S r2   )r—   r.   re   s    r8   r.   zShrinker.nodesÂ  ó   € à×!Ñ!×'Ñ'Ð'r=   c                 ó.   — | j                   j                  S r2   )r—   r•   re   s    r8   r•   zShrinker.choicesÆ  s   € à×!Ñ!×)Ñ)Ð)r=   c                 ó.   — | j                   j                  S r2   )r—   rø   re   s    r8   rø   zShrinker.spansÊ  rp  r=   c                 ó”   — t        t        «      }| j                  D ]   }||j                     j	                  |«       Œ" t        |«      S )zŒ
        A mapping of labels to a list of spans with that label. Spans in the list
        are ordered by their normal index order.
        )r   r  rø   Úlabelr  Údict)rf   Úspans_by_labelr<  s      r8   rv  zShrinker.spans_by_labelÎ  sC   € ô %¤TÓ*ˆØ—*‘*ò 	0ˆBØ˜2Ÿ8™8Ñ$×+Ñ+¨BÕ/ð	0ä�NÓ#Ð#r=   c                 ó8   — t        | j                  t        ¬«      S )NrØ   )rN   rv  rn   re   s    r8   Údistinct_labelszShrinker.distinct_labelsÚ  s   € ä�d×)Ñ)¬sÔ3Ð3r=   c                 óì  ‡ ‡‡‡— |j                  ‰ j                  ˆ fd„«      }‰ j                  |   Š|j                  t        t	        ‰«      dz
  «      «      Š‰‰   Š‰dz   t	        ‰«      k(  s‰‰dz      j
                  ‰j                  k\  ry‰ j                  |‰«      ˆˆˆfd„«       }|j                  |d„ «      }‰j
                  |j
                  k  sJ ‚‰j                  |j                  k\  sJ ‚|j                  ‰j                  k  sJ ‚‰ j                  ‰ j                  d‰j
                   ‰ j                  |j
                  |j                   z   ‰ j                  ‰j                  d z   «       y)aØ  Attempt to replace each span with a descendant span.

        This is designed to deal with strategies that call themselves
        recursively. For example, suppose we had:

        binary_tree = st.deferred(
            lambda: st.one_of(
                st.integers(), st.tuples(binary_tree, binary_tree)))

        This pass guarantees that we can replace any binary tree with one of
        its subtrees - each of those will create an interval that the parent
        could validly be replaced with, and this pass will try doing that.

        This is pretty expensive - it takes O(len(intervals)^2) - so we run it
        late in the process when we've got the number of intervals as far down
        as possible.
        c                 ó:   •— t        ‰j                  |    «      dk\  S )Nræ   )r:   rv  )Úlrf   s    €r8   r‡   z-Shrinker.pass_to_descendant.<locals>.<lambda>ò  s   ø€ ¬C°×0CÑ0CÀAÑ0FÓ,GÈ1Ñ,L€ r=   rÑ   Nc                  ó   •— ‰dz   } t        ‰«      }| dz   |k  r2| |z   dz  }‰|   j                  ‰j                  k\  r|}n|} | dz   |k  rŒ2‰‰dz   | D �cg c]  }|j                  ‰j                  k  r|‘Œ c}S c c}w ©NrÑ   ræ   )r:   ré   rö   Úchoice_count)ÚloÚhiÚmidÚspanÚancestorrò   rø   s       €€€r8   Údescendantsz0Shrinker.pass_to_descendant.<locals>.descendantsü  s›   ø€ à�Q‘ˆBÜ�U“ˆBØ�q‘&˜2’+Ø˜B‘w 1‘n�Ø˜‘:×#Ñ# x§|¡|Ò3Ø‘Bà�Bð �q‘&˜2“+ð " ! a¡%¨"Ð-öàØ×$Ñ$ x×'<Ñ'<Ò<ò òð ùò s   Á"A;c                 ó    — | j                   dkD  S rÄ   )r~  )r<  s    r8   r‡   z-Shrinker.pass_to_descendant.<locals>.<lambda>  s   € ¸B¿O¹OÈaÑ<O€ r=   )Úchooserx  rv  r  r:   ré   rö   rµ   r~  rÅ   r.   )rf   rT  rt  r„  Ú
descendantrƒ  rò   rø   s   `    @@@r8   r¡   zShrinker.pass_to_descendantÞ  sN  û€ ð& —‘Ø× Ñ Ó"Ló
ˆð ×#Ñ# EÑ*ˆØ�N‰Nœ5¤ U£¨a¡Ó0Ó1ˆØ˜‘8ˆàˆq‰5”C˜“JÒ %¨¨A©¡,×"4Ñ"4¸¿¹Ò"DØà	�‰�U˜AÓ	õ	ó 
ð	ð —^‘^ KÑ1OÓPˆ
à�~‰~ ×!1Ñ!1Ò1Ð1Ð1Ø�|‰|˜zŸ~™~Ò-Ð-Ð-Ø×&Ñ&¨×)>Ñ)>Ò>Ð>Ð>à×ÑØ�J‰JÐ'˜Ÿ™Ð(Ø�j‰j˜×)Ñ)¨J¯N©NÐ;ñ<à�j‰j˜Ÿ™˜Ð(ñ)õ	
r=   c                 óŒ  ‡ ‡‡‡‡‡— t        ‰ j                  «      dk  ryg Št        ‰ j                  «      D ]>  }‰ j                  |   }|j                  s|j
                  dk7  rŒ.‰j                  |«       Œ@ ‰sy‰D �cg c]'  }t        |j                  |j                  d   z
  «      ‘Œ) c}Št        ‰«      }|dkD  sJ ‚t        t        ‰«      «      D ]  }‰|xx   |z  cc<   Œ ‰ j                  Šd„ Šˆˆˆˆ ˆfd„Št        j                  |ˆfd„«       t        j                  |ˆfd	„«       ‰ j                  «        yc c}w )
aÞ  Sometimes we find ourselves in a situation where changes to one part
        of the choice sequence unlock changes to other parts. Sometimes this is
        good, but sometimes this can cause us to exhibit exponential slow
        downs!

        e.g. suppose we had the following:

        m = draw(integers(min_value=0))
        n = draw(integers(min_value=0))
        assert abs(m - n) > 1

        If this fails then we'll end up with a loop where on each iteration we
        reduce each of m and n by 2 - m can't go lower because of n, then n
        can't go lower because of m.

        This will take us O(m) iterations to complete, which is exponential in
        the data size, as we gradually zig zag our way towards zero.

        This can only happen if we're failing to reduce the size of the choice
        sequence: The number of iterations that reduce the length of the choice
        sequence is bounded by that length.

        So what we do is this: We keep track of which nodes are changing, and
        then if there's some non-zero common offset to them we try and minimize
        them all at once by lowering that offset.

        This may not work, and it definitely won't get us out of all possible
        exponential slow downs (an example of where it doesn't is where the
        shape of the nodes changes as a result of this bouncing behaviour),
        but it fails fast when it doesn't work and gets us out of a really
        nastily slow case when it does.
        rÑ   Nr?  Úshrink_towardsr   c                 ó|   — | j                   | j                   dz   | j                  | j                  d   |z   ¬«      gfS )NrÑ   r‰  rû   )Úindexr  r4   )r7   rÁ   s     r8   Úoffset_nodez6Shrinker.lower_common_node_offset.<locals>.offset_nodeQ  s@   € à—
‘
Ø—
‘
˜Q‘Ø—‘ d×&6Ñ&6Ð7GÑ&HÈ1Ñ&L�ÓMÐNðð r=   c                 ó²   •— ‰j                  t        ‰j                  t        ‰‰d¬«      D ��cg c]  \  }} ‰||| |z   z  «      ‘Œ c}}«      «      S c c}}w )NFrý   )rÅ   r    r.   r  )	rÁ   Úsignr7   r  ÚchangedÚintsrŒ  rf   Ústs	       €€€€€r8   Úconsiderz3Shrinker.lower_common_node_offset.<locals>.considerX  s^   ø€ Ø×*Ñ*ÜØ—H‘Hô (+¨7°DÀÔ'G÷á#˜D !ñ $ D¨$°!°a±%©.Õ9óóóð ùós   ®Ac                 ó   •—  ‰| d«      S ©NrÑ   r]   ©rÁ   r’  s    €r8   r‡   z3Shrinker.lower_common_node_offset.<locals>.<lambda>d  s   ø€ ©°!°Q«€ r=   c                 ó   •—  ‰| d«      S )Nr`  r]   r•  s    €r8   r‡   z3Shrinker.lower_common_node_offset.<locals>.<lambda>e  s   ø€ ©°!°R«€ r=   )r:   Ú_Shrinker__changed_nodesrN   r.   Útrivialr  r  Úabsr3   r4   r  r  r—   r$   rà   r˜   )	rf   rò   r7   Úoffsetr�  r’  r�  rŒ  r‘  s	   `   @@@@@r8   Úlower_common_node_offsetz!Shrinker.lower_common_node_offset  s/  ý€ ôB ˆt×#Ñ#Ó$¨Ò)ØàˆÜ˜×,Ñ,Ó-ò 	!ˆAØ—:‘:˜a‘=ˆDØ�|Š|˜tŸy™y¨IÒ5ØØ�N‰N˜4Õ ð		!ñ Øð NUö
ØEIŒC�—
‘
˜T×-Ñ-Ð.>Ñ?Ñ?Õ@ò
ˆô �T“ˆØ˜ŠzÐˆzä”s˜4“yÓ!ò 	ˆAØ�‹G�vÑŒGð	ð ×Ñˆò	÷		ð 		ô 	�‰�vÓ7Ô8Ü�‰�vÓ8Ô9Ø×"Ñ"Õ$ùòA
s   Á?,Ec                 óD   — | j                   | _        t        «       | _        y r2   )r—   Ú"_Shrinker__last_checked_changed_atrF   Ú_Shrinker__all_changed_nodesre   s    r8   r˜   zShrinker.clear_change_trackingh  s   € Ø)-×);Ñ);ˆÔ&Ü#&£5ˆÕ r=   c                 ó:   — | j                   j                  |«       y r2   )r—  r0  )rf   rò   s     r8   Úmark_changedzShrinker.mark_changedl  s   € Ø×Ñ× Ñ  Õ#r=   c                 óì  — | j                   | j                  u r| j                  S | j                   }| j                  }||usJ ‚|j                  }|j                  }t	        |j                  «      t	        |j                  «      k  sJ ‚t        |«      t        |«      k7  st        d„ t        ||d¬«      D «       «      rt        «       | _        | j                  S t        |«      t        |«      k(  sJ ‚t        t        ||d¬«      «      D ]_  \  }\  }}|j                  |j                  k(  sJ ‚t        |j                  |j                  «      rŒE| j                  j                  |«       Œa | j                  S )Nc              3   óT   K  — | ]   \  }}|j                   |j                   k7  –— Œ" y ­wr2   r'  )r6   Ún1Ún2s      r8   r9   z+Shrinker.__changed_nodes.<locals>.<genexpr>{  s&   è ø€ ò 4
Ù#) 2 rˆB�G‰G�r—w‘wÕñ4
ùs   ‚&(Trý   )r�  r—   rž  r.   r<   r:   r¾   r  rF   r:  r  r   r3   r0  )rf   Úprev_targetÚ
new_targetÚ
prev_nodesÚ	new_nodesrò   r£  r¤  s           r8   Ú__changed_nodeszShrinker.__changed_nodeso  sN  € à×)Ñ)¨T×-?Ñ-?Ñ?Ø×+Ñ+Ð+à×4Ñ4ˆØ×'Ñ'ˆ
Ø *Ñ,Ð,Ð,Ø ×&Ñ&ˆ
Ø×$Ñ$ˆ	Ü˜
×(Ñ(Ó)¬H°[×5FÑ5FÓ,GÒGÐGÐGäˆz‹?œc )›nÒ,´ñ 4
Ü-0°¸YÈtÔ-Tô4
ô 1
ô (+£uˆDÔ$ð ×'Ñ'Ð'ô �z“?¤c¨)£nÒ4Ð4Ð4Ü(¬¨Z¸È4Ô)PÓQò 4‘�‘8�B˜Ø—w‘w "§'¡'Ò)Ð)Ð)Ü# B§H¡H¨b¯h©hÕ7Ø×,Ñ,×0Ñ0°Õ3ð4ð
 ×'Ñ'Ð'r=   c                 óú   — t        |t        «      sJ ‚| xj                  dz  c_        t        | j                  | j
                  | j                  z
  dz  «      | _        | j
                  | _        || _        i | _        y r}  )	rA  r   ra   rb  r™   r_   rž   r—   rv   )rf   r¦  s     r8   rÉ   zShrinker.update_shrink_target‰  sj   € Ü˜*Ô&6Ô7Ð7Ð7Ø�Š˜Ñ�ô Ø�N‰N˜TŸZ™Z¨$×*CÑ*CÑCÀqÑHó
ˆŒð %)§J¡JˆÔ!Ø'ˆÔØ "ˆÕr=   c                 óê  ‡ — t        ˆ fd„|D «       «      ryt        ‰ j                  |D �cg c]/  }|j                  |j                  dz   |j	                  |¬«      gf‘Œ1 c}«      }‰ j                  |«      d   }|€y|‰ j                  u r‰ j                  «        y|j                  t        j                  u rR‰ j                  j                  |D �cg c]  }|j                  ‘Œ c}d¬«      }|j                  t        j                  u ry|j                  t        j                  u ryt        t        t!        |«      t!        |j                  «      «      «      D ]ä  }||   }|j                  |   }|j"                  |j"                  k(  sŒ1|j"                  d	v sŒ@|j$                  rŒMt!        |j                  «      |j&                  d
   kD  sŒs|j&                  d
   }|j                  d| |j                  | d fD ]A  }	‰ j)                  |d| |j	                  |j&                  |	¬«      gz   ||dz   d z   «      sŒ@  y Œæ t!        ‰ j                  «      t!        |j                  «      z
  }
|
dk  ry|d   j                  }|d   j                  dz   }|||
z   fh}‰ j*                  D �]  }|j,                  |kD  rŒ|j.                  |k  rŒ$|j                  t!        |j*                  «      k\  rŒG|j*                  |j                     }|j0                  D �cg c]  }|j,                  |k\  sŒ|‘Œ }}|j0                  D �cg c]  }|j,                  |k\  sŒ|‘Œ }}t!        |«      t!        |«      k\  s|sŒÌ|j3                  |d   j,                  |t!        |«          j,                  f«       �Œ t5        |d„ d¬«      D ]#  \  }}|d| ||d z   }‰ j)                  |«      sŒ# y yc c}w c c}w c c}w c c}w )az  Attempts to replace each node in the nodes list with n. Returns
        True if it succeeded (which may include some additional modifications
        to shrink_target).

        In current usage it is expected that each of the nodes currently have
        the same value and choice_type, although this is not essential. Note that
        n must be < the node at min(nodes) or this is not a valid shrink.

        This method will attempt to do some small amount of work to delete data
        that occurs after the end of the nodes. This is useful for cases where
        there is some size dependency on the value of a node.
        c              3   ób   •K  — | ]&  }|j                   t        ‰j                  «      k\  –— Œ( y ­wr2   )r‹  r:   r.   )r6   r7   rf   s     €r8   r9   z/Shrinker.try_shrinking_nodes.<locals>.<genexpr>©  s"   øè ø€ Ò?°ˆt�z‰zœS §¡›_Õ,Ñ?ùr  NrÑ   rû   FTr’   r¼   >   ÚbytesÚstringÚmax_size)Úwith_constraintsrü   r   r`  c                 ó   — | d   | d   z
  S rí   r]   )Úxs    r8   r‡   z.Shrinker.try_shrinking_nodes.<locals>.<lambda>  s   € ¸A¸a¹DÀ1ÀQÁ4¹K€ r=   )rÙ   Úreverse)r¾   r    r.   r‹  r  r¿   r—   r›  rÇ   r   r  r~   r3   ÚINVALIDr  r  r:   r  rð   r4   rÅ   rø   ré   rö   Úchildrenr0  rN   )rf   r.   rÁ   r7   Úinitial_attemptr  rò   Úattempt_noder¯  Ú	truncatedÚ
lost_nodesré   rö   Úregions_to_deleter<  r  rO   Úin_originalÚin_replacedÚur  Útry_with_deleteds   `                     r8   Útry_shrinking_nodeszShrinker.try_shrinking_nodes™  sÀ  ø€ ô  Ó?¸Ô?Ô?Øä%Ø�J‰JØQVÖWÈˆd�j‰j˜$Ÿ*™* q™.¨4¯9©9À¨9Ó+BÐ*CÒDÒWó
ˆð
 ×+Ñ+¨OÓ<¸QÑ?ˆàˆ?Øà�d×(Ñ(Ñ(à×)Ñ)Ô+Øð �>‰>œVŸ^™^Ñ+ð —k‘k×6Ñ6Ø"1Ö2˜Q�—“Ò2¸6ð 7ó ˆGð �~‰~¤§¡Ñ/Øà�>‰>œVŸ^™^Ñ+Øô$ ”sœ3˜Ó/´°W·]±]Ó1CÓDÓEò 	$ˆAØ" 1Ñ%ˆDØ"Ÿ=™=¨Ñ+ˆLà—	‘	˜\×.Ñ.Ó.Ø—I‘IÐ!4Ò4ØŸ›Ü˜Ÿ
™
“O l×&>Ñ&>¸zÑ&JÓJà'×3Ñ3°JÑ?�Ø"&§*¡*¨Y¨hÐ"7¸¿¹ÀXÀIÀJÐ9OÐ!Pò $�IØ×.Ñ.Ø'¨¨Ð+à ŸI™IØ1=×1IÑ1IØ+4ð &ó ðñð *¨!¨a©%¨'Ð2ñ3õ	ò  $ñ$ð	$ô. ˜Ÿ™“_¤s¨7¯=©=Ó'9Ñ9ˆ
Ø˜Š?Øà�a‘—‘ˆØ�B‰i�o‰o Ñ!ˆð " 3¨Ñ#3Ð4Ð5Ðà—*‘*ó 	ˆBØ�x‰x˜%ÒØØ�v‰v˜Š}Øà�x‰xœ3˜wŸ}™}Ó-Ò-Øà!Ÿ-™-¨¯©Ñ1ˆKØ&(§k¡kÖD °Q·W±WÀ³^š1ÐDˆKÐDØ&1×&:Ñ&:ÖM ¸a¿g¹gÈ»nš1ÐMˆKÐMä�;Ó¤3 {Ó#3Ò3¹;Øð ×!Ñ!Ø˜Q‘×%Ñ% {´C¸Ó4DÐ3DÑ'E×'KÑ'KÐLöð-	ô4 Ð,Ñ2GÐQUÔVò 	‰DˆAˆqØ.¨r°Ð2°_ÀQÀRÐ5HÑHÐØ×&Ñ&Ð'7Õ8Ùð	ð
 ùòe Xùò. 3ùòL EùÚMs#   «4O!
ÃO&ÌO+Ì(O+Ì<O0ÍO0c                 óè  — | j                   j                  rÜg }| j                   j                  D ]^  }|j                  dkD  sŒ|j                  sŒ |r|j
                  |d   d   k\  sŒ8|j                  |j
                  |j                  f«       Œ` |s	 yt        | j                  «      }t        |«      D ]
  \  }}|||…= Œ | j                  t        |«      «      sy| j                   j                  rŒÜy)aú  Try removing all nodes marked as discarded.

        This is primarily to deal with data that has been ignored while
        doing rejection sampling - e.g. as a result of an integer range, or a
        filtered strategy.

        Such data will also be handled by the ``node_program("X")`` deletion
        passes, but those are necessarily more conservative and will try
        deleting each contiguous run of nodes individually. The common case is
        that all data drawn and rejected can just be thrown away immediately in
        one block, so this pass will be much faster than trying each one
        individually when it works.

        returns False if there is discarded data and removing it does not work,
        otherwise returns True.
        r   r`  FT)r—   Úhas_discardsrø   r~  Ú	discardedré   r  rö   r  r.   ÚreversedrÅ   r;   )rf   rÂ  r<  r  r½  r  s         r8   ra  zShrinker.remove_discarded"  så   € ð" × Ñ ×-Ò-ØˆIà×(Ñ(×.Ñ.ò 9�à—O‘O aÓ'ØŸ›Ù&¨"¯(©(°iÀ±mÀBÑ6GÓ*Gà×$Ñ$ b§h¡h°·±Ð%7Õ8ð9ñ Øð ô ˜4Ÿ:™:Ó&ˆGÜ  Ó+ò !‘��1Ø˜A˜a˜C‘Lð!ð ×*Ñ*¬5°«>Ô:Øð/ × Ñ ×-Ó-ð0 r=   c                 óÚ   — t        t        «      }| j                  D ]5  }||j                  t	        |j
                  «      f   j                  |«       Œ7 t        |j                  «       «      S )z5Returns a list of nodes grouped (choice_type, value).)r   r  r.   r  r   r3   r  r  )rf   Ú
duplicatesr7   s      r8   Úduplicated_nodeszShrinker.duplicated_nodesM  s\   € ô !¤Ó&ˆ
Ø—J‘Jò 	IˆDØ˜Ÿ	™	¤:¨d¯j©jÓ#9Ð:Ñ;×BÑBÀ4ÕHð	Iä�J×%Ñ%Ó'Ó(Ð(r=   Úprogramc                 ó.   ‡ ‡— t        ˆˆ fd„d‰› �¬«      S )Nc                 ó(   •— ‰j                  | ‰«      S r2   )Ú_node_program)rT  rÇ  rf   s    €€r8   r‡   z'Shrinker.node_program.<locals>.<lambda>W  s   ø€ ˜D×.Ñ.¨w¸Ó@€ r=   Únode_program_)r\   )rZ   )rf   rÇ  s   ``r8   r    zShrinker.node_programU  s   ù€ ÜÜ@Ø   	Ð*ô
ð 	
r=   c                 ó<  ‡ ‡‡‡‡‡— t        ‰«      Š|j                  t        t        ‰ j                  «      ‰z
  dz   «      «      Š‰ j	                  ‰‰‰ j
                  ¬«      sy ˆˆfd„Š ‰t        ˆˆˆ fd„«      «      Š‰ j
                  Št        ˆˆˆˆ fd„«       y )NrÑ   ©Úoriginalc                 ó   •— ‰| ‰z  z
  S r2   r]   )r  rò   rÁ   s    €€r8   Úoffset_leftz+Shrinker._node_program.<locals>.offset_leftk  s   ø€ Ø�q˜1‘u‘9Ðr=   c                 óL   •— ‰j                   ‰| «      ‰‰j                  ¬«      S )NrÍ  )Úrun_node_programr—   )r  rÐ  rÇ  rf   s    €€€r8   r‡   z(Shrinker._node_program.<locals>.<lambda>p  s(   ø€ ˜$×/Ñ/Ù “N G°d×6HÑ6Hð 0ó € r=   c                 ó.   •— ‰j                  ‰‰‰| ¬«      S )N)rÎ  Úrepeats)rÒ  )r  rò   rÎ  rÇ  rf   s    €€€€r8   r‡   z(Shrinker._node_program.<locals>.<lambda>y  s   ø€ �d×+Ñ+¨A¨wÀÐSTÐ+ÓU€ r=   )r:   r†  r  r.   rÒ  r—   r   )rf   rT  rÇ  rò   rÁ   rÐ  rÎ  s   ` `@@@@r8   rÊ  zShrinker._node_program[  s‰   ý€ Ü�‹Lˆð �N‰Nœ5¤ T§Z¡Z£°1Ñ!4°qÑ!8Ó9Ó:ˆð ×$Ñ$ Q¨¸$×:LÑ:LÐ$ÔMØõ	ñ Üõóó
ˆð ×%Ñ%ˆäÞUõ	
r=   c                 ó¼   — |j                  | j                  «      }|D �cg c]  }|j                  rŒ|‘Œ }}t        |«      dk  ry| j	                  |«       yc c}w )aQ  Find choices that have been duplicated in multiple places and attempt
        to minimize all of the duplicates simultaneously.

        This lets us handle cases where two values can't be shrunk
        independently of each other but can easily be shrunk together.
        For example if we had something like:

        ls = data.draw(lists(integers()))
        y = data.draw(integers())
        assert y not in ls

        Suppose we drew y = 3 and after shrinking we have ls = [3]. If we were
        to replace both 3s with 0, this would be a valid shrink, but if we were
        to replace either 3 with 0 on its own the test would start passing.

        It is also useful for when that duplication is accidental and the value
        of the choices don't matter very much because it allows us to replace
        more values at once.
        rÑ   N)r†  rÆ  r˜  r:   Úminimize_nodes)rf   rT  r.   r7   s       r8   r£   z$Shrinker.minimize_duplicated_choices|  sT   € ð( —‘˜t×4Ñ4Ó5ˆð #(Ö<˜$¨t¯|«|’Ð<ˆÐ<Üˆu‹:˜Š?Øà×Ñ˜EÕ"ùò	 =s
    A²Ac                 ó  ‡ ‡‡‡‡‡— d„ Š|j                  ‰ j                  ˆfd„«      Š|j                  ‰ j                  ˆˆfd„«      Š‰j                  Š‰j                  Šdt        dt        fˆˆˆˆˆ fd„}t        |«       y)z¬If there is a sum of generated numbers that we need their sum
        to exceed some bound, lowering one of them requires raising the
        other. This pass enables that.c                 óÀ   — | j                   dv xrO | j                   dk(  xr= t        j                  | j                  «      xs t	        | j                  «      t
        k\   S )N>   Úfloatr?  rÙ  )r  ÚmathÚisnanr3   r™  r*   ©r7   s    r8   Úcan_choose_nodez<Shrinker.redistribute_numeric_pairs.<locals>.can_choose_node¢  sU   € ð —9‘9Ð 4Ð4ò Ø—	‘	˜WÑ$ò WÜ—Z‘Z §
¡
Ó+ÒU¬s°4·:±:«ÔBUÑ/Uð:ð r=   c                 ó2   •—  ‰| «      xr | j                    S r2   ©r˜  )r7   rÝ  s    €r8   r‡   z5Shrinker.redistribute_numeric_pairs.<locals>.<lambda>¯  s   ø€ ™¨Ó.ÒC°t·|±|Ð3C€ r=   c                 ó˜   •—  ‰| «      xr@ | j                    xr1 ‰j                  | j                  cxk  xr ‰j                  dz   k  S c S )Né   )rð   r‹  )r7   rÝ  Únode1s    €€r8   r‡   z5Shrinker.redistribute_numeric_pairs.<locals>.<lambda>³  sR   ø€ Ù Ó%ò @ð Ÿ™Ð'ò@ð —K‘K $§*¡*Ö?°·±¸a±Ñ?ð ñ @ð r=   r  r/   c                 ó  •— ‰j                   dk(  r‰j                  d   nd}| t        ‰|z
  «      kD  ry‰|k  r|  } 	 ‰| z
  }‰| z   }‰j                   dk(  rt        |«      t        k\  ry‰j                  ‰j                  d ‰j                   ‰j                  |¬«      fz   ‰j                  ‰j                  dz   ‰j                   z   ‰j                  |¬«      fz   ‰j                  ‰j                  dz   d  z   «      S # t        $ r Y yw xY w)Nr?  r‰  r   FrÙ  rû   rÑ   )	r  r4   r™  ÚOverflowErrorr*   rÅ   r.   r‹  r  )	r  r‰  Úv1Úv2ÚmrÁ   râ  Únode2rf   s	       €€€€€r8   Úboostz2Shrinker.redistribute_numeric_pairs.<locals>.boostÁ  s)  ø€ ð 8=·z±zÀYÒ7N�×!Ñ!Ð"2Ò3ÐTUð ð ”3�q˜>Ñ)Ó*Ò*Øð �>Ò!Ø�B�ðØ˜‘U�Ø˜‘U�ð �z‰z˜WÒ$¬¨R«Ô4GÒ)GØà×*Ñ*Ø—
‘
˜=˜UŸ[™[Ð)Ø—:‘:¨�:Ó,Ð.ñ/à—*‘*˜UŸ[™[¨1™_¨u¯{©{Ð;ñ<ð —:‘:¨�:Ó,Ð.ñ/ð —*‘*˜UŸ[™[¨1™_Ð.Ð/ñ	0óð øô !ò ñ ðús   ½
C= Ã=	D	ÄD	N)r†  r.   r3   ro   Úboolr   )rf   rT  ré  rÝ  rç  rÁ   râ  rè  s   `  @@@@@r8   r¥   z#Shrinker.redistribute_numeric_pairs™  su   ý€ ò		ð —‘Ø�J‰JÛCó
ˆð —‘Ø�J‰Jôó
ˆð Ÿ™ˆØŸ™ˆð"	”Sð "	œT÷ "	ñ "	ôH 	�UÕr=   c                 ó|  ‡ ‡‡‡‡— |j                  ‰ j                  d„ «      Š‰ j                  |j                  t        ‰j                  dz   t	        t        ‰ j                  «      ‰j                  dz   dz   «      «      ˆ fd„«         Š‰j                  d   Šˆˆˆ fd„Št        ˆˆfd„«       t        ˆˆfd„«       y )	Nc                 ó>   — | j                   dk(  xr | j                   S ©Nr?  ©r  r˜  rÔ   s    r8   r‡   z2Shrinker.lower_integers_together.<locals>.<lambda>é  s   €  !§&¡&¨IÑ"5Ò"G¸a¿i¹i¸-€ r=   rÑ   rH  c                 ót   •— ‰j                   |    j                  dk(  xr ‰j                   |    j                   S rí  )r.   r  rð   ©rò   rf   s    €r8   r‡   z2Shrinker.lower_integers_together.<locals>.<lambda>ï  s4   ø€ Ø—J‘J˜q‘M×&Ñ&¨)Ñ3ÒT¸D¿J¹JÀq¹M×<TÑ<TÐ8Tð r=   r‰  c                 ó`  •— ‰j                  ‰j                  d ‰j                   ‰j                  ‰j                  | z
  ¬«      fz   ‰j                  ‰j                  dz   ‰j                   z   ‰j                  ‰j                  | z
  ¬«      fz   ‰j                  ‰j                  dz   d  z   «      S )Nrû   rÑ   )rÅ   r.   r‹  r  r3   )rÁ   râ  rè  rf   s    €€€r8   r’  z2Shrinker.lower_integers_together.<locals>.considerü  s£   ø€ Ø×*Ñ*Ø—
‘
˜=˜UŸ[™[Ð)Ø—:‘:¨¯©°q©�:Ó9Ð;ñ<à—*‘*˜UŸ[™[¨1™_¨u¯{©{Ð;ñ<ð —:‘:¨¯©°q©�:Ó9Ð;ñ<ð —*‘*˜UŸ[™[¨1™_Ð.Ð/ñ	0óð r=   c                 ó   •—  ‰‰| z
  «      S r2   r]   ©rÁ   r’  r‰  s    €€r8   r‡   z2Shrinker.lower_integers_together.<locals>.<lambda>  s   ø€ ™x¨¸Ñ(:Ó;€ r=   c                 ó   •—  ‰| ‰z
  «      S r2   r]   ró  s    €€r8   r‡   z2Shrinker.lower_integers_together.<locals>.<lambda>  s   ø€ ™x¨¨NÑ(:Ó;€ r=   )r†  r.   r  r‹  r  r:   r4   r   )rf   rT  r’  râ  rè  r‰  s   ` @@@@r8   r¦   z Shrinker.lower_integers_togetherç  s–   ü€ Ø—‘Ø�J‰JÑGó
ˆð —
‘
Ø�N‰NÜ�e—k‘k A‘o¤s¬3¨t¯z©z«?¸E¿K¹KÈ!¹OÈaÑ<OÓ'PÓQóóñ
ˆð ×*Ñ*Ð+;Ñ<ˆö	ô 	Ô;Ô<ÜÔ;Õ<r=   c                 ó"  ‡ ‡‡‡‡‡— |j                  ‰ j                  d„ «      Š‰ j                  |j                  t        ‰j                  dz   t	        t        ‰ j                  «      ‰j                  dz   dz   «      «      ˆˆ fd„«         Št        ‰j                  «      t        ‰j                  «      z  }|j                  t        |«      «      Š‰j                  d   Šˆˆfd„Št        j                  ‰j                  ‰«      ˆˆˆˆ fd„«       y)	a  
        Select two string choices no more than 4 choices apart and simultaneously
        lower characters which appear in both strings. This helps cases where the
        same character must appear in two strings, but the actual value of the
        character is not relevant.

        This shrinking pass currently only tries lowering *all* instances of the
        duplicated character in both strings. So for instance, given two choices:

            "bbac"
            "abbb"

        we would try lowering all five of the b characters simultaneously. This
        may fail to shrink some cases where only certain character indices are
        correlated, for instance if only the b at index 1 could be lowered
        simultaneously and the rest did in fact actually have to be a `b`.

        It would be nice to try shrinking that case as well, but we would need good
        safeguards because it could get very expensive to try all combinations.
        I expect lowering all duplicates to handle most cases in the meantime.
        c                 ó>   — | j                   dk(  xr | j                   S ©Nr®  rî  rÔ   s    r8   r‡   z6Shrinker.lower_duplicated_characters.<locals>.<lambda>  s   €  !§&¡&¨HÑ"4Ò"F¸Q¿Y¹Y¸€ r=   rÑ   rá  c                 óè   •— ‰j                   |    j                  dk(  xrT ‰j                   |    j                   xr8 t        ‰j                  «      t        ‰j                   |    j                  «      z  S r÷  )r.   r  r˜  rF   r3   )rò   râ  rf   s    €€r8   r‡   z6Shrinker.lower_duplicated_characters.<locals>.<lambda>&  sd   ø€ Ø—J‘J˜q‘M×&Ñ&¨(Ñ2ò DØ ŸJ™J q™M×1Ñ1Ð1òDô ˜EŸK™KÓ(¬3¨t¯z©z¸!©}×/BÑ/BÓ+CÑCð	 r=   rE   c                 óz   •— | j                  | j                  j                  ‰‰j                  |«      «      ¬«      S )Nrû   )r  r3   ÚreplaceÚchar_in_shrink_order)r7   rÁ   ÚcharrE   s     €€r8   Ú	copy_nodez7Shrinker.lower_duplicated_characters.<locals>.copy_node4  s;   ø€ ð
 —9‘9ØŸ:™:×-Ñ-¨d°I×4RÑ4RÐSTÓ4UÓVð ó ð r=   c                 ó  •— ‰j                  ‰j                  d ‰j                    ‰‰| «      fz   ‰j                  ‰j                  dz   ‰j                   z    ‰‰| «      fz   ‰j                  ‰j                  dz   d  z   «      S r”  )rÅ   r.   r‹  )rÁ   rý  râ  rè  rf   s    €€€€r8   r‡   z6Shrinker.lower_duplicated_characters.<locals>.<lambda>?  s‡   ø€ �d×-Ñ-Ø—
‘
˜=˜UŸ[™[Ð)Ù˜U AÓ&Ð(ñ)à—*‘*˜UŸ[™[¨1™_¨u¯{©{Ð;ñ<ñ ˜U AÓ&Ð(ñ)ð —*‘*˜UŸ[™[¨1™_Ð.Ð/ñ	0ó€ r=   N)r†  r.   r  r‹  r  r:   rF   r3   rN   r4   r$   rà   rC   )rf   rT  Úduplicated_charactersrü  rý  rE   râ  rè  s   `  @@@@@r8   r§   z$Shrinker.lower_duplicated_characters  sÕ   ý€ ð, —‘Ø�J‰JÑFó
ˆð
 —
‘
Ø�N‰NÜ�e—k‘k A‘o¤s¬3¨t¯z©z«?¸E¿K¹KÈ!¹OÈaÑ<OÓ'PÓQôóñ

ˆô !$ E§K¡KÓ 0´3°u·{±{Ó3CÑ CÐà�~‰~œfÐ%:Ó;Ó<ˆØ×%Ñ% kÑ2ˆ	õ	ô 	�‰Ø×5Ñ5°dÓ;öõ		
r=   c                 ó   ‡‡— |j                  | j                  d„ «      Š‰j                  d   Š|j                  t        t	        ‰j
                  «      «      ˆˆfd„«      }t        ‰j
                  |   ‰«      D ]‚  }‰j
                  d| |z   ‰j
                  |dz   d z   }| j                  | j                  d‰j                   ‰j                  |¬«      fz   | j                  ‰j                  dz   d z   «      sŒ‚ y y)a*  For string nodes, try replacing characters with simpler equivalents
        from natural text transformations: unicode decomposition (NFD, NFKD)
        and case mapping. For example, an accented latin letter is reduced
        to its base form, a ligature is reduced to its first base character,
        a mathematical alphanumeric symbol is reduced to its plain ascii
        counterpart, and a lowercase letter is replaced with its uppercase
        form (which has a smaller shrink-order index in the default
        alphabet).

        The codepoint shrinker is binary-search based, so it can get stuck on
        a high codepoint whose simpler equivalents aren't reached by halving
        / shifting / masking. This pass directly tries the natural simpler
        forms one character at a time.
        c                 ób   ‡ — ‰ j                   dk(  xr t        ˆ fd„‰ j                  D «       «      S )Nr®  c              3   óP   •K  — | ]  }t        |‰j                  d    «      –— Œ y­w)rE   N)rV   r4   )r6   rO   rÁ   s     €r8   r9   zEShrinker.normalize_unicode_chars.<locals>.<lambda>.<locals>.<genexpr>Z  s'   øè ø€ ò ØJKÔ& q¨!¯-©-¸Ñ*D×Eñùs   ƒ#&)r  r¾   r3   rÔ   s   `r8   r‡   z2Shrinker.normalize_unicode_chars.<locals>.<lambda>Y  s1   ø€ �a—f‘f Ñ(ò Üó ØOPÏwÉwôó ð r=   rE   c                 óH   •— t        t        ‰j                  |    ‰«      «      S r2   )rê  rV   r3   )r,  rE   r7   s    €€r8   r‡   z2Shrinker.normalize_unicode_chars.<locals>.<lambda>a  s   ø€ ”dÔ1°$·*±*¸Q±-ÀÓKÓL€ r=   NrÑ   rû   )
r†  r.   r4   r  r:   r3   rV   rÅ   r‹  r  )rf   rT  rò   r  Ú	new_valuerE   r7   s        @@r8   r¨   z Shrinker.normalize_unicode_charsH  sñ   ù€ ð �~‰~Ø�J‰Jñó
ˆð ×$Ñ$ [Ñ1ˆ	Ø�N‰NÜ”#�d—j‘j“/Ó"ÜLó
ˆô 2°$·*±*¸Q±-ÀÓKò 	ˆKØŸ
™
 2 A˜¨Ñ4°t·z±zÀ!ÀaÁ%À'Ð7JÑJˆIØ×&Ñ&Ø—
‘
˜<˜TŸZ™ZÐ(Ø—9‘9¨	�9Ó2Ð4ñ5à—*‘*˜TŸZ™Z¨!™^Ð-Ð.ñ/õñ
 ñ	r=   c                 óž  ‡ — |j                  ‰ j                  d„ «      }|j                  ‰ j                  |j                     ˆ fd„«      }‰ j                  |   }‰ j
                  d|j                   t        |j                  «      fz   ‰ j
                  |j                  d z   }‰ j                  ‰ j                  j                  |«      «       y)aê  Replace a strategy's choices with a ValueHole carrying the value it
        produced, so that the replay re-encodes that value more simply.

        We look for a span which starts with a non-forced zero-based non-zero
        integer choice (heuristically: a one_of branch selector), makes more
        than one choice, and has a recorded value, and propose the same
        choice sequence with the span's choices replaced by a single
        ValueHole. At replay time the hole is claimed by whichever strategy
        draws at that position: a one_of's ``_invert`` tries every alternative
        in-process and returns the simplest encoding whose image contains the
        value, so one test execution covers all of its branches. If the
        result is a strictly simpler choice sequence which still fails, it is
        kept, and normal shrinking takes the re-encoded value the rest of the
        way. All knowledge of how to encode values lives with the strategies,
        not here.
        c                 óˆ   — | j                   dk(  xr2 | j                   xr# | j                  d   dk(  xr | j                  dk7  S )Nr?  r@  r   )r  rð   r4   r3   rÔ   s    r8   r‡   z<Shrinker.widen_to_span_with_recorded_value.<locals>.<lambda>  sJ   € Ø—‘˜)Ñ#ò !ØŸ™Ð$ò!à—M‘M +Ñ.°!Ñ3ò!ð —G‘G˜q‘Lð	 r=   c                 ó~   •— ‰j                   |    j                  t        uxr ‰j                   |    j                  dkD  S r”  )rø   Úrecorded_valuer   r~  rð  s    €r8   r‡   z<Shrinker.widen_to_span_with_recorded_value.<locals>.<lambda>�  s9   ø€ �d—j‘j ‘m×2Ñ2Ô:KÐKò /Ø—
‘
˜1‘×*Ñ*¨QÑ.ð r=   N)r†  r.   r=  r‹  rø   r•   ré   r   r  rö   rÀ   r~   r¿   )rf   rT  r7   Úspan_idxr‚  r  s   `     r8   r©   z*Shrinker.widen_to_span_with_recorded_valuel  s»   ø€ ð" �~‰~Ø�J‰Jñó
ˆð —>‘>Ø×"Ñ" 4§:¡:Ñ.ó
/ó
ˆð �z‰z˜(Ñ#ˆð �L‰L˜˜4Ÿ:™:Ð&Ü˜×,Ñ,Ó-Ð/ñ0à�l‰l˜4Ÿ8™8˜:Ð&ñ'ð 	ð
 	×"Ñ" 4§;¡;×#CÑ#CÀGÓ#LÕMr=   c                 ó4  ‡ ‡‡‡‡— ‰d   j                   Š‰d   j                  Š‰d   j                  }t        ˆˆfd„‰D «       «      sJ ‚‰dk(  rr|d   Š‰ j	                  ‰t        ‰‰z
  «      «       t        j                  t        ‰‰z
  «      ˆˆ ˆfd„«       t        j                  t        ‰‰z
  «      ˆˆ ˆfd„«       y ‰dk(  rb‰ j	                  ‰t        ‰«      «       t        j                  t        ‰«      ˆˆ fd„«       t        j                  t        ‰«      ˆˆ fd	„«       y ‰d
k(  r‰du sJ ‚‰ j	                  ‰d«       y ‰dk(  r t        j                  ‰ˆˆ fd„|d   ¬«       y ‰dk(  r$t        j                  ‰ˆˆ fd„|d   |d   ¬«       y t        ‚)Nr   c              3   ól   •K  — | ]+  }|j                   ‰k(  xr t        |j                  ‰«      –— Œ- y ­wr2   )r  r   r3   )r6   r7   Úchoice_typer3   s     €€r8   r9   z*Shrinker.minimize_nodes.<locals>.<genexpr>£  s5   øè ø€ ò 
àð �I‰I˜Ñ$ÒH¬°d·j±jÀ%Ó)HÓHñ
ùs   ƒ14r?  r‰  c                 ó.   •— ‰j                  ‰‰| z   «      S r2   ©r¿  ©rÁ   r.   rf   r‰  s    €€€r8   r‡   z)Shrinker.minimize_nodes.<locals>.<lambda>±  ó   ø€ ˜$×2Ñ2°5¸.È1Ñ:LÓM€ r=   c                 ó.   •— ‰j                  ‰‰| z
  «      S r2   r  r  s    €€€r8   r‡   z)Shrinker.minimize_nodes.<locals>.<lambda>µ  r  r=   rÙ  c                 ó(   •— ‰j                  ‰| «      S r2   r  ©Úvalr.   rf   s    €€r8   r‡   z)Shrinker.minimize_nodes.<locals>.<lambda>»  ó   ø€ ˜D×4Ñ4°U¸CÓ@€ r=   c                 ó*   •— ‰j                  ‰|  «      S r2   r  r  s    €€r8   r‡   z)Shrinker.minimize_nodes.<locals>.<lambda>¿  s   ø€ ˜D×4Ñ4°U¸S¸DÓA€ r=   ÚbooleanTFr­  c                 ó(   •— ‰j                  ‰| «      S r2   r  r  s    €€r8   r‡   z)Shrinker.minimize_nodes.<locals>.<lambda>É  r  r=   Úmin_size)r  r®  c                 ó(   •— ‰j                  ‰| «      S r2   r  r  s    €€r8   r‡   z)Shrinker.minimize_nodes.<locals>.<lambda>Ï  r  r=   rE   )rE   r  )r  r3   r4   r
  r¿  r™  r$   rà   r#   r"   r&   r  )rf   r.   r4   r  r‰  r3   s   `` @@@r8   rÖ  zShrinker.minimize_nodes™  s€  ü€ Ø˜A‘h—m‘mˆØ�a‘—‘ˆð ˜A‘h×*Ñ*ˆÜô 
àô
ô 
ð 	
ð 
ð
 ˜)Ò#Ø(Ð)9Ñ:ˆNð
 ×$Ñ$ U¬C°ÀÑ0FÓ,GÔHÜ�N‰NÜ�N UÑ*Ó+ÝMôô �N‰NÜ�N UÑ*Ó+ÝMõð ˜GÒ#Ø×$Ñ$ U¬C°«JÔ7Ü�L‰LÜ�E“
Ü@ôô �L‰LÜ�E“
ÜAõð ˜IÒ%à˜D‘=Ð �=à×$Ñ$ U¨EÕ2Ø˜GÒ#Ü�L‰LØÜ@Ø$ ZÑ0öð
 ˜HÒ$Ü�M‰MØÜ@Ø% kÑ2Ø$ ZÑ0ö	ô &Ð%r=   c                 óæ  — |j                  t        t        | j                  «      «      «      }| j                  }| j                  j
                  }| j                  |   }|d |j                   }t        ||j                  |j                   D �cg c]A  }|j                  r|n0|j                  t        d|j                  |j                  «      ¬«      ‘ŒC c}«      }||j                  d  }	| j                  ||z   |	z   «      d   }
| j                  |ury t        |
t         «      rJ|
j                  |   }|
j
                  |j                  |j                   }| j#                  ||z   |	z   «       y y c c}w )Nr   rû   rÑ   )r†  r  r:   rø   r—   r.   ré   r;   rö   rð   r  r   r  r4   r¿   rA  r   rÅ   )rf   rT  rò   rn  r.   r‚  rë   r7   r  Úsuffixr  Únew_spanÚnew_replacements                r8   rŸ   zShrinker.try_trivial_spansÖ  sS  € Ø�N‰Nœ5¤ T§Z¡Z£Ó1Ó2ˆà×!Ñ!ˆØ×"Ñ"×(Ñ(ˆØ�z‰z˜!‰}ˆØ�|˜Ÿ™Ð$ˆÜð " $§*¡*¨t¯x©xÐ8ö	ð ð —’ñ àŸ™Ü#4°Q¸¿	¹	À4×CSÑCSÓ#Tð #ó ñò	ó
ˆð �t—x‘x�zÐ"ˆØ×+Ñ+¨F°[Ñ,@À6Ñ,IÓJÈ1ÑMˆà×Ñ TÑ)Øä�gÔ/Ô0Ø—}‘} QÑ'ˆHØ%Ÿm™m¨H¯N©N¸X¿\¹\ÐJˆOØ×#Ñ# F¨_Ñ$<¸vÑ$EÕFð 1ùò#	s   ÂAE.c           	      óÎ  ‡ ‡— |j                  ‰ j                  d„ «      Š‰ j                  }‰ j                  ‰g«       ‰ j                  |ury‰j                  dk7  ry‰ j                  d‰j
                   ‰j                  ‰j                  dz
  ¬«      fz   ‰ j                  ‰j
                  dz   d z   }‰ j                  |«      d   }|�m|j                  t        j                  k  sPt        |j                  «      t        ‰ j                  «      k(  s%t        |j                  «      ‰j
                  dz   k(  ry|‰ j                  usJ ‚‰ j                  ‰j
                  «      ˆˆ fd„«       }|j                  ddg«      rn‰ j                  |j                  t        |t        ‰ j                  «      «      ˆ fd	„«         }‰ j!                  |d|j"                   ||j$                  d z   «       y‰ j                  |j                  t        ‰j
                  dz   t        ‰ j                  «      «      «         Š‰ j!                  |d‰j
                   |‰j
                  dz   d z   «       y)
aA  Attempt to minimize each choice in sequence.

        This is the pass that ensures that e.g. each integer we draw is a
        minimum value. So it's the part that guarantees that if we e.g. do

        x = data.draw(integers())
        assert x < 10

        then in our shrunk test case, x = 10 rather than say 97.

        If we are unsuccessful at minimizing a choice of interest we then
        check if that's because it's changing the size of the test case and,
        if so, we also make an attempt to delete parts of the test case to
        see if that fixes it.

        We handle most of the common cases in try_shrinking_nodes which is
        pretty good at clearing out large contiguous blocks of dead space,
        but it fails when there is data that has to stay in particular places
        in the list.
        c                 ó   — | j                    S r2   rß  rÜ  s    r8   r‡   z6Shrinker.minimize_individual_choices.<locals>.<lambda>	  s   € ¸4¿<¹<Ð7G€ r=   Nr?  rÑ   rû   c                  óÂ   •— d} t        ‰j                  «      }| dz   |k  r>| |z   dz  }‰j                  |   }|j                  ‰j                  k\  r|}n|} | dz   |k  rŒ>|S )Nr   rÑ   ræ   )r:   rø   ré   r‹  )r  r€  r�  r‚  r7   rf   s       €€r8   Úfirst_span_after_nodezCShrinker.minimize_individual_choices.<locals>.first_span_after_node;  sh   ø€ àˆBÜ�T—Z‘Z“ˆBØ�q‘&˜2’+Ø˜B‘w 1‘n�Ø—z‘z #‘�Ø—:‘: §¡Ò+Ø‘Bà�Bð �q‘&˜2“+ð ˆIr=   TFc                 ó<   •— ‰j                   |    j                  dkD  S rÄ   )rø   r~  rð  s    €r8   r‡   z6Shrinker.minimize_individual_choices.<locals>.<lambda>P  s   ø€ ˜dŸj™j¨™m×8Ñ8¸1Ñ<€ r=   )r†  r.   r—   rÖ  r  r‹  r  r3   r¿   rÇ   r   rÈ   r:   rµ   rø   r  rÅ   ré   rö   )rf   rT  Úinitial_targetÚloweredr  r"  r‚  r7   s   `      @r8   r¤   z$Shrinker.minimize_individual_choicesô  s  ù€ ð* �~‰~˜dŸj™jÑ*GÓHˆØ×+Ñ+ˆà×Ñ˜T˜FÔ#Ø×Ñ ^Ñ3ð ð �9‰9˜	Ò!ð ð �J‰J�|˜Ÿ™Ð$Ø�y‰y D§J¡J°¡NˆyÓ3Ð5ñ6à�j‰j˜Ÿ™ a™Ð)Ð*ñ+ð 	ð
 ×+Ñ+¨GÓ4°QÑ7ˆàˆOØ�~‰~¤§¡Ò,Ü�7—=‘=Ó!¤S¨¯©£_Ò4Ü�7—=‘=Ó! T§Z¡Z°!¡^Ò3ð ð ˜d×0Ñ0Ñ0Ð0Ð0à	�‰�T—Z‘ZÓ	 ô
	ó 
!ð
	ð  �>‰>˜4 ˜-Ô(Ø—:‘:Ø—‘ÜÐ/´°T·Z±Z³ÓAÛ<óñˆDð ×#Ñ# G¨L¨d¯j©jÐ$9¸GÀDÇHÁHÀJÐ<OÑ$OÕPà—:‘:˜gŸn™n¬U°4·:±:À±>Ä3ÀtÇzÁzÃ?Ó-SÓTÑUˆDØ×#Ñ# G¨L¨d¯j©jÐ$9¸GÀDÇJÁJÐQRÁNÐDTÐ<UÑ$UÕVr=   c                 óÞ  ‡ ‡‡‡— |j                  ‰ j                  «      }|j                  |j                  «      j                  }|j                  D �cg c]  }|j                  |k(  sŒ|‘Œ c}Št	        ‰«      dk  ry‰D �cg c]  }|j
                  |j                  f‘Œ c}Š‰ j                  Št        j                  t        t	        ‰«      «      ˆˆ ˆˆfd„ˆˆfd„¬«       yc c}w c c}w )a"  This pass allows us to reorder the children of each span.

        For example, consider the following:

        .. code-block:: python

            import hypothesis.strategies as st
            from hypothesis import given


            @given(st.text(), st.text())
            def test_not_equal(x, y):
                assert x != y

        Without the ability to reorder x and y this could fail either with
        ``x=""``, ``y="0"``, or the other way around. With reordering it will
        reliably fail with ``x=""``, ``y="0"``.
        rÑ   Nc                 óø   •— ‰j                  t        ‰j                  t        ‰| d¬«      D ���cg c]4  \  \  }}}||‰j                  ‰|   j                  ‰|   j
                   f‘Œ6 c}}}«      «      S c c}}}w )NTrý   )rÅ   r    r.   r  ré   rö   )Úindicesr½  r  rò   Ú	endpointsrf   rø   r‘  s       €€€€r8   r‡   z(Shrinker.reorder_spans.<locals>.<lambda>w  s|   ø€ ˜D×3Ñ3ÜØ—H‘Hô *-¨Y¸ÈÔ)M÷ð ñ &™F˜Q  Að	 ØØŸH™H U¨1¡X§^¡^°e¸A±h·l±lÐCòôó
ó€ ùôs   ¯9A5c                 óh   •— t        ‰j                  ‰|    j                  ‰|    j                   «      S r2   )r<   r.   ré   rö   )rò   rø   r‘  s    €€r8   r‡   z(Shrinker.reorder_spans.<locals>.<lambda>„  s'   ø€ œ( 2§8¡8¨E°!©H¯N©N¸UÀ1¹X¿\¹\Ð#JÓK€ r=   rØ   )r†  rø   rµ  rt  r:   ré   rö   r—   r%   rà   r  )rf   rT  r‚  rt  rO   r)  rø   r‘  s   `    @@@r8   r¢   zShrinker.reorder_spansX  s±   û€ ð& �~‰~˜dŸj™jÓ)ˆà—‘˜tŸ}™}Ó-×3Ñ3ˆØ ŸM™MÖ>�q¨Q¯W©W¸Ó-=’Ò>ˆÜˆu‹:˜Š?Øà8=Ö>°�d—j‘j $§(¡(Ò+Ò>ˆ	Ø×Ñˆä�‰Ü”#�e“*Óöô Lö	
ùò ?ùò ?s   ÁC%Á(C%ÂC*c                 ód  — |t        |«      z   t        |j                  «      kD  s|dk  ryt        |j                  «      }t        |«      D ]S  }t	        t        t        |«      «      «      D ]1  \  }}||z   }	|	t        |«      k\  r  y|dk(  r||	= Œ%t        d|›�«      ‚ ŒU | j                  |«      S )a  Node programs are a mini-DSL for node rewriting, defined as a sequence
        of commands that can be run at some index into the nodes

        Commands are:

            * "X", delete this node

        This method runs the node program in ``program`` at node index
        ``i`` on the ConjectureData ``original``. If ``repeats > 1`` then it
        will attempt to approximate the results of running it that many times.

        Returns True if this successfully changes the underlying shrink target,
        else False.
        r   Fr‘   zUnrecognised command )r:   r.   r  r  rÃ  r:  r  rÅ   )
rf   rò   rÇ  rÎ  rÔ  r  rê   r  Úcommandr,  s
             r8   rÒ  zShrinker.run_node_program‡  sº   € ð Œs�7‹|Ñœc (§.¡.Ó1Ò1°Q¸²UØÜ�x—~‘~Ó&ˆÜ�w“ò 		SˆAÜ&¤t¬I°gÓ,>Ó'?Ó@ò S‘
��7Ø˜‘E�Øœ˜G›Ò$Ú à˜c’>Ø ™
ä-Ð0EÀgÀ[Ð.QÓRÐRñSð		Sð ×&Ñ& wÓ/Ð/r=   )r/   N)r/   r+   )rÑ   )Krd   rk   rl   Ú__doc__r|   r   r   r-   r   rê  r­   r¯   rµ   r{   ro   r_   r`   r¹   r   r   r;   r   r¿   rÅ   rÀ   rn   rÌ   rÎ   rà   r‚   rä   r  rÛ   rÚ   r=  r8  rB  ru  r
   r'   rN  rZ   rW  r  r6  r.   r   r•   r   rø   rv  rx  r¡   r›  r˜   r   rF   r—  rÉ   r¿  ra  rÆ  r    rÊ  r£   r¥   r¦   r§   r¨   r©   rÖ  rŸ   r¤   r¢   rÒ  r]   r=   r8   rs   rs   •   s>  „ ñDòL ð6 !&ò?&à"ð?&ð  Ð"2Ñ2ð?&ð $ dÑ*ð	?&ð �nÐ'7Ñ7¸ÐHÈ$ÐNÑOÐRVÑVð?&ð ð?&ð ó?&ðB ñó ðòð ð&�sò &ó ð&ð
 ð,˜Cò ,ó ð,ó ð<Ø˜jÑ)ð<à	ˆtÐ%¨Ñ0°4Ñ7Ð7Ñ	8ó<ð43¨°Ñ(<ð 3Àó 3ò
,ð˜ð  ó ð ò"ó ð"ó6ópókðZ Øð Ø"ð à	(ó óD6ò'ð ñ)ó ð)ò;òzð> ð'¨$¨s°J¨Ñ*?ò 'ó ð'ð EJò  
ð ¸Tð Èdó ð<\4¨4°
Ñ+;ð \4Àó \4ð| ð(�u˜Z¨˜_Ñ-ò (ó ð(ð ð*˜˜w¨˜|Ñ,ò *ó ð*ð ð(�uò (ó ð(ð ñ	$ó ð	$ð ñ4ó ð4ò8
òtN%ò`)ò$ð ð(  S¡ò (ó ð(ò2#ò GòR)ðV ñ)ó ð)ð
 Cð 
¨Jó 
ò
òB#ò:Lò\=òB>
ò@"òH+NòZ;&òzGò<bWòH-
ô^0r=   rs   )DrÚ  rH   Úcollectionsr   Úcollections.abcr   r   r   Údataclassesr   Ú	functoolsr   Útypingr	   r
   r   r   r   Ú%hypothesis.internal.conjecture.choicer   r   r   r   r   r   r   r   r   Ú#hypothesis.internal.conjecture.datar   r   r   r   r   r   r   Ú)hypothesis.internal.conjecture.junkdrawerr   r   r    r!   Ú(hypothesis.internal.conjecture.shrinkingr"   r#   r$   r%   r&   Ú3hypothesis.internal.conjecture.shrinking.choicetreer'   r(   r)   Úhypothesis.internal.floatsr*   rÎ   r+   Ú%hypothesis.internal.conjecture.enginer,   rê  r-   rm   r;   ro   r<   rV   rZ   Ú	Exceptionrq   rs   r]   r=   r8   ú<module>r;     s  ðô Û Ý #ß 8Ñ 8Ý !Ý ÷õ ÷
÷ 
õ 
÷÷ ñ ÷ó ÷õ ÷ñ õ
 ;áÝåFà&Ð(8¸8Ñ(CÐ'DÀdÐ'JÑKÐ �)Ó Kð�H˜ZÑ(ð ¨U°3¸¸cÀ3¸h¹Ð3GÑ-Hó ñ0 �4Ôñ@ó ð@ñ6 �˜eÔ$÷ð ó %ðô&	�Iô 	÷O0ò O0r=   