Ë
    iKêjd9  ã            	       óÄ  — U d dl Z 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mZ d dlmZ d dlmZmZ d d	lmZmZ d d
lmZ d dlmZ d dl m!Z! d dl"m#Z# d dl$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/ de0dede0fd„Z1dede0fd„Z2defd„Z3eded   dz  defd„«       Z4ede5ded   fd„«       Z4de5ded   fd„Z4 e*ed      d«      Z6de7fd„Z8d9d „Z9e
d!e0d"eded#   fd$„«       Z: G d%„ d«      Z;d&eg ef   ddfd'„Z<de7fd(„Z=d)e5ddfd*„Z>d:d)e0d,eddfd-„Z? e«       Z@eee0f   eAd.<   e0fd/œd0ed1eBeCd2f   d3e7defd4„ZDd+d5œd6eEeFz  d7e0deEeFz  fd8„ZGy);é    N)Údefaultdict)ÚCallableÚ	GeneratorÚSequence)Úcontextmanager)ÚTracebackType)ÚAnyÚLiteralÚNoReturnÚOptionalÚSelfÚoverload)ÚWeakKeyDictionary)Ú	VerbosityÚsettings)ÚInvalidArgumentÚUnsatisfiedAssumption)ÚConjectureData)Úobservability_enabled)Úget_pretty_function_description)Ú
check_type)ÚreportÚverbose_report)Únote_deprecation)ÚDynamicVariable)Ú
ArgLabelsTÚIDKeyÚPrettyPrintFunctionÚprettyÚwhatÚframeÚreturnc                 ól   — |j                   }| › d|j                  j                  › d|j                  › d�S )Nz() in z (line ú))Úf_backÚf_codeÚco_nameÚf_lineno)r    r!   Úwheres      úW/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/hypothesis/control.pyÚ_calling_function_locationr+   !   s4   € Ø�L‰L€EØˆV�6˜%Ÿ,™,×.Ñ.Ð/¨w°u·~±~Ð6FÀaÐHÐHó    c                 ód   — | j                   }|j                  j                  › d|j                  › �S )Nú:)r%   r&   Úco_filenamer(   )r!   r)   s     r*   Ú_calling_frame_locationr0   &   s,   € Ø�L‰L€EØ�l‰l×&Ñ&Ð' q¨¯©Ð(8Ð9Ð9r,   c                  ó$  — t         j                  €t        ddd¬«       t        j                  «       } t        d| «      }t        «       r3t        «       j                  j                  |   }|j                  d¬«       t        |t        | «      ¬«      ‚)Nz:Using `reject` outside a property-based test is deprecatedú
2023-09-25F©ÚsinceÚhas_codemodÚreject©Ú	condition©Úlocation)Ú_current_build_contextÚvaluer   ÚinspectÚcurrentframer+   Úcurrently_in_test_contextÚcurrent_build_contextÚdataÚ_observability_predicatesÚupdate_countr   r0   )r!   r)   Úcountss      r*   r6   r6   +   s~   € Ü×#Ñ#Ð+ÜØHØØõ	
ô
 × Ñ Ó"€EÜ& x°Ó7€EÜ Ô"Ü&Ó(×-Ñ-×GÑGÈÑNˆØ×Ñ eÐÔ,Ü
 Ô0GÈÓ0NÔ
OÐOr,   r8   Fc                  ó   — y ©N© r7   s    r*   ÚassumerH   :   s   € Ø:=r,   Tc                  ó   — y rF   rG   r7   s    r*   rH   rH   <   s   € Ø03r,   c                 ón  — t         j                  €t        ddd¬«       t        «       s| s‹t	        j
                  «       }t        d|«      }t        «       rFt        «       r<t        «       j                  j                  |   }|j                  t        | «      ¬«       | st        d|› �t        |«      ¬«      ‚y	)
a  Calling ``assume`` is like an :ref:`assert <python:assert>` that marks
    the |test case| as bad, rather than failing the test.

    This allows you to specify properties that you *assume* will be
    true, and let Hypothesis try to avoid similar test cases in future.
    z:Using `assume` outside a property-based test is deprecatedr2   Fr3   rH   r7   zfailed to satisfy r9   T)r;   r<   r   r   r=   r>   r+   r?   r@   rA   rB   rC   Úboolr   r0   )r8   r!   r)   rD   s       r*   rH   rH   @   s¦   € ô ×#Ñ#Ð+ÜØHØØõ	
ô
 Ô¡iÜ×$Ñ$Ó&ˆÜ*¨8°UÓ;ˆÜ Ô"Ô'@Ô'BÜ*Ó,×1Ñ1×KÑKÈEÑRˆFØ×Ñ¬$¨y«/ÐÔ:ÙÜ'Ø$ U GÐ,Ü0°Ó7ôð ð r,   ÚBuildContextc                  ó&   — t         j                  duS )ad  Return ``True`` if the calling code is currently running inside an
    |@given| or :ref:`stateful <stateful>` test, and ``False`` otherwise.

    This is useful for third-party integrations and assertion helpers which
    may be called from either traditional or property-based tests, and can only
    use e.g. |assume| or |target| in the latter case.
    N)r;   r<   rG   r,   r*   r?   r?   ^   s   € ô "×'Ñ'¨tÐ3Ð3r,   c                  ó@   — t         j                  } | €t        d«      ‚| S )NzNo build context registered)r;   r<   r   ©Úcontexts    r*   r@   r@   i   s#   € Ü$×*Ñ*€GØ€ÜÐ;Ó<Ð<Ø€Nr,   ÚfmtÚargs)NNNc              '   óê   K  — ddl m} t        j                  «       }d –— t        j                  «       }||k7  r8t	        |«      |j
                  vr t        d | j                  |Ž z   ddd¬«       y y y ­w)Nr   )ÚentropyznDo not use the `random` module inside strategies; instead consider `st.randoms()`, `st.sampled_from()`, etc.  z
2024-02-05Fé   )r4   r5   Ú
stacklevel)Úhypothesis.internalrT   ÚrandomÚgetstateÚhashÚ_known_random_state_hashesr   Úformat)rQ   rR   rT   Ústate_beforeÚstate_afters        r*   Údeprecate_random_in_strategyr_   p   sx   è ø€ å+ä—?‘?Ó$€LÛ	Ü—/‘/Ó#€Kð( 	�|Ò#Ü�Ó W×%GÑ%GÑGäðCØEOÀSÇZÁZÐQUÐEVñWàØØö	
ð Hð 	$ùs   ‚A1A3c                   óÌ   — e Zd Zddœdedededdfd„Zdd	œd
ededee   de	e
ef   dedz  ddfd„Zde	e
ef   dee	e
ef   ef   fd„Zdd„Zdee   dz  dedz  dedz  ddfd„Zy)rL   F)Úis_finalrA   ra   Úwrapped_testr"   Nc                ód   — || _         g | _        || _        || _        t	        t
        «      | _        y rF   )rA   Útasksra   rb   r   ÚlistÚknown_object_printers)ÚselfrA   ra   rb   s       r*   Ú__init__zBuildContext.__init__—   s3   € ð ˆŒ	Ø.0ˆŒ
Ø ˆŒØ(ˆÔô œÓð 	Õ"r,   ©Ú
arg_labelsÚobjÚfuncrR   Úkwargsrj   c                óf   ‡‡— | j                   t        |«         j                  ||dœˆˆfd„
«       y )N)Ú_funcÚ_arg_labelsc                óD   •— |j                  | |t        |«      ‰‰|¬«      S )Nri   )Úmaybe_repr_known_object_as_callr   )rk   ÚpÚcyclero   rp   rR   rm   s        €€r*   ú<lambda>z*BuildContext.record_call.<locals>.<lambda>´   s1   ø€ È×IjÑIjØØÜ/°Ó6ØØØ&ð Jkó J€ r,   )rf   r   Úappend)rg   rk   rl   rR   rm   rj   s      `` r*   Úrecord_callzBuildContext.record_callª   s,   ù€ ð 	×"Ñ"¤5¨£:Ñ.×5Ñ5Ø+/¸Zö õ		
r,   Úkwarg_strategiesc                 ó6  — i }i }|j                  «       D ]g  \  }}| j                  j                  |«      5 }t        d||«      5  | j                  j	                  |d|› �¬«      ||<   d d d «       d d d «       |z  }Œi ||fS # 1 sw Y   ŒxY w# 1 sw Y   Œ xY w)Nzfrom {}={!r}z	generate:)Ú
observe_as)ÚitemsrA   Útrack_arg_labelr_   Údraw)rg   rx   rj   rm   ÚkÚsÚ	arg_labels          r*   Ú prep_args_kwargs_from_strategiesz-BuildContext.prep_args_kwargs_from_strategies¾   s¸   € ð "$ˆ
Ø!#ˆà$×*Ñ*Ó,ò 	$‰DˆAˆqà—	‘	×)Ñ)¨!Ó,ðJØ09Ü,¨^¸QÀÓBñJð !ŸI™IŸN™N¨1¸9ÀQÀC¸˜NÓI��q‘	÷	J÷ Jð
 ˜)Ñ#‰Jð	$ð �zÐ!Ð!÷Jð Jú÷ Jð Jús#   ¶BÁ$BÁ(BÂBÂBÂB	c                 ón   — t         j                  | «      | _        | j                  j                  «        | S rF   )r;   Ú
with_valueÚassign_variableÚ	__enter__)rg   s    r*   r…   zBuildContext.__enter__Ï   s,   € Ü5×@Ñ@ÀÓFˆÔØ×Ñ×&Ñ&Ô(Øˆr,   Úexc_typeÚ	exc_valueÚtbc                 ó  — | j                   j                  |||«       g }| j                  D ]
  }	  |«        Œ |r!t        |«      dk(  r|d   |‚t        d|«      |‚y # t        $ r}|j	                  |«       Y d }~ŒPd }~ww xY w)NrU   r   zCleanup failed)r„   Ú__exit__rd   ÚBaseExceptionrv   ÚlenÚBaseExceptionGroup)rg   r†   r‡   rˆ   ÚerrorsÚtaskÚerrs          r*   rŠ   zBuildContext.__exit__Ô   s‘   € ð 	×Ñ×%Ñ% h°	¸2Ô>ØˆØ—J‘Jò 	#ˆDð#Ù•ð	#ñ
 Ü�6‹{˜aÒØ˜Q‘i YÐ.Ü$Ð%5°vÓ>ÀIÐMð øô !ò #Ø—‘˜c×"Ñ"ûð#ús   °AÁ	BÁ&A<Á<B)r"   r   )Ú__name__Ú
__module__Ú__qualname__r   rK   r   rh   Úobjectr   ÚdictÚstrr   rw   r	   Útupler�   r…   Útyper‹   r   rŠ   rG   r,   r*   rL   rL   –   s  „ ð
 ò	
àð
ð ð	
ð
 ð
ð 
ó
ð4 )-ò
àð
ð ð
ð
 �vÑð
ð �S˜&�[Ñ!ð
ð  Ñ%ð
ð 
ó
ð("à˜s C˜x™.ð"ð 
ˆt�C˜�H‰~˜zÐ)Ñ	*ó"ó"ð
Nà�}Ñ%¨Ñ,ðNð ! 4Ñ'ðNð ˜DÑ ð	Nð
 
ôNr,   Úteardownc                 ót   — t         j                  }|€t        d«      ‚|j                  j	                  | «       y)au  Register a function to be called when the current test has finished
    executing. Any exceptions thrown in teardown will be printed but not
    rethrown.

    Inside a test this isn't very interesting, because you can just use
    a finally block, but note that you can use this inside map, flatmap,
    etc. in order to e.g. insist that a value is closed at the end.
    Nz0Cannot register cleanup outside of build context)r;   r<   r   rd   rv   )r™   rP   s     r*   Úcleanupr›   ç   s2   € ô %×*Ñ*€GØ€ÜÐPÓQÐQØ‡M�M×Ñ˜Õ"r,   c                  óÒ   — t         j                  } | €t        d«      ‚t        j                  €J ‚| j
                  xs+ t        j                  j                  t        j                  k\  S )Nz#Cannot make notes outside of a test)	r;   r<   r   r   Údefaultra   Ú	verbosityr   ÚverboserO   s    r*   Úshould_noter    ö   sX   € Ü$×*Ñ*€GØ€ÜÐCÓDÐDÜ×ÑÐ'Ð'Ð'Ø×ÑÒNœx×/Ñ/×9Ñ9¼Y×=NÑ=NÑNÐNr,   r<   c                 óö   — t        «       }|s
t        «       rct        | t        «      st	        | «      } t
        j                  }|€J ‚t        «       r|j                  j                  | «       |rt        | «       yyy)al  
    Record a note on this |test case|. Non-string values will be automatically converted
    to a string.

    This value is reported for the |minimal failing test case|, and on |Verbosity.verbose|
    or higher.

    Notes are also recorded in the ``metadata.notes`` key of each test case
    observation, if :ref:`observability <observability>` is enabled.
    N)
r    r   Ú
isinstancer–   r   r;   r<   rA   Únoter   )r<   Úshould_reportrP   s      r*   r£   r£   þ   sj   € ô  “M€MÙÔ-Ô/Ü˜%¤Ô%Ü˜5“MˆEÜ(×.Ñ.ˆØÐ"Ð"Ð"Ü Ô"Ø�L‰L×Ñ˜eÔ$ÙÜ�5�Mð ð 0r,   Ú Úpayloadc                 ó  — t         j                  }|€t        d«      ‚|j                  j                  j
                  }t        |t        t        t        f|¬«      }t        | |¬«      } ||j                  j                  | <   y)a]  Record an event that occurred during this test. Statistics on the number of test
    runs with each event will be reported at the end if you run Hypothesis in
    statistics reporting mode.

    Event values should be strings or convertible to them.  If an optional
    payload is given, it will be included in the string for :ref:`statistics`.
    Nz&Cannot record events outside of a test)Úallowed_typesÚavoid_realization)r©   )r;   r<   r   rA   Úproviderr©   Ú_serialize_eventr–   ÚintÚfloatÚevents)r<   r¦   rP   r©   s       r*   Úeventr¯     sr   € ô %×*Ñ*€GØ€ÜÐFÓGÐGàŸ™×-Ñ-×?Ñ?ÐÜØ¤¤S¬%Ð0ÐDUô€Gô ˜UÐ6GÔH€EØ!(€G‡L�L×Ñ˜Òr,   Ú_events_to_strings)r¨   r¯   r¨   .r©   c                óÄ   — t        | |«      r| S |rt        | «      S 	 t        |    S # t        t        f$ r Y nw xY wt        | «      }	 |t        | <   |S # t        $ r Y |S w xY wrF   )r¢   r–   r°   ÚKeyErrorÚ	TypeError)r¯   r¨   r©   Úresults       r*   r«   r«   ,  s„   € ô �%˜Ô'Øˆñ
 Ü�5‹zÐðÜ! %Ñ(Ð(øÜ”iÐ ò Ùðúô �‹Z€FðØ$*Ô˜5Ñ!ð €Møô ò ØØ€Mðús   �& ¦8·8Á	A Á	AÁA)ÚlabelÚobservationrµ   c                ó   — t        t        t        f| d«       t        j                  | «      st        d| ›d�«      ‚t        t        |d«       t        j                  }|€t        d«      ‚|j                  j                  j                  r| S t        d| ›d|›d�«       ||j                  j                  v r/t        d	| ›d|›d
|j                  j                  |   ›d|›d�	«      ‚| |j                  j                  |<   | S )aj  Calling this function with an ``int`` or ``float`` observation gives it feedback
    with which to guide our search for inputs that will cause an error, in
    addition to all the usual heuristics.  Observations must always be finite.

    Hypothesis will try to maximize the observed value over several |test cases|;
    almost any metric will work so long as it makes sense to increase it.
    For example, ``-abs(error)`` is a metric that increases as ``error``
    approaches zero.

    Example metrics:

    - Number of elements in a collection, or tasks in a queue
    - Mean or maximum runtime of a task (or both, if you use ``label``)
    - Compression ratio for data (perhaps per-algorithm or per-level)
    - Number of steps taken by a state machine

    The optional ``label`` argument can be used to distinguish between
    and therefore separately optimise distinct observations, such as the
    mean and standard deviation of a dataset.  It is an error to call
    ``target()`` with any label more than once per test case.

    .. note::
        The more test cases you run, the better this technique works.

        As a rule of thumb, the targeting effect is noticeable above
        :obj:`max_examples=1000 <hypothesis.settings.max_examples>`,
        and immediately obvious by around ten thousand test cases
        *per label* used by your test.

    :ref:`statistics` include the best score seen for each label,
    which can help avoid `the threshold problem
    <https://hypothesis.works/articles/threshold-problem/>`__ when the minimal
    test case shrinks right down to the threshold of failure (:issue:`2180`).
    r¶   zobservation=z must be a finite float.rµ   zvCalling target() outside of a test is invalid.  Consider guarding this call with `if currently_in_test_context(): ...`zSaw target(z, label=r$   zCalling target(z) would overwrite target()r   r¬   r­   ÚmathÚisfiniter   r–   r;   r<   rA   rª   r©   r   Útarget_observations)r¶   rµ   rP   s      r*   Útargetr»   E  s	  € ôF ””Uˆ|˜[¨-Ô8Ü�=‰=˜Ô%Ü   Ð.FÐGÓHÐHÜŒs�E˜7Ô#ä$×*Ñ*€GØ€ÜðUó
ð 	
ð 
�‰×	Ñ	×	0Ò	0ð ÐÜ�[  ¨y°%°¸Ð;Ô<à�—‘×0Ñ0Ñ0ÜØ˜k˜_¨I¨u¨hð 7Ø—l‘l×6Ñ6°uÑ=Ð@À	À5À(È!ðMó
ð 	
ð
 3>ˆ�‰×(Ñ(¨Ñ/àÐr,   )r"   rL   )r¥   )Hr=   r¸   rX   Úcollectionsr   Úcollections.abcr   r   r   Ú
contextlibr   Útypesr   Útypingr	   r
   r   r   r   r   Úweakrefr   Ú
hypothesisr   r   Úhypothesis.errorsr   r   Ú#hypothesis.internal.conjecture.datar   Ú!hypothesis.internal.observabilityr   Úhypothesis.internal.reflectionr   Úhypothesis.internal.validationr   Úhypothesis.reportingr   r   Úhypothesis.utils.deprecationr   Ú!hypothesis.utils.dynamicvariablesr   Úhypothesis.vendor.prettyr   r   r   r   r–   r+   r0   r6   rH   r”   r;   rK   r?   r@   r_   rL   r›   r    r£   r¯   r°   Ú__annotations__r—   r˜   r«   r¬   r­   r»   rG   r,   r*   ú<module>rÍ      s  ðô Û Û Ý #ß 9Ñ 9Ý %Ý ß C× CÝ %ç *ß DÝ >Ý CÝ JÝ 5ß 7Ý 9Ý =ß SÓ SðI Sð I°ð I¸ó Ið
: 3ð :¨3ó :ð
P�ó Pð 
Ø =�g˜e‘n tÑ+Ð =°Ò =ó 
Ø =Ø	Ø 3�fÐ 3 ¨¡Ò 3ó 
Ø 3ð�fð  ¨¡ó ð6 C˜¨°.Ñ)AÑBÀ4ÓHÐ ð4 4ó 4óð ð"
 cð "
°#ð "
¸)ÐDTÑ:Uò "
ó ð"
÷JNNñ NNðb#�h˜r 3˜wÑ'ð #¨Dó #ðO�Tó Oð�ð ˜4ó ñ.)�ð )˜sð )¨Dó )ñ( 3DÓ2EÐ Ð% c¨3 hÑ/Ó Eð 7:°VòØðØ"'¨¨c¨	Ñ"2ðØPTðàóð2 68ò =˜˜e™ð =¨sð =¸CÀ%¹Kô =r,   