
    iL                        % S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
JrJr  SSKJr  SSKJr  SSKJrJr  SSKJr  SSKJr  SS	KJrJrJrJrJrJrJr  SS
KJr  SSK J!r!  SSK"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+  SSK,J-r-  SSK.J/r/  SSK0J1r1  SSK2J3r3  \(       a
  SSK4J5r5J6r6J7r7  \S   r8\\9S'   \\8/S4   r:\\9S'   \\8\;/S4   r<\\9S'   \:\<-  r=\\9S'   0 r>\?\;S-  \@\:   4   \9S'   / rA\@\<   \9S'   \" SSS9 " S S5      5       rBS\'S-  S\4S  jrCS!\D\'S"4   S\@\   4S# jrES$\(S%\%S\?\F\4   4S& jrGS'\D\&S"4   S\@\?\F\4      4S( jrH\" SSS9 " S) S*5      5       rI\" SSS9 " S+ S,5      5       rJ\S-   rK\S.   rL\" SSS9 " S/ S0\J5      5       rM\" SSS9 " S1 S2\J5      5       rNSS3.S4\=S5\OSS4S6 jjrPS4\=SS4S7 jrQS\O4S8 jrR\SS3.S4\\8/S4   S5\OS\S9   4S: jj5       rSS;\8SS4S< jrT " S= S>5      rU\U" 5       rVS?SSSSSSSS@.SA\WSB\FSCSDSE\FSF\FSG\?\F\W4   SH\?S-  SI\?\F\@\;   4   S-  SJ\FS-  SK\?\F\4   S-  SL\\LSM4   S-  SN\FS-  SO\?\F\4   S-  S\N4SP jjrX\Y" 5       rZ\" 5       r[S;\8SQ\;SS4SR jr\\R                  " 5       r]\S\?\F\4   4SS j5       r^ST\R                  ;  r`SU\R                  ;   ra\`SL a%  \R                  SSV SW:  a  \	R                  " SX\!SVSY9  SZ\R                  ;   d  \`SL al  \P" \\SS39  \R                  " 5       \" S[S\9-
  R                  5       rf\" S]SS^9R                  S_5       H$  rh\hR                  \f:  d  M  \hR                  SS`9  M&     gg)azMObservability tools to spit out analysis-ready tables, one row per test case.    N)Callable	Generator)contextmanager)	dataclass)date	timedelta)	lru_cache)Lock)TYPE_CHECKINGAnyLiteralOptional	TypeAliasUnioncast)storage_directory)HypothesisWarning)	BooleanConstraintsBytesConstraintsChoiceConstraintsT
ChoiceNodeChoiceTChoiceTypeTFloatConstraintsIntegerConstraintsStringConstraints)InterestingOrigin)float_to_int)IntervalSetnote_deprecation)ConjectureDataSpansStatus)InfoObservationTestCaseObservationObservationCallbackThreadTCallbackAllThreadsT	CallbackT
_callbacks_callbacks_all_threadsTF)slotsfrozenc                   D    \ rS rSr% Sr\\S'   Sr\\S'   S\SS4S jr	S	r
g)
PredicateCountsH   r   	satisfiedunsatisfied	conditionreturnNc                h    U(       a  U =R                   S-  sl         g U =R                  S-  sl        g )N   )r2   r3   )selfr4   s     `/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/hypothesis/internal/observability.pyupdate_countPredicateCounts.update_countM   s$    NNaN!     )__name__
__module____qualname____firstlineno__r2   int__annotations__r3   boolr:   __static_attributes__r=   r<   r9   r0   r0   H   s)    IsK" "$ "r<   r0   choicer5   c                    U c  g [        U [        5      (       a1  [        U [        5      (       d  [        U 5      S:  a  S[	        U 5      /$ [        U [
        5      (       a&  S[        R                  " U 5      R                  5       /$ [        U [        5      (       a(  [        R                  " U 5      (       a  S[        U 5      /$ U $ )Nl            integerbytesfloat)
isinstancerB   rD   absstrrI   base64	b64encodedecoderJ   mathisnanr   )rF   s    r9   _choice_to_jsonrS   T   s    ~ 	6364((K5 3v;''	FE	"	"))&188:;;	FE	"	"tzz&'9'9 f-..Mr<   choices.c                 D    U  Vs/ s H  n[        U5      PM     sn$ s  snf N)rS   )rT   rF   s     r9   choices_to_jsonrW   h   s    29:'OF#':::s   choice_typeconstraintsc           	      
   UR                  5       nU S:X  at  [        [        U5      n[        US   5      [        US   5      US   c  S O2US   R	                  5        VVs/ s H  u  p#[        U5      U4PM     snn[        US   5      S.$ U S:X  a5  [        [
        U5      n[        US   5      [        US   5      US   US	   S
.$ U S:X  aU  [        [        U5      n[        US   [        5      (       d   eUS   R                  [        US   5      [        US   5      S.$ U S:X  a-  [        [        U5      n[        US   5      [        US   5      S.$ U S:X  a  [        [        U5      nSUS   0$ [        SU  35      es  snnf )NrH   	min_value	max_valueweightsshrink_towards)r[   r\   r]   r^   rJ   	allow_nansmallest_nonzero_magnitude)r[   r\   r_   r`   string	intervalsmin_sizemax_size)rb   rc   rd   rI   )rc   rd   booleanpzunknown choice type )copyr   r   rS   itemsr   r   rK   r   rb   r   r   NotImplementedError)rX   rY   kvs       r9   _constraints_to_jsonrl   l   s    ""$Ki-{;([)AB([)AB y)1 
 9DI8N8T8T8V8V_Q'+8V .k:J.KL
 	
 
	+[9([)AB([)AB$[1*56R*S	
 	
 
	 ,k:+k2K@@@@$[1;;'J(?@'J(?@
 	

 
	+[9'J(?@'J(?@
 	
 
		!-{;S!
 	
 "$8"FGGEs   E?
nodesc           	          U  Vs/ s HO  nUR                   [        UR                  5      [        UR                   UR                  5      UR
                  S.PMQ     sn$ s  snf )N)typevaluerY   
was_forced)ro   rS   rp   rl   rY   rq   )rm   nodes     r9   nodes_to_jsonrs      s]      D II$TZZ0/		4;K;KL//		
   s   AAc                       \ rS rSr% \S-  \S'   \S-  \S'   \\\4   \S'   \\\4   \S'   \	\   \S'   \
\S'   \\S	'   S
\S'   \\S'   \S-  \S'   \\S4   S-  \S'   \S   \S'   S\\\4   4S jrSrg)ObservationMetadata   N	tracebackreproduction_decorator
predicatesbackendsys_argv	os_getpidimported_atr$   data_statusphaseinteresting_origin.choice_nodesr#   choice_spansr5   c                 T   U R                   U R                  U R                  U R                  U R                  U R
                  U R                  U R                  U R                  U R                  U R                  c  S O[        U R                  5      U R                  c  S OQU R                   Vs/ s H:  n[        UR                  5      UR                  UR                   UR"                  4PM<     snS.n[%        U5      [%        [&        R(                  " U 5      5      :X  d   eU$ s  snf )N)rw   rx   ry   rz   zsys.argvzos.getpid()r}   r~   r   r   r   r   )rw   rx   ry   rz   r{   r|   r}   r~   r   r   r   rs   r   rM   labelstartend	discardedlendataclassesfields)r8   spandatas      r9   to_jsonObservationMetadata.to_json   s    &*&A&A//||>>++++ZZ"&"9"9))1}TEVEV7W $$,  !% 1 1 !2 DJJ


 !2# 
D 4yC 2 24 89999%s   /AD%r=   )r>   r?   r@   rA   rM   rC   dictr0   r   listrB   rJ   r   tupler   r   r   rE   r=   r<   r9   ru   ru      s    Tz$J&S/)**#s(^3iNJ)D00
C(4//7##$c3h $r<   ru   c                   :    \ rS rSr% \S   \S'   \\S'   \\S'   Srg)BaseObservation   )	test_caseinfoalerterrorro   property	run_startr=   N)	r>   r?   r@   rA   r   rC   rM   rJ   rE   r=   r<   r9   r   r      s    
7
88Mr<   r   )r   r   r   )gave_uppassedfailedc                   :    \ rS rSr% \\S'   \\S'   \\-  \S'   Srg)r%      ro   titlecontentr=   N)	r>   r?   r@   rA   InfoObservationTyperC   rM   r   rE   r=   r<   r9   r%   r%      s    
J4Zr<   r%   c                       \ rS rSr% Sr\S   \S'   \\S'   \\S'   \\S'   \	\S'   \\S	'   \	\S
'   \	\\
\   4   S-  \S'   \	\\4   \S'   \\S'   Srg)r&      Fr   ro   statusstatus_reasonrepresentation	argumentshow_generatedfeaturesNcoveragetimingmetadatar=   )r>   r?   r@   rA   __test__r   rC   TestCaseStatusrM   r   r   rB   rJ   ru   rE   r=   r<   r9   r&   r&      sa    H
+
ON3S	>"T))e!!r<   r&   all_threadsfr   c                   U(       a$  [         R                  [        [        U 5      5        g[        R
                  " 5       nU[        ;  a	  / [        U'   [        U   R                  [        [        U 5      5        g)a(  
Adds ``f`` as a callback for :ref:`observability <observability>`. ``f``
should accept one argument, which is an observation. Whenever Hypothesis
produces a new observation, it calls each callback with that observation.

If Hypothesis tests are being run from multiple threads, callbacks are tracked
per-thread. In other words, ``add_observability_callback(f)`` only adds ``f``
as an observability callback for observations produced on that thread.

If ``all_threads=True`` is passed, ``f`` will instead be registered as a
callback for all threads. This means it will be called for observations
generated by all threads, not just the thread which registered ``f`` as a
callback. In this case, ``f`` will be passed two arguments: the first is the
observation, and the second is the integer thread id from
:func:`python:threading.get_ident` where that observation was generated.

We recommend against registering ``f`` as a callback for both ``all_threads=True``
and the default ``all_threads=False``, due to unclear semantics with
|remove_observability_callback|.
N)r,   appendr   r)   	threading	get_identr+   r(   )r   r   	thread_ids      r9   add_observability_callbackr     sZ    * %%d+>&BC##%I
" "
9y  oq!9:r<   c                   U [         ;   a#  [         R                  [        [        U 5      5        [        R
                  " 5       nU[        ;  a  g[        U   nX;   a  UR                  [        [        U 5      5        U(       d  [        U	 gg)z
Removes ``f`` from the :ref:`observability <observability>` callbacks.

If ``f`` is not in the list of observability callbacks, silently do nothing.

If running under multiple threads, ``f`` will only be removed from the
callbacks for this thread.
N)r,   remover   r)   r   r   r+   r(   )r   r   	callbackss      r9   remove_observability_callbackr   #  sp     	""%%d+>&BC##%I
"9%I~oq12y! r<   c                  L    [        [        5      =(       d    [        [        5      $ )af  
Returns whether or not Hypothesis considers :ref:`observability <observability>`
to be enabled. Observability is enabled if there is at least one observability
callback present.

Callers might use this method to determine whether they should compute an
expensive representation that is only used under observability, for instance
by |alternative backends|.
)rD   r+   r,   r=   r<   r9   observability_enabledr   ;  s     
;t$:;;r<   )NNNc            #   ^   #    [        XS9   Sv   [        U 5        g! [        U 5        f = f7f)z
A simple context manager which calls |add_observability_callback| on ``f``
when it enters and |remove_observability_callback| on ``f`` when it exits.
r   N)r   r   )r   r   s     r9   with_observability_callbackr   H  s(      q:)%a(%a(s   
- -*-observationc                     [         R                  " 5       n[        R                  U/ 5       H  nU" U 5        M     [         H  nU" X5        M     g rV   )r   r   r+   getr,   )r   r   callbacks      r9   deliver_observationr   W  sA    ##%INN9b1 2 +( +r<   c                   ,    \ rS rSrS rS rS rS rSrg)_TestcaseCallbacksia  c                 @    U R                  5         [        [        5      $ rV   )_note_deprecationrD   r+   r8   s    r9   __bool___TestcaseCallbacks.__bool__b  s     Jr<   c                     [        SSSS9  g )Nzhypothesis.internal.observability.TESTCASE_CALLBACKS is deprecated. Replace TESTCASE_CALLBACKS.append with add_observability_callback, TESTCASE_CALLBACKS.remove with remove_observability_callback, and bool(TESTCASE_CALLBACKS) with observability_enabled().z
2025-08-01F)sincehas_codemodr    r   s    r9   r   $_TestcaseCallbacks._note_deprecationf  s    E 	
r<   c                 :    U R                  5         [        U5        g rV   )r   r   r8   r   s     r9   r   _TestcaseCallbacks.appendp  s     "1%r<   c                 :    U R                  5         [        U5        g rV   )r   r   r   s     r9   r   _TestcaseCallbacks.removet  s     %a(r<   r=   N)	r>   r?   r@   rA   r   r   r   r   rE   r=   r<   r9   r   r   a  s     
&)r<   r   z	<unknown>)r   r   r   r   backend_metadatar   r   r   r   r   r   r"   r   r   r   r   r   r   r   r   r$   r   r   c                    SSK Jn  SSKJn  UR                  (       d   eUb  OoUR
                  (       a  [        UR
                  5      nOHUS:X  a  UR                  UR                  :X  a  SnO%[        UR                  R                  SS5      5      nUR                  SUR                  SUR                  S	UR                  S
0nU
b  [        X5      (       a  X   n
U
c  XR                     n
[        SU
UUU=(       d    0 R!                  5        VVs0 s H  u  nnUR#                  S5      U_M     snnU0 UR$                  R!                  5        VVs0 s H  u  nnSU 3R'                  S5      U_M     snnEUR                  EUU[)        S0 UR*                  U
S
:X  a  U" UR,                  5      OS [/        UR0                  5      U	=(       d    0 UR                  UUR
                  [2        (       a  UR4                  OS [2        (       a  UR6                  OS S.	[9        5       EU=(       d    0 ED6U US9$ s  snnf s  snnf )Nr   )rx   )r$   shrinkz%exceeded size of current best examplezinvalid because r   r   r   r   z	generate:ztarget::)	rw   rx   ry   rz   r~   r   r   r   r   )ro   r   r   r   r   r   r   r   r   r   r   r   r=   )hypothesis.corerx   #hypothesis.internal.conjecture.datar$   r.   r   rM   r   OVERRUNeventspopINVALIDVALIDINTERESTINGrK   r&   rh   removeprefixtarget_observationsstripru   expected_tracebackrT   r   _observability_predicatesOBSERVABILITY_CHOICESrm   spans_system_metadata)r   r   r   r   r   r   r   r   r   r   r   r   r   rx   r$   
status_maprj   rk   s                     r9   make_testcaser     s%   ( 7: ;;; 		 	 D334	(	t{{fnn<?DKKOO,=rBC 			hH	0J j88#~KK(#%8AR7N7N7P
7Ptq!ANN;'*7P
 $
8<8P8P8V8V8X8X1'!##C(!+8X
 kk	
 $ 
!44<Bh<N*4<<8TX"4#A#AB+1r#{{&*&=&=.C.C

.C.C

 #$ >r
$ I% %


s   H5"H;r   c                    SSK Jn  U R                  S:X  a  SOSn[        S[        R
                  " 5       R                  5        SU S35      nUR                  R                  S	S	S
9  [        R                  " U" U SS95      S-   n[           [        R                  U5        UR                  SS9 nUR                  U5        S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f)Nr   )to_jsonabler   	testcasesr   observed_z.jsonlT)exist_okparentsF)avoid_realization
a)mode)%hypothesis.strategies._internal.utilsr   ro   r   r   today	isoformatparentmkdirjsondumps_deliver_to_file_lock	_WROTE_TOaddopenwrite)r   r   r   kindfnameobservation_bytesr   s          r9   _deliver_to_filer    s     B%**k9;vDjTZZ\-C-C-E,FavV*TUE	LLd3 	

;{eDEL  
eZZSZ!QGG%& " 
	!! 
	s$   %C%1CC%
C"	C%%
C3c                  X    [         R                  [        R                  " 5       [        S.$ )N)r{   r|   r}   )sysargvosgetpid_imported_atr=   r<   r9   r   r     s!     HHYY[# r<   -HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY_NOCOVER-HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY_CHOICES   )      zCoverage data collection should be quite fast in Python 3.12 or later so there should be no need to turn coverage reporting off.)
stacklevel%HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY   )daysr   )intent_to_writez*.jsonl)
missing_ok)k__doc__rN   r   r   rQ   r  r	  r   timewarningscollections.abcr   r   
contextlibr   r   datetimer   r   	functoolsr	   r
   typingr   r   r   r   r   r   r   hypothesis.configurationr   hypothesis.errorsr   %hypothesis.internal.conjecture.choicer   r   r   r   r   r   r   r   r   hypothesis.internal.escalationr   hypothesis.internal.floatsr    hypothesis.internal.intervalsetsr   hypothesis.utils.deprecationr!   r   r"   r#   r$   r'   rC   r(   rB   r)   r*   r+   r   r   r,   r0   rS   r   rW   rM   rl   rs   ru   r   r   r   r%   r&   rD   r   r   r   r   r   r   TESTCASE_CALLBACKSrJ   r   setr   r   r  r  r   environOBSERVABILITY_COLLECT_COVERAGEr   version_infowarnr   r   max_ageglobr   stemunlinkr=   r<   r9   <module>r2     s-   T     	 
    / % ! $     7 /
 
 
 = 3 8 9QQ GHY H%{mT&9: :!);*<d*B!C Y C&)<<	9 < 79
DtT/223 846 01 6 e$" " %"GdN s (;U7C<0 ;T#Y ;0H0H+=0H	#s(^0Hf	z3/ 	Dc3h4H 	 d#2 2 $2j d#  $ 67 67 d#o  $ d#"/ " $" HM ;) ; ;QU ;@"Y "d "0
<t 
< @E)t#$)9=) ) ))[ )T )) )H ()  &!,0.2 	 $ '+%UU U 	U
 U U eU d{U 3S	>"T)U :U 38nt+U 	nh&'$.U :U$ 38nt#%U& 'Up E	 ''),'	'0 yy{ $sCx.   42::E   H2::U !U*RaG#MM	E	 ,rzz9%./TB zz|iQ//::<Gz5AFFyQ66GHHH% R /r<   