
    iT                        % S SK r S SKrS SK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  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'J(r(J)r*  S SK+J,r-  S SK.J/r/  S SK0J1r1  S SK2J3r3  S SK4J5r5J6r6J7r7J8r8  S SK9J:r:  S SK;J<r<  S/r=Sr>/ \>QSP7r?\@" \?5      \A" \?5      :X  d   e\S   rB\" \B5      \?:X  d   eSrCSrD\C\D-   rESrF\E\F-   rGSrH\G\H-   rIS/\IQ7rJ\" S5      rK\/S\S\A\L   SS4S j5       rMS\S\\L   S\N\A\   \A\L   4   4S  jrOS\S!\A\L   SS4S" jrPS\S#\BS$\KS\Q\R\S-  \T-  \U-     4S% jrV\/S\S&\LS\4S' j5       rWSSSSSSSS(.S\S#\BS$\K\L-  S)\S\T-  S-  S*\S\T-  S-  S+\RS-  S,\RS-  S-\RS-  S.\RS-  S/\RS-  S\R                  \R\S-  \T-  \U-     4S0 jjrY " S1 S2\R                  5      rZSSS3S4.S\S#\BS$\K\L-  \R                  \K   -  \R                  \L   -  S5\S\!-  \R                  \!   -  S6\\L\4   \R                  -  S-  S7\R                  \   S-  S8\RS\R                  4S9 jjr[\/S\S:\A\K   S!\A\L   SS4S; j5       r\S\S#\BS\R                  \K   4S< jr]S\S\R                  \K   4S= jr^S\S\R                  \K   4S> jr_S\S#\BS\R                  \K   4S? jr`\/S@\LSA\\S   SB\\S   SS4SC j5       raSD\LSA\\S   S\\L   4SE jrb\SF   rc\\dSG'   \SH   re\\dSI'   \SJ   rf\\dSK'   SFSL.S\SA\c\\c   -  S\R                  \K   4SM jjrgSFSL.S\SA\c\\c   -  S\R                  \K   4SN jjrhSHSL.S\SA\e\\e   -  S\R                  \K   4SO jjriSJSL.S\SA\f\\f   -  S\R                  \K   4SP jjrj\3" \*5      SQ 5       r)SR\*R                   SS3\)lk        \<" 5       STS SSUSSV.SW\SSX\!SY\SSZ\SS-  S[\SS\\SS-  S\R                  \    4S] jj5       r&\'R                  \&lk        \<" 5       S SS3S^S_.S5\!SY\SSZ\SS-  S`\RSa\RS\R                  \   4Sb jj5       rl\" 5       rm\\dSc'   SSd.S\S#\BS-  S\
4Se jjrn S SKorp\pGb   " Sh Si\5      ruS$\KS\u4Sj jrv\
" ST0 SkSl_SmSn_So\pR                  _Sp\pR                  _Sq\pR                  _Sr\pR                  _Ss\pR                  _St\pR                  _Su\pR                  _Sv\pR                  _Sw\pR                  _Sx\pGR                   _Sy\pGR                  _Sz\pGR                  _S\pGR                  _S{\pGR                  _S|S} _S~\pGR
                  _S\v_S\pGR                  _S\pGR                  _S\pGR                  _S\pGR                  _S\pGR                  _S\pGR                  _S\pGR                  _S\pGR                  _S\pGR                  _S\pGR                  _S\pGR                   _S\pGR"                  _S\pGR$                  _S\pGR&                  _S\pGR(                  _S\pGR*                  _6rgg! \q a&    Sf\R                  ;   a  S SgKsJtrt  \t" 5       rp GNSrp GNf = f)    N)IterableIteratorMappingSequence)Real)SimpleNamespace)AnyLiteral
NamedTuple	TypeAliasTypeVarget_args)warn)WeakValueDictionary)
strategies)HypothesisWarningInvalidArgument)NDIM_MAX
BasicIndexBasicIndexStrategyBroadcastableShapesShapearray_shapesbroadcastable_shapescheck_argumentcheck_valid_dimsmutually_broadcastable_shapesorder_checkvalid_tuple_axes)utils)check_function)	next_down)proxies)
check_typecheck_valid_boundcheck_valid_integercheck_valid_interval)check_strategy)defines_strategymake_strategies_namespace)2021.122022.122023.122024.122025.12draft)r+   r,   r-   r.   r/   r0   )int8int16int32int64)uint8uint16uint32uint64)float32float64)	complex64
complex128boolDataTypexp
attributesreturnc                     U Vs/ s H  n[        X5      (       a  M  UPM     nn[        U5      S:  a,  SR                  U5      n[        SU R                   SU 35      eg s  snf )Nr   , Array module z$ does not have required attributes: )hasattrlenjoinr   __name__)r?   r@   attrmissing_attrsf_attrss        Y/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/hypothesis/extra/array_api.pycheck_xp_attributesrM   P   se    &0Jjd8ITjMJ
=A))M*BKK=(LWIV
 	
  Ks
   A!A!c                     / n/ nU H  n UR                  [        X5      5        M      X#4$ ! [         a    UR                  U5         MC  f = fN)appendgetattrAttributeError)r?   r@   	non_stubsstubsrI   s        rL   partition_attributes_and_stubsrU   Z   sX     IE	WR./    	LL	s   ,A
ArT   c                 d    SR                  U5      n[        SU R                   SU 3[        SS9  g )NrC   rD   z6 does not have the following dtypes in its namespace:    
stacklevel)rG   r   rH   r   )r?   rT   f_stubss      rL   warn_on_missing_dtypesr[   h   s8    iiG
} %$$+9	.	    api_versiondtypec                 
   / n U R                   nX$:X  a  [         $  [        U [        5      u  pVX%;   a  [
        $ [        U [        5      u  pxUb  X';   a  [        $ UR                  U5        UR                  U5        US:  a.  [        U [        5      u  pX);   a  [        $ UR                  U
5        [        U5      S:  a  [        X5        [        SU SU R                   35      e! [         a    UR                  S5         Nf = f)zReturns builtin type which can have values that are castable to the given
dtype, according to :xp-ref:`type promotion rules <type_promotion.html>`.

For floating dtypes we always return ``float``, even though ``int`` is also castable.
r=   r+   r   dtype=z not recognised in )r=   rR   rP   rU   ALL_INT_NAMESintFLOAT_NAMESfloatextendCOMPLEX_NAMEScomplexrF   r[   r   rH   )r?   r]   r^   rT   
bool_dtype
int_dtypes	int_stubsfloat_dtypesfloat_stubscomplex_dtypescomplex_stubss              rL   find_castable_builtin_for_dtypero   r   s     EWW
K 
 ;2}MJ
 >r; OL
 U2	LL	LLY(F)
% "N]#
5zA~r)
F5')<R[[MJ
KK9  Vs   C$ $DDnamec                     U[         ;   a   [        X5      $ SR                  [         5      n[        U SU S35      e! [         a"  n[        SU R                   SU S35      UeS nAff = f)NrD   z does not have dtype z in its namespacerC   z0 is not a valid Array API data type (pick from: ))DTYPE_NAMESrQ   rR   r   rH   rG   )r?   rp   ef_valid_dtypess       rL   dtype_from_namerv      s    {	2$$ ;/fD^DTTUV
 	
  	!},A$GXY	s   
= 
A)A$$A)	min_value	max_value	allow_nanallow_infinityallow_subnormalexclude_minexclude_maxrx   ry   rz   r{   r|   r}   r~   c                  ^ [        U SS/5        [        T[        5      (       a  [        U T5      m[	        XT5      n
U4S jnU
[
        L a  [        R                  " 5       $ U
[        L a  U R                  T5      nUc  UR                  nUc  UR                  n[        US5        [        US5        [        U[        5      (       d   e[        U[        5      (       d   eU" SX<5        U" SXL5        [        X4SS5        [        R                  " X4S9$ U
[        L Ga  U R!                  T5      n0 nUb0  [#        US5        [        U[$        5      (       d   eU" SX=5        X>S'   Ub@  [#        US5        [        U[$        5      (       d   eU" SXM5        Ub  [        X4SS5        XNS'   Ub  X~S	'   OO['        [        UR(                  5      UR*                  S
9n[        U R-                  UTS9S:H  5      nU(       a  SUS	'   Ub  X^S'   Ub  XnS'   Ub  XS'   U	b  XS'   [        R.                  " SSUR*                  0UD6$ U R!                  T5      nUcp  ['        [        UR(                  5      UR*                  S
9nU R-                  [1        X5      TS9n[1        U5      nUR2                  S:g  =(       a    UR4                  S:g  n[        R6                  " UUUUR*                  S-  S9$ )a  Return a strategy for any value of the given dtype.

Values generated are of the Python scalar which is
:xp-ref:`promotable <type_promotion.html>` to ``dtype``, where the values do
not exceed its bounds.

* ``dtype`` may be a dtype object or the string name of a
  :xp-ref:`valid dtype <data_types.html>`.

Compatible ``**kwargs`` are passed to the inferred strategy function for
integers and floats.  This allows you to customise the min and max values,
and exclude non-finite numbers. This is particularly useful when kwargs are
passed through from :func:`arrays()`, as it seamlessly handles the ``width``
or other representable bounds for you.
iinfofinfoc                    > U  S3n[        X5        [        XR                  :  ST SU SU SUR                   35        [        XR                  :*  ST SU SU SUR                   35        g )N_valuer`   z
 requires =z to be at least z to be at most )r%   r   minmax)prefixvalinfo_objrp   r^   s       rL   check_valid_minmax'_from_dtype.<locals>.check_valid_minmax   s~     #$<<UG:dV1SE1A(,,P	
 	<<UG:dV1SEO	
r\   rx   ry   r   r   )rx   ry   r|   )widthr^   r   Frz   r{   r}   r~   r      )rz   r{   r|   r    )rM   
isinstancestrrv   ro   r=   stbooleansrb   r   r   r   r&   r'   integersrd   r   r%   r   r"   smallest_normalbitsasarrayfloatsrg   realimagcomplex_numbers)r?   r]   r^   rx   ry   rz   r{   r|   r}   r~   builtinr   r   r   kw	subnormalftzx	builtin_xs     `                rL   _from_dtyper      s   : Wg./%E*-buEG

 ${{}	C		I		II{3I{3)S)))))S))))5)35)3Y;L{{YDD	E	  i5i....ui7'{O i5i....ui7$$Y;T'{O &$3 !!%(=(=">ejjQIrzz)5z9Q>?C(-$% '{O%#1 " +}" +}yy0uzz0R00 "!%(=(=">ejjQI

798
FA
I'nn1Iinn6IO!!)+**q.	
 	
r\   c                   4   ^  \ rS rSrU 4S jrS rS rSrU =r$ )ArrayStrategyi3  c                8  > [         TU ]  5         Xl        X0l        X@l        XPl        X`l        Xpl        [        R                  " U5      U l
        [        XU5      U l        U R                  [        La  S U l        g UR                  U R                  5      U l        g rO   )super__init__r?   elements_strategyr^   shapefilluniquemathprod
array_sizero   r   rd   r   )	selfr?   r]   r   r^   r   r   r   	__class__s	           rL   r   ArrayStrategy.__init__4  sr     	!2

	))E*6rN!\\6T
BHHTZZ<P
r\   c                    X:X  a  U R                  U5      U:w  a  U R                   [        L av  U R                  c   e S[        U5      s=:  =(       a    U R                  R                  :  Os  nU(       a-  [        SU SU SU< SU R                  R                   S3	5      e[        SU< SU S	U R                   S
U R                  R                   SU S35      eg g ! [
         a    Sn N~f = f)Nr   FzGenerated subnormal float  from strategy z resulted in z', probably as a result of array module zY being built with flush-to-zero compiler options. Consider passing allow_subnormal=False.zGenerated array element z" cannot be represented with dtype z. Array module z# instead represents the element as zf. Consider using a more precise elements strategy, for example passing the width argument to floats().)
r   rd   r   absr   	Exceptionr   r?   rH   r^   )r   r   val_0dstrategyis_subnormals        rL   check_set_valueArrayStrategy.check_set_valueB  s   :$,,v.#5||u$zz---)#$s3x#L#L$**2L2L#LL
  )4SE#*M& <77;ww7G7G6H IBB  "*3'
 K448JJ< @  $ 0 01 2--3H 5FF # 6:
 ! ) $)L)s   2C   C/.C/c                 V	   SU R                   ;   a.  U R                  R                  U R                   U R                  S9$ U R                  R
                  (       a  UR                  [        R                  " U R                  U R                  U R                  U R                  S95      n U R                  R                  X R                  S9n[)        U R                  5       H$  nU R+                  X(   X8   U R                  5        M&     GOkUR                  U R                  5      n	[)        U R                  5       V
s/ s H  oPM     nn
[)        U R                  5       V
s/ s H  n
SPM     nn
[,        R.                  " USU R                  [1        SU R                  -  [3        S[4        R6                  " U R                  5      5      5      S9n[9        5       n[9        5       nUR;                  5       (       a  UR=                  SU R                  S-
  5      nX;   a  UR?                  S5        ML  UR                  U R                  5      nU R                  (       a*  UU;   a  UR?                  S5        M  URA                  U5        UX'   URA                  U5        SX'   UR;                  5       (       a  M   U R                  R                  XR                  S9n[C        U5       H  u  nnX8   nX   (       a^  U R                  (       aM  U R                  RE                  U5      (       d+  ['        S!U R                  RF                   S"U	< S#U< S$35      eMq  U R+                  UUU R                  5        M     U R                  RI                  X0R                   5      $ ! [         a  n[        U5      S::  a  [        U5      nOSUS    SUS    SUS	    SUS
    S3	n[!        [#        U Vs1 s H  n[%        U5      iM     Os  snf snS S95      n[        U5      S:X  a  SUS    3OSU 3n['        SU SU R                   SU R                   SU SU R                   S35      WeS nAff = fs  sn
f s  sn
f ! [         a'  nSU SU R                   S3n['        S U 35      UeS nAff = f)%Nr   r   )min_sizemax_sizer      [rC      z, ..., ]c                     U R                   $ rO   )rH   )ts    rL   <lambda>'ArrayStrategy.do_draw.<locals>.<lambda>w  s    1::r\   )keyztype ztypes zGenerated elements r   z* could not be converted to array of dtype z. Consider if elements of z are compatible with .Tg?
   )r   r   average_sizez'chose an array index we've already usedz#chose an element we've already usedFzxp.asarray(z, dtype=rr   zCould not create array via rD   z did not recognise fill value z as NaN - instead got z/. Cannot fill unique array with non-NaN values.)%r   r?   zerosr^   r   is_emptydrawr   listsr   r   r   r   r   rF   r   tuplesortedtyper   ranger   cumanyr   r   r   sqrtsetmoredraw_integerrejectadd	enumerateisnanrH   reshape)r   dataelemsresultrt   f_elemstypesf_typesifill_val_
result_obj	fill_maskelementsassignedseenr   f_exprr   s                      rL   do_drawArrayStrategy.do_draw]  s   

?77==4::=>>99 II**!__!__;;	EjjA" 4??+$$UXvy$:P:PQ , yy+H,1$//,BC,Bq(,BJC',T__'=>'=!'=I>ww !$//)DIIdoo67H uH5D--//%%a1)<==OO$MNii 6 67;;d{ (MN HHSM #
Q$	 --// U::F
 $J/3<DKK77==00-+DGG,<,<+= >%%-L0Fvj QLL  1 ((fd6L6LM 0 wwvzz22_  u:?!%jG !%(2eAhZwuRykERTI;VWXGU3UDGU39MN 14E
aE%(,veWEU%)'/--. /))- 5//6i 8++/::,a	9 4 D>H  U&zl(4::,aH%(CF8&LMSTTUsJ   )#N =Q-!Q26#Q7 
Q*%AQ%)O?>A'Q%%Q*7
R("R##R()	r   r   r^   r   r   r   r   r   r?   )	rH   
__module____qualname____firstlineno__r   r   r   __static_attributes____classcell__)r   s   @rL   r   r   3  s    Q6c3 c3r\   r   Fr   r   r   r   r   r   r   c          
      l  ^ ^^^^^^ [        T / SQ5        [        T[        R                  5      (       a  TR	                  UUUUUU 4S j5      $ [        T[
        5      (       a  [        T T5      m[        T[        R                  5      (       a  TR	                  UUUUUU 4S j5      $ [        T[        5      (       a  T4mO$[        T[        5      (       d  [        ST S35      e[        [        S T 5       5      ST< S35        Tc  [        T TT5      mO#[        T[        5      (       a  [        T TT40 TD6m[        TS5        TcQ  [        T[        R                  5      (       d   eT(       d  TR                  (       d  [        R                   " 5       mOTm[        TS	5        [#        T TTTTTTS
9$ )a  Returns a strategy for :xp-ref:`arrays <array_object.html>`.

* ``dtype`` may be a :xp-ref:`valid dtype <data_types.html>` object or name,
  or a strategy that generates such values.
* ``shape`` may be an integer >= 0, a tuple of such integers, or a strategy
  that generates such values.
* ``elements`` is a strategy for values to put in the array. If ``None``
  then a suitable value will be inferred based on the dtype, which may give
  any legal value (including e.g. NaN for floats). If a mapping, it will be
  passed as ``**kwargs`` to :func:`from_dtype()` when inferring based on the dtype.
* ``fill`` is a strategy that may be used to generate a single background
  value for the array. If ``None``, a suitable default will be inferred
  based on the other arguments. If set to
  :func:`~hypothesis.strategies.nothing` then filling behaviour will be
  disabled entirely and every element will be generated independently.
* ``unique`` specifies if the elements of the array should all be distinct
  from one another; if fill is also set, the only valid values for fill to
  return are NaN values.

Arrays of specified ``dtype`` and ``shape`` are generated for example
like this:

.. code-block:: pycon

  >>> from numpy import array_api as xp
  >>> xps.arrays(xp, xp.int8, (2, 3)).example()
  Array([[-8,  6,  3],
         [-6,  4,  6]], dtype=int8)

Specifying element boundaries by a :obj:`python:dict` of the kwargs to pass
to :func:`from_dtype` will ensure ``dtype`` bounds will be respected.

.. code-block:: pycon

  >>> xps.arrays(xp, xp.int8, 3, elements={"min_value": 10}).example()
  Array([125, 13, 79], dtype=int8)

.. code-block:: pycon

  >>> xps.arrays(xp, xp.float32, 3, elements=floats(0, 1, width=32)).example()
  Array([ 0.88974794,  0.77387938,  0.1977879 ], dtype=float32)

Array values are generated in two parts:

1. A single value is drawn from the fill strategy and is used to create a
   filled array.
2. Some subset of the coordinates of the array are populated with a value
   drawn from the elements strategy (or its inferred form).

You can set ``fill`` to :func:`~hypothesis.strategies.nothing` if you want
to disable this behaviour and draw a value for every element.

By default ``arrays`` will attempt to infer the correct fill behaviour: if
``unique`` is also ``True``, no filling will occur. Otherwise, if it looks
safe to reuse the values of elements across multiple coordinates (this will
be the case for any inferred strategy, and for most of the builtins, but is
not the case for mutable values or strategies built with flatmap, map,
composite, etc.) then it will use the elements strategy as the fill, else it
will default to having no fill.

Having a fill helps Hypothesis craft high quality examples, but its
main importance is when the array generated is large: Hypothesis is
primarily designed around testing small examples. If you have arrays with
hundreds or more elements, having a fill value is essential if you want
your tests to run in reasonable time.
)r   r   r   allr   isfiniter   c           
      "   > [        TTU TTTTS9$ Nr   _arrays)dr]   r   r   r   r   r?   s    rL   r   _arrays.<locals>.<lambda>  s    gKEH4PVr\   c           
      "   > [        TTTU TTTS9$ r   r   )sr]   r^   r   r   r   r?   s    rL   r   r     s    gKH4PVr\   shape=z! is not a valid shape or strategyc              3   Z   #    U  H!  n[        U[        5      =(       a    US :  v   M#     g7fr   Nr   rb   .0r   s     rL   	<genexpr>_arrays.<locals>.<genexpr>'  #     95aJq#)16)5   )+3, but all dimensions must be non-negative integers.r   r   )r?   r]   r   r^   r   r   r   )rM   r   r   SearchStrategyflatmapr   rv   rb   r   r   r   r   r   r   r(   has_reusable_valuesnothingr   )r?   r]   r^   r   r   r   r   s   ```````rL   r   r     s   X 
P %**++}} 
 	

 
E3		E*%**++}} 
 	

 
E3		u%%ug-NOPP95995(EF
 r;6	Hg	&	&r;BB8Z(|(B$5$5666655::<DD4 " r\   dtypesc                     [        U5      S:X  aB  [        U5      S:  d   S5       eSR                  U5      n[        SU R                   SU 35      e[        U5      S:  a  [	        X5        g g )Nr   z#No dtypes passed but stubs is emptyrC   rD   z? does not have the following required dtypes in its namespace: )rF   rG   r   rH   r[   )r?   r  rT   rZ   s       rL   check_dtypesr  D  ss    
6{a5zA~DDD~))E"BKK= )118	;
 	
 
Uar) 
r\   c                 T    [         R                  " [        U 5      [        X5      5      $ )zJReturn a strategy for all :xp-ref:`valid dtype <data_types.html>` objects.)r   one_of_boolean_dtypes_numeric_dtypes)r?   r]   s     rL   _scalar_dtypesr  Q  s    99_R(/"*JKKr\   c                      [         R                  " U R                  5      $ ! [         a    [	        SU R
                   S35      Sef = f)z4Return a strategy for just the boolean dtype object.rD   z, does not have a bool dtype in its namespaceN)r   justr=   rR   r   rH   r?   s    rL   r  r  V  sJ    wwrww BKK=(TU
	s	   " %Ac                 h    [         R                  " [        U 5      [        U 5      [	        U 5      5      $ )z4Return a strategy for all real-valued dtype objects.)r   r  _integer_dtypes_unsigned_integer_dtypes_floating_dtypesr  s    rL   _real_dtypesr  `  s+    99 $ r\   c                 D    [        U 5      nUS:  a  U[        U 5      -  nU$ )z0Return a strategy for all numeric dtype objects.r+   )r  _complex_dtypes)r?   r]   strats      rL   r  r  i  s*     *6b)9EY$$Lr\   categorysizesvalid_sizesc           
         [        [        U5      S:  S5        U Vs/ s H  o3U;  d  M
  UPM     nnSR                  S U 5       5      nSR                  S U 5       5      n[        [        U5      S:H  SU  SU SU S	35        g s  snf )
Nr   zNo sizes passedrC   c              3   8   #    U  H  n[        U5      v   M     g 7frO   r   r  r   s     rL   r  $check_valid_sizes.<locals>.<genexpr>z  s     :kc!ffk   c              3   8   #    U  H  n[        U5      v   M     g 7frO   r(  r)  s     rL   r  r*  {  s     >1Ar+  z&The following sizes are not valid for z	 dtypes: z (valid sizes: rr   )r   rF   rG   )r#  r$  r%  r   invalid_sizesf_valid_sizesf_invalid_sizess          rL   check_valid_sizesr0  s  s     3u:>#45 %>1+)=QM>II:k::Mii>>>OMa
0
)
?=/	< ?s
   	BB	base_namec              #   .   #    U H  nU  U 3v   M     g 7frO   r   )r1  r$  sizes      rL   numeric_dtype_namesr4    s     D6"" s             @   IntSizer8  r9  FltSizer9     CpxSizer$  c                    [        U[        5      (       a  U4n[        SUS5        [        U [	        SU5      5      u  p#[        XU5        [        R                  " U5      $ )zReturn a strategy for signed integer dtype objects.

``sizes`` contains the signed integer sizes in bits, defaulting to
``(8, 16, 32, 64)`` which covers all valid sizes.
rb   r5  r   rb   r0  rU   r4  r  r   sampled_fromr?   r$  r  rT   s       rL   r  r    sX     %eUO42
u-MF U#??6""r\   c                    [        U[        5      (       a  U4n[        SUS5        [        U [	        SU5      5      u  p#[        XU5        [        R                  " U5      $ )zReturn a strategy for unsigned integer dtype objects.

``sizes`` contains the unsigned integer sizes in bits, defaulting to
``(8, 16, 32, 64)`` which covers all valid sizes.
rb   r5  uintrB  rD  s       rL   r  r    sX     %eUO42
.MF U#??6""r\   c                    [        U[        5      (       a  U4n[        SUS5        [        U [	        SU5      5      u  p#[        XU5        [        R                  " U5      $ )zReturn a strategy for real-valued floating-point dtype objects.

``sizes`` contains the floating-point sizes in bits, defaulting to
``(32, 64)`` which covers all valid sizes.
rb   r;  rd   rB  rD  s       rL   r  r    sX     %eUH-2
/MF U#??6""r\   c                    [        U[        5      (       a  U4n[        SUS5        [        U [	        SU5      5      u  p#[        XU5        [        R                  " U5      $ )zReturn a strategy for complex dtype objects.

``sizes`` contains the complex sizes in bits, defaulting to ``(64, 128)``
which covers all valid sizes.
rg   r=  rB  rD  s       rL   r!  r!    sX     %i	22
	51MF U#??6""r\   c                      [        U 0 UD6$ rO   )_valid_tuple_axes)argskwargss     rL   r   r     s    d-f--r\   z
    Return a strategy for permissible tuple-values for the ``axis``
    argument in Array API sequential methods e.g. ``sum``, given the specified
    dimensionality.

    z
    r   r   )
base_shapemin_dimsmax_dimsmin_sidemax_side
num_shapesrM  rN  rO  rP  rQ  c          	          [        U UUUUUS9$ )NrR  rM  rN  rO  rP  rQ  )_mutually_broadcastable_shapesrT  s         rL   r   r     s#     * r\   T)rN  rO  allow_newaxisallow_ellipsisrV  rW  c          	         [        [        U S5        [        [        S U  5       5      SU < S35        [        [        US5        [        [        US5        [        [
        US5        U(       d)  [        U[        U 5      :*  SU S	[        U 5       S
3S5        [        US5        UcG  U(       a'  [        [        [        U 5      U5      S-   [        5      nO[        [        U 5      [        5      n[        [
        US5        [        U[
        5      (       d   eU(       d)  [        U[        U 5      :*  SU S	[        U 5       S
3S5        [        US5        [        SSX5        [        U UUUUSS9$ )a0  Return a strategy for :xp-ref:`valid indices <indexing.html>` of
arrays with the specified shape, which may include dimensions of size zero.

It generates tuples containing some mix of integers, :obj:`python:slice`
objects, ``...`` (an ``Ellipsis``), and ``None``. When a length-one tuple
would be generated, this strategy may instead return the element which will
index the first axis, e.g. ``5`` instead of ``(5,)``.

* ``shape`` is the shape of the array that will be indexed, as a tuple of
  integers >= 0. This must be at least two-dimensional for a tuple to be a
  valid index;  for one-dimensional arrays use
  :func:`~hypothesis.strategies.slices` instead.
* ``min_dims`` is the minimum dimensionality of the resulting array from use
  of the generated index.
* ``max_dims`` is the maximum dimensionality of the resulting array,
  defaulting to ``len(shape) if not allow_newaxis else
  max(len(shape), min_dims) + 2``.
* ``allow_ellipsis`` specifies whether ``None`` is allowed in the index.
* ``allow_ellipsis`` specifies whether ``...`` is allowed in the index.
r   c              3   Z   #    U  H!  n[        U[        5      =(       a    US :  v   M#     g7fr  r  r  s     rL   r  indices.<locals>.<genexpr>  r	  r
  r  r  rV  rW  rN  z	min_dims=z is larger than len(shape)=zC, but it is impossible for an indexing operation to add dimensions zwhen allow_newaxis=False.r   rO  z	max_dims=dimsr   F)rN  rO  rW  rV  allow_fewer_indices_than_dims)r$   r   r   r   r=   rb   rF   r   r   r   r   r   r   r   )r   rN  rO  rV  rW  s        rL   indicesr]    sc   : ueW%95995(EF t]O4t^%56sHj)E
"z!<SZL IP P'		
 Xz*3s5z84q8(CH3u:x0HsHj)h$$$$E
"z!<SZL IP P'		
 Xz*8.%#&+ r\   _args_to_xps)r]   c                  ^ ^^ SnTc  [        [        T S5      ST R                   ST R                   S35        [        [        T R                  [
        5      =(       a    T R                  [        ;   ST R                  < S[         S	U 35        T R                  mS
mO:[        [        T[
        5      =(       a	    T[        ;   ST< S[         S	U 35        Sm T R                  S5      nUR                  5          [        T T4   nU$ ! [         a     [        ST R                   S3[        SS9   N7f = f! [        [        4 a     Of = f[!        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-  S[*        R,                  [(        [$        -  [&        -  [.        -     4UU 4S jjj5       n[!        S
S9SSSS.S["        [
        -  [*        R,                  ["           -  [*        R,                  [
           -  S [$        [0        -  [*        R,                  [0           -  S![2        [
        [4        4   [*        R,                  -  S-  S"[*        R,                  [4           S-  S#[(        S[*        R,                  4UU 4S$ jjj5       n[!        5       S[*        R,                  ["           4UU 4S% jj5       n[!        5       S[*        R,                  ["           4U 4S& jj5       n[!        5       S[*        R,                  ["           4U 4S' jj5       n	[!        5       S[*        R,                  ["           4UU 4S( jj5       n
[!        5       S)S*.S+[6        [8        [6           -  S[*        R,                  ["           4U 4S, jjj5       n[!        5       S)S*.S+[6        [8        [6           -  S[*        R,                  ["           4U 4S- jjj5       n[!        5       S.S*.S+[:        [8        [:           -  S[*        R,                  ["           4U 4S/ jjj5       n[<        R>                  Ul        [@        R>                  Ul        [B        R>                  Ul        [D        R>                  Ul        [F        R>                  U	l        [H        R>                  U
l        [J        R>                  Ul        [L        R>                  Ul        [N        R>                  Ul         " U4S0 jS1[P        5      n0 S2T R                  _S3T_S4U_S5U_S6[R        _S7U_S8U_S9U	_S:U
_S;U_S<U_S=U_S>[T        _S?[V        _S@[X        _SA[Z        _nTSB:  a^  [!        5       SCS*.S+[\        [8        [\           -  S[*        R,                  ["           4U 4SD jjj5       n[^        R>                  Ul        UUSE'   U" SF0 UD6n U[        T T4'   U$ ! [         a     U$ f = f)Ga/  Creates a strategies namespace for the given array module.

* ``xp`` is the Array API library to automatically pass to the namespaced methods.
* ``api_version`` is the version of the Array API which the returned
  strategies namespace should conform to. If ``None``, the latest API
  version which ``xp`` supports will be inferred from ``xp.__array_api_version__``.
  If a version string in the ``YYYY.MM`` format, the strategies namespace
  will conform to that version if supported.

A :obj:`python:types.SimpleNamespace` is returned which contains all the
strategy methods in this module but without requiring the ``xp`` argument.
Creating and using a strategies namespace for NumPy's Array API
implementation would go like this:

.. code-block:: pycon

  >>> xp.__array_api_version__  # xp is your desired array library
  '2021.12'
  >>> xps = make_strategies_namespace(xp)
  >>> xps.api_version
  '2021.12'
  >>> x = xps.arrays(xp.int8, (2, 3)).example()
  >>> x
  Array([[-8,  6,  3],
         [-6,  4,  6]], dtype=int8)
  >>> x.__array_namespace__() is xp
  True

zIf the standard version you want is not available, please ensure you're using the latest version of Hypothesis, then open an issue if one doesn't already exist.N__array_api_version__rD   zf has no attribute __array_api_version__, which is required when inferring api_version. If you believe zF is indeed an Array API module, try explicitly passing an api_version.zxp.__array_api_version__=z(, but it must be a valid version string z. Tzapi_version=z4, but it must be None, or a valid version string in Fr   z#Could not determine whether module z is an Array API libraryr   rX   )force_reusable_valuesrw   r^   rx   ry   rz   r{   r|   r}   r~   rA   c                (   > [        T	TU UUUUUUUS9
$ )Nrw   )r   )
r^   rx   ry   rz   r{   r|   r}   r~   r]   r?   s
           rL   
from_dtype-make_strategies_namespace.<locals>.from_dtype  s0     )+##
 	
r\   r   r   r   r   r   c          
      "   > [        TTU UUUUS9$ r   r   )r^   r   r   r   r   r]   r?   s        rL   arrays)make_strategies_namespace.<locals>.arrays  s'     
 	
r\   c                     > [        TT 5      $ rO   )r  r]   r?   s   rL   scalar_dtypes0make_strategies_namespace.<locals>.scalar_dtypes  s    b+..r\   c                     > [        T 5      $ rO   )r  r  s   rL   boolean_dtypes1make_strategies_namespace.<locals>.boolean_dtypes  s    r""r\   c                     > [        T 5      $ rO   )r  r  s   rL   real_dtypes.make_strategies_namespace.<locals>.real_dtypes  s    Br\   c                     > [        TT 5      $ rO   )r  ri  s   rL   numeric_dtypes1make_strategies_namespace.<locals>.numeric_dtypes  s    r;//r\   r5  r@  r$  c                    > [        TU S9$ Nr@  )r  r$  r?   s    rL   integer_dtypes1make_strategies_namespace.<locals>.integer_dtypes  s     r//r\   c                    > [        TU S9$ rv  )r  rw  s    rL   unsigned_integer_dtypes:make_strategies_namespace.<locals>.unsigned_integer_dtypes  s     (%88r\   r;  c                    > [        TU S9$ rv  )r  rw  s    rL   floating_dtypes2make_strategies_namespace.<locals>.floating_dtypes  s      %00r\   c                   F   >^  \ rS rSrU 4S jr\S 5       rU4S jrSrU =r	$ )6make_strategies_namespace.<locals>.StrategiesNamespacei  c                 `   > S H  nX!;  d  M
  [        SU S35      e   [        TU ]  " S0 UD6  g )Nrp   r]   'z' kwarg requiredr   )
ValueErrorr   r   )r   rL  rI   r   s      rL   r   ?make_strategies_namespace.<locals>.StrategiesNamespace.__init__  s:    /%$q.>%?@@ 0 G&v&r\   c                      U R                   S   $ ! [         a,  n[        SU R                   SU R                   S35      UeS nAff = f)Nrm   zSYou attempted to access 'complex_dtypes', but it is not available for api_version='z' of xp=r   )__dict__KeyErrorrR   r]   rp   )r   rt   s     rL   rm   Emake_strategies_namespace.<locals>.StrategiesNamespace.complex_dtypes  s`    }}%566 $2262B2B1C D))A' 	s    
A'AAc                 \   > U R                   nT(       d  USU R                   S3-  nSU S3$ )Nz, api_version='r  zmake_strategies_namespace(rr   r  )r   f_argsinferred_versions     rL   __repr__?make_strategies_namespace.<locals>.StrategiesNamespace.__repr__  s8    YYF#OD,<,<+=Q??/xq99r\   r   )
rH   r   r   r   r   propertyrm   r  r   r   )r   r  s   @rL   StrategiesNamespacer    s&    	' 
	 
		: 	:r\   r  rp   r]   rc  rf  r   rj  rm  rp  rs  rx  r{  r~  r   r   r   r]  r+   r=  c                    > [        TU S9$ rv  )r!  rw  s    rL   rm   1make_strategies_namespace.<locals>.complex_dtypes  s     #2U33r\   rm   r   )0r   rE   rH   r   r`  r   RELEASED_VERSIONSNOMINAL_VERSIONSr   __array_namespace__r   r   r   r^  r  	TypeErrorr)   r>   rb   rd   r=   r   r  rg   r   r   r	   r:  r   r<  r   __doc__r   r  r  r  r  r  r  r  r   r   r   r   r   r]  r?  r!  )r?   r]   not_available_msgarray	namespacerc  rf  rj  rm  rp  rs  rx  r{  r~  r  rL  rm   r  s   ``               @rL   r*   r*   J  sr   B	% 
 B/0BKK= )L{{m &&	
 	r//5 >((,==(r'') *)):(;2>O=PR	
 ..{C(L[<L-L{n *+2.?-@B	

 !
!!# "k!23	   
1"++>VW	

 i  
 D1 )-(,!%&*'+#'#'
#~
 ;%
 ;%	

 $;
 t
 
 D[
 D[
 
		4#:-7	8
 
 2
0 D1
 BF.2
#~ 1 1( ;;b>O>OPS>TT
U{R..u55
 #s(#b&7&77$>	

 $t+
 
 
		
 
 2
$ /2,,X6 / / #B--h7 # #  **84     0B--h7 0 0 0?0HW--0			8	$0 0
 0?9HW--9			8	$9 9
 081HW--1			8	$1 1
 %,,J__FN*22M,44N&..K,44N,44N&>&F&F#.66O:o :0{ 	j 	&	
 	 	 	. 	{ 	. 	. 	"#: 	? 	, 	 4 	()F  	7!F& Y		4=	4 11	4x(	4 
	4
 "1!8!8#1 #-f-I*3b+&'   s6   !D	 <D6 	'D32D36E	E	W 
W*)W*sphinx)Mockc                   H    \ rS rSr% \\S'   \\S'   \\S'   \\S'   \\S'   Srg)		FloatInfoi:  r   epsr   r   r   r   N)rH   r   r   r   rb   __annotations__rd   r   r   r\   rL   r  r  :  s    	


r\   r  c           	      
   [         R                  " U 5      n[        [        UR                  5      [        UR                  5      [        UR                  5      [        UR                  5      [        UR                  5      5      $ )a  Returns a finfo object compliant with the Array API

Ensures all attributes are Python scalars and not NumPy scalars. This
lets us ignore corner cases with how NumPy scalars operate, such as
NumPy floats breaking our next_down() util.

Also ensures the finfo obj has the smallest_normal attribute. NumPy only
introduced it in v1.21.1, so we just use the equivalent tiny attribute
to keep mocking with older versions working.
)
npr   r  rb   r   rd   r  r   r   tiny)r^   _finfos     rL   
mock_finfor  A  sZ     %&**&**&**&++
 	
r\   rH   mockr`  r,   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   nanastypec                 $    U R                  U5      $ rO   )r  )r   r   s     rL   r   r   i  s    AHHQKr\   r   r   broadcast_arraysaranger   emptyr   onesr   r   r   
logical_orsumnonzerosortunique_valuesanyr   )r   syscollections.abcr   r   r   r   numbersr   r   r   typingr	   r
   r   r   r   r   warningsr   weakrefr   
hypothesisr   r   hypothesis.errorsr   r   hypothesis.extra._array_helpersr   r   r   r   r   r   r   r   r   r   rU  r   r   rJ  hypothesis.internal.conjecturer    r   hypothesis.internal.coverager!   hypothesis.internal.floatsr"   hypothesis.internal.reflectionr#   hypothesis.internal.validationr$   r%   r&   r'   *hypothesis.strategies._internal.strategiesr(   %hypothesis.strategies._internal.utilsr)   __all__r  r  r   listNominalVersion	INT_NAMES
UINT_NAMESra   rc   
REAL_NAMESrf   NUMERIC_NAMESrs   r>   r   rM   r   rU   r[   r   r=   rb   rd   rg   ro   rv   r  r   r   r   r  r  r  r  r  r0  r4  r:  r  r<  r?  r  r  r  r!  r  r]  r^  r*   numpyr  ImportErrormodulesunittest.mockr  r  r  r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   bool_r  r   r  r  r   r  r   r  r   r   r   r  r  r  r  r   r  r   mock_xpr   r\   rL   <module>r     s	    
 A A  !   ' ' @    7 7 0 2  F B  
 L 0&00 4(8#99 99WX#33 33 0	4
J&$[(
+]*&&: 
C 
T#Y 
4 
 
!#
49d3i s 49  *L*L(*L19*L	$*u
w
&'*LZ 
 
3 
3 
 
( %)$(!"&#'##A
A
A
 c>A

 U{T!A
 U{T!A
 d{A
 4KA
 D[A
 A
 A
 tczE)G34A
HM3B%% M3l >B*.~~~ c>B--h77":K:KC:PP~ ;**511	~ c3h""3"33d:~ 

C
 4
'~ ~ ~B 	*S 	*$x. 	*c 	*t 	* 	*Ls L LB<M<Mh<W L
  1 1( ; S R..x8 (x  "3-6>sm	 #3 #x} ## #
 ]+ +V_ $W% % 6E##'!22#x #& 6E##'!22#x #* 6>##'!22#x #& 6?##'!22#x #$ 		. . 
         	
 Dj  Dj *+ & )G(N(N  %  FF F Dj	F
 F F z"F FT %8$9! 9 6:aa+d2aaH	 >J 
( 
y 
(  //'/ WW	/
 hh/ hh/ hh/ hh/ yy/ yy/ yy/ 

/ 

/ ,,/ ==/  XX!/$ FF%/( ()/* hh+/, -/. ,,//2 yy3/4 

5/6 hh7/8 hh9/: WW;/> 

?/B hhC/D E/F ==G/J FFK/N 

O/R WWS/V iiW/Z FF[/\ FF]/G;   3;;&Vs   X #YYY