
    i
R                        S SK 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  S SKJrJr  S S	KJrJrJrJrJrJrJrJrJrJr  S S
KJrJrJr  S SK J!r!  S SK"J#r#J$r$  S SK%J&r&J'r'  \(\)-  \-  \-  r* " S S\$\(   5      r+\&\'" SS9  S%S\(S-  S\(S-  S\$\(   4S jj5       5       r, " S S\$\)   5      r-\&\'" SS9  S%SSSSSSS.S\*S-  S\*S-  S\.S-  S\.S-  S\.S-  S\S   S \.S!\.S\$\)   4S" jjj5       5       r/ " S# S$\$\)   5      r0g)&    N)Decimal)Fraction)Literalcast)reject)InvalidArgument)ConjectureData)get_float_predicate_boundsget_integer_predicate_bounds)
SMALLEST_SUBNORMALfloat_offloat_to_intint_to_floatis_negative	next_downnext_down_normalnext_upnext_up_normalwidth_smallest_normals)
check_typecheck_valid_boundcheck_valid_interval)nothing)SampledFromStrategySearchStrategy)	cacheabledefines_strategyc                   p   ^  \ rS rSrS\S-  S\S-  SS4U 4S jjrS\4S jrS\S\4S	 jr	U 4S
 jr
SrU =r$ )IntegersStrategy3   startNendreturnc                    > [         TU ]  5         [        U[        5      (       d  Ub   e[        U[        5      (       d  Ub   eUb
  Ub  X::  d   eXl        X l        g N)super__init__
isinstanceintr!   r"   )selfr!   r"   	__class__s      f/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/hypothesis/strategies/_internal/numbers.pyr'   IntegersStrategy.__init__4   sY    %%%66#s##s{22}u|;;
    c                     U R                   c  U R                  c  gU R                  c  SU R                    S3$ U R                   c  SU R                   S3$ SU R                    SU R                   S3$ )Nz
integers()zintegers(min_value=)zintegers(max_value=z	integers(z, )r!   r"   r*   s    r,   __repr__IntegersStrategy.__repr__<   so    ::$(("288(A66::(
!444::,b
!44r.   datac                 .   S nU R                   bb  U R                  bU  U R                   U R                  -
  S:  a8  U R                  SU R                  S-   SU R                   S-
  SU R                   S0nUR                  U R                  U R                   US9$ )N   g      ?   g      ?)	min_value	max_valueweights)r"   r!   draw_integer)r*   r4   r:   s      r,   do_drawIntegersStrategy.do_drawE   s    HH 

&4::%+ 

W

Q1w7	G   jjDHHg ! 
 	
r.   c                 $  > U[         R                  L a  U $ U[         R                  [         R                  4;   a
  [	        5       $ [        U5      u  p#U R                  U R                  pTSU;   a#  [        US   Uc  [         R                  * OU5      nSU;   a"  [        US   Uc  [         R                  OU5      nX@R                  :w  d  XPR                  :w  a&  Ub  Ub  XE:  a
  [	        5       $ [        U 5      " XE5      n Uc  U $ [        TU ]5  U5      $ )Nr8   r9   )mathisfiniteisinfisnanr   r   r!   r"   maxinfmintyper&   filter)r*   	conditionconstraintspredr!   r"   r+   s         r,   rG   IntegersStrategy.filterX   s    %KTZZ0098CZZs+%K0u}488)RWXE+%k+.CKSQCJJ#/ S_y :e)D<Kw~d##r.   )r"   r!   )__name__
__module____qualname____firstlineno__r)   r'   strr2   r	   r<   rG   __static_attributes____classcell__r+   s   @r,   r   r   3   sN    cDj sTz d 5# 5
N 
s 
&$ $r.   r   T)force_reusable_valuesr8   r9   r#   c                 J   [        U S5        [        US5        [        XSS5        U b7  U [        U 5      :w  a  [        SU < S[	        U 5      < S35      e[        U 5      n Ub7  U[        U5      :w  a  [        SU< S[	        U5      < S35      e[        U5      n[        X5      $ )a9  Returns a strategy which generates integers.

If min_value is not None then all values will be >= min_value. If
max_value is not None then all values will be <= max_value

Examples from this strategy will shrink towards zero, and negative values
will also shrink towards positive (i.e. -n may be replaced by +n).
r8   r9   
min_value=z	 of type z- cannot be exactly represented as an integer.
max_value=)r   r   r)   r   rF   r   )r8   r9   s     r,   integersrX   n   s     i-i-{KHI&!YM4	?2E F? ?  	N	I&!YM4	?2E F? ?  	N	I11r.   c            	       t   ^  \ rS rSrSr\S.S\S\S\S\4U 4S jjjrS	\	4S
 jr
S\S	\4S jrU 4S jrSrU =r$ )FloatStrategy   z&A strategy for floating point numbers.)smallest_nonzero_magnituder8   r9   	allow_nanr\   c                   > [         TU ]  5         [        U[        5      (       d   eUS:  d   S5       eUS:X  a  [	        S5      eXl        X l        X0l        X@l        g )N        z$programmer error if this is negativea_  Got allow_subnormal=True, but we can't represent subnormal floats right now, in violation of the IEEE-754 floating-point specification.  This is usually because something was compiled with -ffast-math or a similar option, which sets global processor state.  See https://simonbyrne.github.io/notes/fastmath/ for a more detailed writeup - and good luck!)	r&   r'   r(   boolFloatingPointErrorr8   r9   r]   r\   )r*   r8   r9   r]   r\   r+   s        r,   r'   FloatStrategy.__init__   sh     	)T****)S0X2XX0%,$+  #""*D'r.   r#   c           
          U R                   R                   SU R                  < SU R                  < SU R                  < SU R
                  < S3
R                  SS5      $ )Nz(self.min_value=z, self.max_value=z, self.allow_nan=z", self.smallest_nonzero_magnitude=r0   zself. )r+   rL   r8   r9   r]   r\   replacer1   s    r,   r2   FloatStrategy.__repr__   sa    ~~&&''8(99KDNN;L M~~B$"A"A!C1F
''2
	r.   r4   c                 v    UR                  U R                  U R                  U R                  U R                  S9$ )Nr8   r9   r]   r\   )
draw_floatr8   r9   r]   r\   )r*   r4   s     r,   r<   FloatStrategy.do_draw   s6    nnnnnn'+'F'F	  
 	
r.   c                   > U[         R                  L ab  [        [        U R                  [        [        S5      5      5      [        U R                  [        [        S5      5      5      SU R                  S9$ U[         R                  L au  [         R                  * [         R                  4 Vs/ s H,  nU R                  Us=::  a  U R                  ::  d  M&  O  M*  UPM.     sn=n(       a  [        U5      $ [        5       $ U[         R                  L a%  U R                   (       d
  [        5       $ [#        5       $ [%        U5      u  pEU(       d  [&        TU ]Q  U5      $ [        UR+                  S[         R                  * 5      U R                  5      n[        UR+                  S[         R                  5      U R                  5      nU R                  * Us=:  a  S:  a  O  OSnO&SUs=:  a  U R                  :  a  O  OU R                  nU R                  * Us=:  a  S:  a  O  OU R                  * nOSUs=:  a  U R                  :  a  O  OS	nXg:  a
  [        5       $ X`R                  :  dJ  U R                  U:  d:  U R                   (       aE  [         R                  * U:  d  U[         R                  :  a  [-        U 5      " UUSU R                  S9n Uc  U $ [&        TU ]Q  U5      $ s  snf )
N-infrD   Frh   r8   r9   r          r_   )r?   r@   rZ   rC   r8   r   floatrE   r9   r   r\   rA   rD   r   r   rB   r]   NanStrategyr
   r&   rG   getrF   )	r*   rH   xpermitted_infsrI   rJ   	min_bound	max_boundr+   s	           r,   rG   FloatStrategy.filter   sK   % dnngeFm.DEdnnie.EF+/+J+J	  

"  88)TXX.".A>>Q8$..8 8 ." ~ 
 +>::9

">>y = 6yA7>$''dhhY?P	TXX>O	 +++i;!;I<T<<<77I+++i;!;888I<T<<<I 9&~~	)TXXI	$9Y=Q:##+/+J+J	D <Kw~d##W"s   -%K$K$K$)r]   r9   r8   r\   )rL   rM   rN   rO   __doc__r   rn   r`   r'   rP   r2   r	   r<   rG   rQ   rR   rS   s   @r,   rZ   rZ      sl    0 -?E E 	E
 E %*E E:# 
N 
u 
5$ 5$r.   rZ   @   F)r]   allow_infinityallow_subnormalwidthexclude_minexclude_maxr]   rx   ry   rz          rw   r{   r|   c          	        ^ [        [        US5        [        [        US5        Uc  [        U SL =(       a    USL 5      nOU(       a  U c  Ub  [        SU< S35      eTS;  a  [        ST< S35      e[        [        S   [        T5      5      m[        U S	5        [        US
5        [        R                  " SS5      S:X  a  [        S5      eU(       aD  [        STS9S:X  a6  SSKJn   U" 5       n	U	(       a  SU	 SU	 SU	 S3n
OSn
[        SU< SU
 35      eXpU b#  [        U T5      n [        U [         5      (       d   eUb#  [        UT5      n[        U[         5      (       d   eX:w  a  [        SU< ST SU < S35      eX:w  a  [        SU< ST SU< S35      eU(       a&  U b  U [        R"                  :X  a  [        SU < 35      eU(       a'  Ub  U[        R"                  * :X  a  [        S U< 35      eUSL =(       d    UnU bf  U(       d  Ub\  X:  aW  [%        U TUS!9n X:X  a@  Xs=:X  a  S:X  d   e   e['        U5      (       d   e['        U 5      (       a   e[%        U TUS!9n X:  d   eUbf  U(       d  Ub\  X:  aW  [)        UTUS!9nX:X  a@  Xs=:X  a  S:X  d   e   e['        U5      (       d   e['        U5      (       a   e[)        UTUS!9nX:  d   eU [        R"                  * :X  a  Sn U[        R"                  :X  a  SnXs=:H  =(       a    S:H  Os  =(       a"    ['        U5      =(       a    ['        U 5      (       + nU bB  Ub?  X:  d  U(       a3  S"T S#U< S$U< 3nU(       d  U(       a  US%U< S&U< 3-  n[        U5      eUc  [        U SL =(       d    USL 5      nOU(       a  U b  Ub  [        S'U< S(35      eOU [        R"                  :X  a/  U[        R"                  :X  a  [        S)5      e[        S*U< S+35      eU[        R"                  * :X  a0  U[        R"                  * :X  a  [        S,5      e[        S-U< S.35      e[*        T   nUcJ  U b2  Ub/  X:X  a  U* U s=:  =(       a    U:  Os  nO(U U:  =(       a    UU* :  nOU b  U U:  nOUb  UU* :  nOS/nU(       a<  U b  U U:  a  [        S0U  S1T S2U 35      eUb  UU* ::  a  [        S3U S4T S5U*  35      eU c  [!        S65      n Uc  [!        S75      nU(       d<  [-        U [        [!        S65      5      5      n [/        U[1        [!        S75      5      5      n[        U [         5      (       d   e[        U[         5      (       d   eU(       a  [2        OUn[5        U UUUS89nTS9:  a%  S:[         S;[         4U4S< jjnUR7                  U5      nU$ ! [         a    Sn	 GNf = f)=au  Returns a strategy which generates floats.

- If min_value is not None, all values will be ``>= min_value``
  (or ``> min_value`` if ``exclude_min``).
- If max_value is not None, all values will be ``<= max_value``
  (or ``< max_value`` if ``exclude_max``).
- If min_value or max_value is not None, it is an error to enable
  allow_nan.
- If both min_value and max_value are not None, it is an error to enable
  allow_infinity.
- If inferred values range does not include subnormal values, it is an error
  to enable allow_subnormal.

Where not explicitly ruled out by the bounds,
:wikipedia:`subnormals <Subnormal_number>`, infinities, and NaNs are possible
values generated by this strategy.

The width argument specifies the maximum number of bits of precision
required to represent the generated float. Valid values are 16, 32, or 64.
Passing ``width=32`` will still use the builtin 64-bit :class:`~python:float` class,
but always for values which can be exactly represented as a 32-bit float.

The exclude_min and exclude_max argument can be used to generate numbers
from open or half-open intervals, by excluding the respective endpoints.
Excluding either signed zero will also exclude the other.
Attempting to exclude an endpoint which is None will raise an error;
use ``allow_infinity=False`` to generate finite floats.  You can however
use e.g. ``min_value=-math.inf, exclude_min=True`` to exclude only
one infinite endpoint.

Examples from this strategy have a complicated and hard to explain
shrinking behaviour, but it tries to improve "human readability". Finite
numbers will be preferred to infinity and infinity will be preferred to
NaN.
r{   r|   NzCannot have allow_nan=z, with min_value or max_valuer}   z
Got width=z<, but the only valid values are the integers 16, 32, and 64.r8   r9   g      ?rm   a  Your Python install can't represent -0.0, which is required by the IEEE-754 floating-point specification.  This is probably because it was compiled with an unsafe option like -ffast-math; for a more detailed explanation see https://simonbyrne.github.io/notes/fastmath/r_   )rz   r   )identify_ftz_culpritszThis seems to be because the `z` package was compiled with -ffast-math or a similar option, which sets global processor state - see https://simonbyrne.github.io/notes/fastmath/ for details.  If you don't know why z is installed, `pipdeptree -rp z(` will show which packages depend on it.zThis is usually because something was compiled with -ffast-math or a similar option, which sets global processor state.  See https://simonbyrne.github.io/notes/fastmath/ for a more detailed writeup - and good luck!zGot allow_subnormal=zq, but we can't represent subnormal floats right now, in violation of the IEEE-754 floating-point specification.  rV   z3 cannot be exactly represented as a float of width z - use min_value=z	 instead.rW   z - use max_value=zCannot exclude min_value=zCannot exclude max_value=)ry   zThere are no z--bit floating-point values between min_value=z and max_value=z, exclude_min=z and exclude_max=zCannot have allow_infinity=z#, with both min_value and max_valuez+allow_infinity=False excludes min_value=infz!exclude_min=True turns min_value=z# into inf, but allow_infinity=Falsez,allow_infinity=False excludes max_value=-infz!exclude_max=True turns max_value=z$ into -inf, but allow_infinity=FalseTz(allow_subnormal=True, but minimum value z excludes values below floatz's smallest positive normal z(allow_subnormal=True, but maximum value z excludes values above floatz's smallest negative normal rl   rD   rh   rw   rq   r#   c                 R   >  [        U T5      $ ! [         a    [        5          g f = fr%   )r   OverflowErrorr   )rq   rz   s    r,   downcastfloats.<locals>.downcast  s)    5))  s    &&)r   r`   r   r   r   r)   r   r?   copysignra   r   _hypothesis_ftz_detectorr   	Exceptionr   r(   rn   rD   r   r   r   r   rC   rE   r   r   rZ   map)r8   r9   r]   rx   ry   rz   r{   r|   r   ftz_pkgftz_msgmin_argmax_argassumed_allow_subnormalbad_zero_boundsmsgsmallest_normalr\   resultr   s        `              r,   floatsr      s   ` t[-0t[-0d*@yD/@A			-1F 7YL8UVWWL 5( / /
 	
 $c%j1Ei-i-}}S$3& K
 	
 73e49 	C	+-G 0	 :) *1	1P)C	E +  !#?$ %&i)
 	
 !WY.	)U++++Y.	)U++++ $w0i\<
 	
  $w0i\<
 	

 	)Y$((-B :	|<==	)Y488)-C :	|<==-5H+	0C"u.E
	 ,1,,,,,w''''"9----&52II """+	0C$u.E
	 ,1,,,,,y))))"7++++(52II """TXXI	DHH	 	##!# 	'	"	'I&&  	!"o
 E7 # ?7+? 	 +_~%7;.99Cc""i4/D93DE	 Y%:!.~//RS  
dhh	dhh!"OPP/{ ;' '
 	
 
txxi	txxi!"PQQ/{ ;' '
 	

 -U3O Y%:%#2"2Y"P"P"P /PI@P4P   "'/9O"'?*::O"O Y/%A!:9+ F..3W 5,,;+<> 
  Y?2B%B!:9+ F..3W 5,-<,<+=?  &M	%L		75=#9:		9U5\#:;	i''''i''''-?  +#=	F rz	 	% 	 H%Mk  	G	s   )V7 7WWc                   *    \ rS rSrSrS\S\4S jrSrg)ro   i  z4Strategy for sampling the space of nan float values.r4   r#   c                     [        UR                  5       5      S-  n[        [        R                  5      nUR                  SS5      n[        X#-  U-  5      $ )N?   r   l    )r)   draw_booleanr   r?   nanr;   r   )r*   r4   sign_bitnan_bitsmantissa_bitss        r,   r<   NanStrategy.do_draw
  sO     t((*+r1)))!Y7H/-?@@r.    N)	rL   rM   rN   rO   rv   r	   rn   r<   rQ   r   r.   r,   ro   ro     s    >AN Au Ar.   ro   )NN)1r?   decimalr   	fractionsr   typingr   r   hypothesis.controlr   hypothesis.errorsr   #hypothesis.internal.conjecture.datar	   hypothesis.internal.filteringr
   r   hypothesis.internal.floatsr   r   r   r   r   r   r   r   r   r   hypothesis.internal.validationr   r   r   $hypothesis.strategies._internal.miscr   *hypothesis.strategies._internal.strategiesr   r   %hypothesis.strategies._internal.utilsr   r   r)   rn   Realr   rX   rZ   r`   r   ro   r   r.   r,   <module>r      s        % - >   
 9 N U{X'8$~c* 8$v -  2Tz2Tz2 C2 . 2Dc$N5) c$L -!!J ""&#'!#Jd{Jd{J d{	J
 4KJ D[J :J J J EJ . JZ	A.' 	Ar.   