
    i                     j   % 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J	r	  S SK
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JrJrJr  S S	KJrJ r   S S
K!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/J0r0  S SK1J2r2  S SK3J4r4J5r5  S SK6J7r7  S SK8J9r9  \(       a	  \" SS\S9r:O\" SSS9r:\" S5      r;\" S5      r<\" S5      r=\" S5      r>\" S5      r?\" S5      r@\S/\A4   rB\\CS'   \9" S5      rD\/" S5      rE\/" S 5      rF\" 5       rGS!SS"\HS#\IS$\4S% jrJ " S& S\\:   5      rKS'\IS$\L\A\MS-  4   4S( jrNS'\IS$\A4S) jrO " S* S+\K\:   5      rP " S, S-\K\:   5      rQ\S.\	\K\:      S$\K\:   4S/ j5       rR\S0\K\:   S$\K\:   4S1 j5       rR\S0\K\:   S2\K\;   S$\K\:\;-     4S3 j5       rR\S0\K\:   S2\K\;   S4\K\<   S$\K\:\;-  \<-     4S5 j5       rR\S0\K\:   S2\K\;   S4\K\<   S6\K\=   S$\K\:\;-  \<-  \=-     4
S7 j5       rR\S0\K\:   S2\K\;   S4\K\<   S6\K\=   S8\K\>   S$\K\:\;-  \<-  \=-  \>-     4S9 j5       rR\S:\K\   S$\K\   4S; j5       rR\7" SS<9S:\	\K\      \K\   -  S$\K\   4S= j5       rR " S> S?\K\@   \\?\@4   5      rS\S$\4S@ j5       rTS$\	\   4SA jrU\9" SB5      rV " SC SD\K\:   5      rW\2SGSE\IS"\HS$S4SF jj5       rXg)H    N)abcdefaultdict)CallableSequence)	lru_cache)shuffle)RLock)	TYPE_CHECKINGAnyClassVarGenericLiteral	TypeAliasTypeVarcastoverload)HealthCheckPhase	Verbositysettings)_current_build_contextcurrent_build_context)HypothesisExceptionHypothesisWarningInvalidArgumentNonInteractiveExampleWarningUnsatisfiedAssumption)utils)ConjectureData)calc_label_from_clscalc_label_from_hashcalc_label_from_namecombine_labels)check_function)get_pretty_function_descriptionis_identity_function)defines_strategy)UniqueIdentifierExT)	covariantdefault)r*   TT3T4T5
MappedFromMappedToSearchStrategyRecurTcalculatingz(another attempted draw in MappedStrategyz)single loop iteration in FilteredStrategystrategynamer+   returnc                 >  ^^^^^^^^^^^ US;   d   eSU-   mSU-   mSU-   mS[         S[        4UU4S jjm T" U 5      $ ! [         a     Of = f0 m[        5       mSmS	[         S[        4UUUUUUU4S
 jjmT" U 5        T(       a  [	        T5      m[        [        5      mOSmS	[         S[        4UUUUUU4S jjnSn[	        5       nT(       a  US-  nUS:  a7  [        TR                  5       5      nXe;  d   Xa45       eUR                  U5        Tn[	        5       mU H?  n[        UT5      " U" U5      5      n	U	TU   :w  d  M&  TR                  TU   5        U	TU'   MA     T(       a  M  TR                  5        H  u  p[        U
TU5        M     [        U T5      $ )a  Handle properties which may be mutually recursive among a set of
strategies.

These are essentially lazily cached properties, with the ability to set
an override: If the property has not been explicitly set, we calculate
it on first access and memoize the result for later.

The problem is that for properties that depend on each other, a naive
calculation strategy may hit infinite recursion. Consider for example
the property is_empty. A strategy defined as x = st.deferred(lambda: x)
is certainly empty (in order to draw a value from x we would have to
draw a value from x, for which we would have to draw a value from x,
...), but in order to calculate it the naive approach would end up
calling x.is_empty in order to calculate x.is_empty in order to etc.

The solution is one of fixed point calculation. We start with a default
value that is the value of the property in the absence of evidence to
the contrary, and then update the values of the property for all
dependent strategies until we reach a fixed point.

The approach taken roughly follows that in section 4.2 of Adams,
Michael D., Celeste Hollenbeck, and Matthew Might. "On the complexity
and performance of parsing with derivatives." ACM SIGPLAN Notices 51.6
(2016): 224-236.
>   is_emptyis_cacheablehas_reusable_valuescached_calc_force_targetr7   c                 V   >  [        U T5      $ ! [         a    [        U T5      s $ f = fN)getattrAttributeError)r?   	cache_key	force_keys    i/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/hypothesis/strategies/_internal/strategies.pyforced_value(recursive_property.<locals>.forced_valueq   s1    	.69-- 	.69--	.s    ((Fstratc                    >  T" U 5      $ ! [          a     Of = fTR                  U T5      nU[        L a  SmT$ UTL a#  [        TU '   [        U T5      " T5      TU '   TU    $ U$ NT)rC   getr4   rB   )	rI   resultcalculationr+   rG   hit_recursionmappingrecursentinels	     rF   rQ   !recursive_property.<locals>.recur   s|    	&& 		UH-[  MNx(GEN$UK8?GEN5>!    
Nc                 >   >^  S[         S[        4UUUUUUU 4S jjnU$ )Notherr7   c                    >  T" U 5      $ ! [          a     Of = fTU    R                  T5        TR                  U T5      nUTL a  Tc   eTR                  U 5        TTU '   T$ U$ rA   )rC   addrL   )	rV   rM   r+   rG   	listenersrP   needs_updaterR   rI   s	     rF   recur_inner7recursive_property.<locals>.recur2.<locals>.recur_inner   s}    #E**! e  '[[1F!#///  '!(MrT   )r2   r   )rI   r[   r+   rG   rY   rP   rZ   rR   s   ` rF   recur2"recursive_property.<locals>.recur2   s#    	~ 	# 	 	     r      2   )r2   r   rC   objectsetr   	frozensetitemsrX   rB   updatesetattr)r5   r6   r+   r]   countseenkey	to_updaterI   	new_valuekvrD   rN   rE   rG   rO   rY   rP   rZ   rQ   rR   s     `         @@@@@@@@@@rF   recursive_propertyro   R   s   4 FFFFD ID.K4I.^ . . .H%%  *,GxHM^     
(O 7| @K3?O	n   " E5D

 2:GMMO,C?/SK/?HHSM 	uE{3F5MBIGEN*##Ie$45!*	 ' ,: 9a   8Y''s   A 
AAc                      \ rS rSr% SrSr\\S'   0 r\\	\
\4      \S'   Sr\\-  S-  \S'   S rS	\S
\4S jr\S
\4S j5       r\S
\4S j5       r\S
\4S j5       rS\S
\4S jrS\S
\4S jrS\S
\4S jrS
\4S jrS\\/\4   S
S4S jrS\\/S4   S
S4S jr S\\/\4   S
S4S jr!\S
\"S   4S j5       r#S&S jr$S
\4S jr%S'S jr&\S
\4S  j5       r'\S
\4S! j5       r(S
\4S" jr)S'S# jr*S	\S
\4S$ jr+S%r,g)(r2      a7  A ``SearchStrategy`` tells Hypothesis how to generate that kind of input.

This class is only part of the public API for use in type annotations, so that
you can write e.g. ``-> SearchStrategy[Foo]`` for your function which returns
``builds(Foo, ...)``.  Do not inherit from or directly instantiate this class.
zhypothesis.strategies
__module__LABELSN_SearchStrategy__labelc                     0 U l         g rA   )validate_calledselfs    rF   __init__SearchStrategy.__init__   s
    02r_   datar7   c                     U R                   $ )a  
Returns whether this strategy is currently empty. Unlike ``empty``,
which is computed based on static information and cannot change,
``is_currently_empty`` may change over time based on choices made
during the test case.

This is currently only used for stateful testing, where |Bundle| grows a
list of values to choose from over the course of a test case.

``data`` will only be used for introspection. No values will be drawn
from it in a way that modifies the choice sequence.
)r9   rx   r{   s     rF   is_currently_empty!SearchStrategy.is_currently_empty   s     }}r_   c                     [        U SS5      $ )Nr9   Tro   rw   s    rF   r9   SearchStrategy.is_empty   s     "$
D99r_   c                     [        U SS5      $ )Nr;   Tr   rw   s    rF   r;   "SearchStrategy.has_reusable_values  s    !$(=tDDr_   c                     [        U SS5      $ )z^
Whether it is safe to hold on to instances of this strategy in a cache.
See _STRATEGY_CACHE.
r:   Tr   rw   s    rF   r:   SearchStrategy.is_cacheable  s     "$==r_   rQ   c                     grK    rx   rQ   s     rF   calc_is_cacheable SearchStrategy.calc_is_cacheable  s    r_   c                     gNFr   r   s     rF   calc_is_emptySearchStrategy.calc_is_empty  s     r_   c                     gr   r   r   s     rF   calc_has_reusable_values'SearchStrategy.calc_has_reusable_values'  s    r_   c                   ^  [        [        SS5      c]  [        R                  S   R                  c   [        R
                  R                  S5      b  [        R                  " ST < S3[        SS9  [        R                  nUb=  UR                  b%  UR                  R                  S	:  a  [        S
5      e[        S5      e T R                  R!                  5       $ ! ["        [$        4 a
    / T l         Of = fS	SKJn  U" T 5      [+        SSS[,        R.                  [0        R2                  4[5        [6        5      S9S[8        SS4U 4S jj5       5       nU" 5         [;        T R                  5        T R                  R!                  5       $ )zProvide an example of the sort of value that this strategy generates.

This method is designed for use in a REPL, and will raise an error if
called from inside |@given| or a strategy definition.  For serious use,
see |@composite| or |st.data|.
ps1N__main__PYTEST_CURRENT_TESTzThe `.example()` method is good for exploring strategies, but should only be used interactively.  We recommend using `@given` for tests - it performs better, saves and replays failures to avoid flakiness, and reports minimal examples. (strategy: )   
stacklevelr   a  Using example() inside a strategy definition is a bad idea. Instead consider using hypothesis.strategies.builds() or @hypothesis.strategies.composite to define your strategy. See https://hypothesis.readthedocs.io/en/latest/reference/strategies.html#hypothesis.strategies.builds or https://hypothesis.readthedocs.io/en/latest/reference/strategies.html#hypothesis.strategies.composite for more details.a  Using example() inside a test function is a bad idea. Instead consider using hypothesis.strategies.data() to draw more examples during testing. See https://hypothesis.readthedocs.io/en/latest/reference/strategies.html#hypothesis.strategies.data for more details.)given
   )databasemax_examplesdeadline	verbosityphasessuppress_health_checkexr7   c                 <   > TR                   R                  U 5        g rA   )_SearchStrategy__examplesappend)r   rx   s    rF   !example_generating_inner_functionASearchStrategy.example.<locals>.example_generating_inner_functione  s     OO""2&r_   )rB   sysmodules__spec__osenvironrL   warningswarnr   r   valuer{   depthr   r   poprC   
IndexErrorhypothesis.corer   r   r   quietr   generatelistr   r)   r   )rx   contextr   r   s   `   rF   exampleSearchStrategy.example*  sy    3t$, KK
#,,8 zz~~34@
 MM< =A81F - )..||'GLL,>,>,B)	 	 *S 	+??&&((
+ 	+(*DO	+ 	* 
t	 ooNN$"&{"3


	'	'	'


 
	'
 	*+ ""$$s   C C65C6packSearchStrategy[T]c                 8    [        U5      (       a  U $ [        XS9$ )zReturns a new strategy which generates a value from this one, and
then returns ``pack(value)``.  For example, ``integers().map(str)``
could generate ``str(5)`` == ``"5"``.
r   )r&   MappedStrategy)rx   r   s     rF   mapSearchStrategy.mapz  s    
  %%Kd..r_   expandc                     SSK Jn  U" XS9$ )a  Old syntax for a special case of |@composite|:

.. code-block:: python

    @st.composite
    def flatmap_like(draw, base_strategy, expand):
        value = draw(base_strategy)
        new_strategy = expand(value)
        return draw(new_strategy)

We find that the greater readability of |@composite| usually outweighs
the verbosity, with a few exceptions for simple cases or recipes like
``from_type(type).flatmap(from_type)`` ("pick a type, get a strategy for
any instance of that type, and then generate one of those").
r   )FlatMapStrategy)r   )*hypothesis.strategies._internal.flatmappedr   )rx   r   r   s      rF   flatmapSearchStrategy.flatmap  s    $ 	Ot33r_   	conditionzSearchStrategy[Ex]c                     [        X4S9$ )a  Returns a new strategy that generates values from this strategy
which satisfy the provided condition.

Note that if the condition is too hard to satisfy this might result
in your tests failing with an Unsatisfiable exception.
A basic version of the filtering logic would look something like:

.. code-block:: python

    @st.composite
    def filter_like(draw, strategy, condition):
        for _ in range(3):
            value = draw(strategy)
            if condition(value):
                return value
        assume(False)

conditions)FilteredStrategyrx   r   s     rF   filterSearchStrategy.filter  s    $  >>r_   c                     U /$ rA   r   rw   s    rF   branchesSearchStrategy.branches  s	    vr_   c                 0   [        U[        5      (       d  [        SU< 35      e/ nUR                  [        U [        5      (       a  U R
                  OU /5        UR                  [        U[        5      (       a  UR
                  OU/5        [	        U5      $ )zReturn a strategy which produces values by randomly drawing from one
of this strategy or the other strategy.

This method is part of the public API.
zCannot | a SearchStrategy with )
isinstancer2   
ValueErrorextendOneOfStrategyoriginal_strategies)rx   rV   
strategiess      rF   __or__SearchStrategy.__or__  s     %00>uiHII ,.
(24(G(GD$$dV	
 	)3E=)I)IE%%PUw	
 Z((r_   c                 B    [         R                  " SU < S3[        SS9  g)Nzbool(z/) is always True, did you mean to draw a value?r   r   T)r   r   r   rw   s    rF   __bool__SearchStrategy.__bool__  s&    D8JK	

 r_   c                    [         R                  " 5       nU R                  R                  US5      (       a  g SU R                  U'   U R	                  5         U R
                    U R                    g! [         a    SU R                  U'   e f = f)zThrow an exception if the strategy is not valid.

Strategies should implement ``do_validate``, which is called by this
method. They should not override ``validate``.

This can happen due to invalid arguments, or lazy construction.
FNT)	threading	get_identrv   rL   do_validater9   r;   	Exception)rx   	thread_ids     rF   validateSearchStrategy.validate  s     '')	##Iu55"	.2D  +MM$$ 	.3D  +	s   7A1 1Bc                     U R                   n UR                  U   $ ! [         a     Of = f[        U5      nX!R                  U'   U$ rA   )	__class__rs   KeyErrorr    )rx   clsrM   s      rF   class_labelSearchStrategy.class_label  sJ    nn	::c?" 		$S) 

3s    
**c                    [        U R                  =n[        5      (       a  U$ [           U R                  [        L a
   S S S 5        g[        U l        U R                  5       U l        U R                  sS S S 5        $ ! , (       d  f       g = fNr   )r   rt   int
label_lockr4   
calc_label)rx   labels     rF   r   SearchStrategy.label  s^    ,us33L||{* Z 'DL??,DL<< ZZs   A=+A==
Bc                     U R                   $ rA   )r   rw   s    rF   r   SearchStrategy.calc_label  s    r_   c                     g rA   r   rw   s    rF   r   SearchStrategy.do_validate  s    r_   c                 D    [        [        U 5      R                   S35      e)Nz.do_draw)NotImplementedErrortype__name__r}   s     rF   do_drawSearchStrategy.do_draw!  s    !T$Z%8%8$9"BCCr_   )
__examples__labelrv   )rV   r   r7   zSearchStrategy[Ex | T]r7   N)-r   rr   __qualname____firstlineno____doc__str__annotations__rs   r   dictr   r   rt   r(   ry   r   boolr~   propertyr   r9   r;   r:   r3   r   r   r   r)   r   r   r,   r   r   r   r   r   r   r   r   r   r   r   r   r   __static_attributes__r   r_   rF   r2   r2      s    .J-(*FHT$)_%* .2GS##d*13~ $  :# : :  ES E E >c > >v $ 6 d f  N% N%`/"q) /.A /4t%8894	4<?"s 3 ?8L ?( (#78  )<$ "H S   
 s 
  
  C  DN Dr Dr_   r   c                 >     S[        U 5      4$ ! [         a     gf = f)NT)FN)hash	TypeErrorr   s    rF   _is_hashabler  %  s(    d5k"" s    
c                     [        U 5      S   $ r   )r  r  s    rF   is_hashabler  .  s    q!!r_   c                   ~  ^  \ rS rSr% SrSr\\   \S'   SSSS.S\	\
   S	\S-  S
\\\4   S-  S\\\S   \\
/\4   4   S4   4U 4S jjjrS\\
/\4   S\\   4S jrS\\
/\4   S\\
   4S jrS rS\4S jrS\S\4S jrS\S\4S jrS\
S\
\-  4S jrS\S\
4S jrS\S\
\-  4S jrS\S\
\-  4S jr S r!U =r"$ )!SampledFromStrategyi2  zA strategy which samples from a set of elements. This is essentially
equivalent to using a OneOfStrategy over Just strategies but may be more
efficient and convenient.
i'  _MAX_FILTER_CALLSNr   
force_reprforce_repr_bracestransformationselementsr  r  r  )r   r   .c                   > [         TU ]  5         [        R                  " US5      U l        U R                  (       d   eX l        X0l        X@l        S U l        g )Nsampled_from)	superry   cucheck_sampler  r  r  _transformations_cached_repr)rx   r  r  r  r  r   s        rF   ry   SampledFromStrategy.__init__:  sG     	.A}}}$!2 /(,r_   r   r7   c                     [        U 5      " U R                  U R                  U R                  / U R                  QSU4P7S9n[        [        [           U5      $ )Nr   r  )r   r  r  r  r  r   r2   r,   )rx   r   ss      rF   r   SampledFromStrategy.mapN  sR    JMM"44Cd33CeT]C	
 N1%q))r_   r   c                     [        U 5      " U R                  U R                  U R                  / U R                  QSU4P7S9$ )Nr   r  )r   r  r  r  r  r   s     rF   r   SampledFromStrategy.filterX  sB    DzMM"44Kd33Kh	5JK	
 	
r_   c                   ^ U R                   c  [        m[        U R                  5      S:  a+  SR	                  U4S jU R                  S S  5       5      S-   O$SR	                  U4S jU R                   5       5      nU R
                  =(       d    SnU R                  =(       d    SUS    U US	    S
3nSR	                  S U R                   5       5      nX4-   nXPl         U R                   $ )Ni   , c              3   4   >#    U  H  nT" U5      v   M     g 7frA   r   .0rn   reps     rF   	<genexpr>/SampledFromStrategy.__repr__.<locals>.<genexpr>d  s     >*=Q#a&&*=   z, ...c              3   4   >#    U  H  nT" U5      v   M     g 7frA   r   r)  s     rF   r,  r-  f  s     =}!s1vv}r.  )(r   zsampled_from(r   r`   r    c              3   J   #    U  H  u  pS U S[        U5       S3v   M     g7f).r0  r   Nr%   )r*  r6   fs      rF   r,  r-  l  s/      #4GD D6:1=>a@4s   !#)r  r%   lenr  joinr  r  r  )rx   
elements_sbraces
instance_stransforms_srepr_sr+  s         @rF   __repr__SampledFromStrategy.__repr__`  s    $1C t}}%+ 		>$--*=>>HYY=t}}== 
 ++9zFV]6!9+j\&QR)TU#V  77 ##44# L  .F &   r_   c                    [        U R                  5      u  p[        U R                  [        5      (       d(  U(       aI  [	        S U R                   5       5      (       d(  [        U R                  [        [        U5      5      5      $ U R                  /nU R                   HP  n[        U5      (       d  M  UR                  [        U[        5      (       a  UR                  O
[        U5      5        MR     [        U6 $ )Nc              3   B   #    U  H  n[        U[        5      v   M     g 7frA   r   r2   )r*  es     rF   r,  1SampledFromStrategy.calc_label.<locals>.<genexpr>  s     M}!
1n55}   )r  r  r   rangeanyr#   r   r"   r  r  r   r2   r   r!   )rx   elements_is_hashable
hash_valuelabelselements        rF   r   SampledFromStrategy.calc_labelt  s    : .:$---H*	dmmU++ Mt}}MMM!  "6s:"G  ""#}}Gw''MMg~66 )'2	 % v&&r_   rQ   c                 $    U R                   (       + $ rA   )r  r   s     rF   r   ,SampledFromStrategy.calc_has_reusable_values  s    
 ((((r_   c                 ,    [        U R                  5      $ rA   )r  r  r   s     rF   r   %SampledFromStrategy.calc_is_cacheable  s    4==))r_   rJ  c                     U R                    H]  u  p#US:X  a5  U" U5      n[        R                  =n(       a  UR                  XCU/0 S9  UnM@  US:X  d   eU" U5      (       a  MW  [        s  $    U$ )Nr   argskwargsr   )r  r   r   record_callfilter_not_satisfied)rx   rJ  r6   r5  rM   build_contexts         rF   
_transformSampledFromStrategy._transform  sx     ,,GDu}7$:$@$@@=@!--fwiPR-S x'''zz// - r_   r{   c                 $   U R                  U5      n[        U[        5      (       a4  [        S U R                   5       5      (       a  SU R                  4Ul        U[        L a  UR                  SU < 35        [        U[        5      (       a   eU$ )Nc              3   B   #    U  H  n[        U[        5      v   M     g 7frA   rA  )r*  xs     rF   r,  .SampledFromStrategy.do_draw.<locals>.<genexpr>  s      6
3@aJq.))=rD  zMsampled_from was given a collection of strategies: {!r}. Was one_of intended?'Aborted test because unable to satisfy )	do_filtered_drawr   r2   allr  -_sampled_from_all_strategies_elements_messagerU  mark_invalidr(   rx   r{   rM   s      rF   r   SampledFromStrategy.do_draw  s    &&t,fn--# 6
37==6
 3
 3
-BD>
 )) GxPQf&67777r_   ic                 >    U R                  U R                  U   5      $ rA   )rW  r  )rx   rd  s     rF   get_elementSampledFromStrategy.get_element  s    t}}Q/00r_   c                    [        5       n[        S5       H|  nUR                  S[        U R                  5      S-
  5      nXB;  d  M2  U R                  U5      nU[        La  Us  $ U(       d  SUR                  SU < S3'   UR                  U5        M~     [        U R                  5      [        U5      -
  nU(       d  [        $ [        X`R                  S-
  5      nUR                  SUS-
  5      n/ n[        [        [        U R                  5      U R                  S-
  5      5       H  nXB;  d  M
  U R                  U5      nU[        Ld  M&  [        U[        5      (       a   eUR                  XE45        [        U5      U:  d  M`  UR                  S[        U R                  5      S-
  US9  Us  $    U(       a<  UR                  U5      u  pEUR                  S[        U R                  5      S-
  US9  U$ [        $ )N   r   r`   r1  Retried draw from  to satisfy filter)forced)rc   rE  draw_integerr6  r  rf  rU  eventsrX   minr  r   r(   r   choice)	rx   r{   known_bad_indices_rd  rJ  max_good_indicesspeculative_indexalloweds	            rF   r^  $SampledFromStrategy.do_filtered_draw  s    '*e qA!!!S%7!%;<A)**1-"66"N(SUDKK"4TH<N OP!%%a(  t}}-4E0FF'' /1G1G!1KL
 !--a1AA1EF )+s3t}}-t/E/E/IJKA)**1-"66)'3CDDDDNNA<07|&77 ))!S-?!-CA)N& L W-JAaT]]!3a!7BN##r_   )r  r  r  r  r  )#r   rr   r  r  r  r  r   r   r  r   r)   r  tupler   r   r   ry   r,   r2   r   r   r=  r   r3   r  r   r   r(   rW  r   r   rf  r^  r	  __classcell__r   s   @rF   r  r  2  s|   
 (.x}- "&48 -2,- $J	-
 !c?T1- '/*HbT3Y,??@
- -(*"q) *nQ.? *
"s 3 
r8J 
!(1'C 1'f)f ) )*v *$ *
  
	(N r 1S 1R*:%: 17$^ 7$=M8M 7$ 7$r_   r  c                     ^  \ rS rSrSrS\\\      4U 4S jjrS\	S\
4S jrS\	S\
4S jrS\	S\
4S	 jr\S\\\      4S
 j5       rS\4S jrS\S\4S jrS\4S jrSS jr\S\\\      4S j5       rS\\/\4   S\\   4S jrSrU =r$ )r   i  a'  Implements a union of strategies. Given a number of strategies this
generates values which could have come from any of them.

The conditional distribution draws uniformly at random from some
non-empty subset of these strategies and then draws from the
conditional distribution of that strategy.
r   c                 |   > [         TU ]  5         [        U5      U l        S U l        SU l        [        5       U l        g r   )r  ry   rw  r   "_OneOfStrategy__element_strategies_OneOfStrategy__in_branchesr	   _branches_lock)rx   r   r   s     rF   ry   OneOfStrategy.__init__  s5    #(#4 IM!"#gr_   rQ   r7   c                 B   ^ [        U4S jU R                   5       5      $ )Nc              3   4   >#    U  H  nT" U5      v   M     g 7frA   r   r*  rB  rQ   s     rF   r,  .OneOfStrategy.calc_is_empty.<locals>.<genexpr>"       >%=588%=r.  r_  r   r   s    `rF   r   OneOfStrategy.calc_is_empty!      >T%=%=>>>r_   c                 B   ^ [        U4S jU R                   5       5      $ )Nc              3   4   >#    U  H  nT" U5      v   M     g 7frA   r   r  s     rF   r,  9OneOfStrategy.calc_has_reusable_values.<locals>.<genexpr>%  r  r.  r  r   s    `rF   r   &OneOfStrategy.calc_has_reusable_values$  r  r_   c                 B   ^ [        U4S jU R                   5       5      $ )Nc              3   4   >#    U  H  nT" U5      v   M     g 7frA   r   r  s     rF   r,  2OneOfStrategy.calc_is_cacheable.<locals>.<genexpr>(  r  r.  r  r   s    `rF   r   OneOfStrategy.calc_is_cacheable'  r  r_   c                 J   U R                   c  U 1n/ nU R                   Hp  n[        U5        UR                  (       a  M!  UR                   H?  nXA;  d  M
  UR                  (       a  M  UR                  U5        UR                  U5        MA     Mr     X l         U R                   $ rA   )r|  r   check_strategyr9   r   rX   r   )rx   ri   r   argr"  s        rF   element_strategies OneOfStrategy.element_strategies*  s    $$,  *.D/1J//s#||| \\= HHQK&--a0 * 0 )3%(((r_   c                 P    [        U R                  /S U R                   5       Q76 $ )Nc              3   8   #    U  H  oR                   v   M     g 7frA   )r   )r*  ps     rF   r,  +OneOfStrategy.calc_label.<locals>.<genexpr>J  s     J1IA1Is   )r#   r   r   rw   s    rF   r   OneOfStrategy.calc_labelH  s+    
J1I1IJ
 	
r_   r{   c                    ^ TR                  [        U R                  5      R                  U4S j5      5      nTR                  U5      $ )Nc                 0   > U R                  T5      (       + $ rA   )r~   )r"  r{   s    rF   <lambda>'OneOfStrategy.do_draw.<locals>.<lambda>P  s    a22488r_   )drawr  r  r   )rx   r{   r5   s    ` rF   r   OneOfStrategy.do_drawM  s>    99 7 78??8

 yy""r_   c                 r    SR                  SR                  [        [        U R                  5      5      5      $ )Nz
one_of({})r'  )formatr7  r   reprr   rw   s    rF   r=  OneOfStrategy.__repr__U  s)    ""499St7O7O-P#QRRr_   c                 J    U R                    H  nUR                  5         M     g rA   )r  r   )rx   rB  s     rF   r   OneOfStrategy.do_validateX  s    ((AJJL )r_   c                 
   U R                   b  U R                  $ U R                     U R                  (       d$   SU l        U R                  SU l        sS S S 5        $ U /sS S S 5        $ ! SU l        f = f! , (       d  f       g = f)NTF)r|  r  r~  r}  rw   s    rF   r   OneOfStrategy.branches\  sv    $$0***  %%/)-D&22).D& !  v !  */D& ! s(   A4A(A4A4(	A11A44
Br   c           
          [        [        U R                   Vs/ s H  o"R                  U5      PM     sn5      SS9$ s  snf )Nr   r   )r   r   r   r   )rx   r   r"  s      rF   r   OneOfStrategy.filterl  s;    8P8PQ8P188I.8PQR
 	
Qs   =)__element_strategies__in_branchesr~  r   r   )r   rr   r  r  r  r   r2   r)   ry   r3   r  r   r   r   r  r  r   r   r   r   r  r=  r   r   r   r   r   r	  rx  ry  s   @rF   r   r     s    &8N2,>#? &?6 ?d ??f ? ??v ?$ ? )H^B-?$@ ) ):
C 

#N #r #S# S (>"#56  
"s 3 
r8J 
 
r_   r   __argsc                     g rA   r   )r  s    rF   one_ofr  s       r_   __a1c                     g rA   r   )r  s    rF   r  r  z      r_   __a2c                     g rA   r   )r  r  s     rF   r  r    r  r_   __a3c                     g rA   r   )r  r  r  s      rF   r  r    r  r_   __a4c                     g rA   r   )r  r  r  r  s       rF   r  r    s     r_   __a5c                     g rA   r   )r  r  r  r  r  s        rF   r  r    s     r_   rR  c                      g rA   r   rR  s    rF   r  r    r  r_   )eagerc                     [        U 5      S:X  a'  [        U S   [        5      (       d   [        U S   5      n [        U 5      S:X  a  [        U S   [        5      (       a  U S   $ U (       a0  [        S U  5       5      (       d  [        S[        U 5      < S35      e[        [        [           U 5      n [        U 5      $ ! [         a     Nf = f)a  Return a strategy which generates values from any of the argument
strategies.

This may be called with one iterable argument instead of multiple
strategy arguments, in which case ``one_of(x)`` and ``one_of(*x)`` are
equivalent.

Examples from this strategy will generally shrink to ones that come from
strategies earlier in the list, then shrink according to behaviour of the
strategy that produced them. In order to get good shrinking behaviour,
try to put simpler strategies first. e.g. ``one_of(none(), text())`` is
better than ``one_of(text(), none())``.

This is especially important when using recursive strategies. e.g.
``x = st.deferred(lambda: st.none() | st.tuples(x, x))`` will shrink well,
but ``x = st.deferred(lambda: st.tuples(x, x) | st.none())`` will shrink
very badly indeed.
r`   r   c              3   B   #    U  H  n[        U[        5      v   M     g 7frA   rA  )r*  as     rF   r,  one_of.<locals>.<genexpr>  s     Dt!
1n55trD  zDid you mean st.sampled_from(z\)?  st.one_of() is used to combine strategies, but all of the arguments were of other types.)r6  r   r2   rw  r  rF  r   r   r   r   r   r  s    rF   r  r    s    4 4yA~ja.AA	a>D 4yA~*T!Wn== AwCDtDDD +DJ> :S S
 	
 ($/D%  		s   B< <
C	C	c                      ^  \ rS rSrSrS\\   S\\/\4   SS4U 4S jjr	S\
S\4S	 jrS\
S\4S
 jrS\4S jrSS jrS\S\4S jr\S\\\      4S j5       rS\\/\4   SS4U 4S jjrSrU =r$ )r   i  zA strategy which is defined purely by conversion to and from another
strategy.

Its parameter and distribution come from that other strategy.
r5   r   r7   Nc                 :   > [         TU ]  5         Xl        X l        g rA   )r  ry   mapped_strategyr   )rx   r5   r   r   s      rF   ry   MappedStrategy.__init__  s    
 	'	r_   rQ   c                 &    U" U R                   5      $ rA   r  r   s     rF   r   MappedStrategy.calc_is_empty      T))**r_   c                 &    U" U R                   5      $ rA   r  r   s     rF   r    MappedStrategy.calc_is_cacheable  r  r_   c                     [        U S5      (       d+  U R                  < S[        U R                  5       S3U l        U R                  $ )Nr  z.map(r   )hasattrr  r%   r   r  rw   s    rF   r=  MappedStrategy.__repr__  sF    t^,,#'#7#7":%@_`d`i`i@j?kkl mD   r_   c                 8    U R                   R                  5         g rA   )r  r   rw   s    rF   r   MappedStrategy.do_validate  s    %%'r_   r{   c           	         [         R                  " 5          [        U R                  [        5      (       aT  [        U R                  [        R                  [        R                  45      (       a  [         R                  " S[        5        [        S5       H  n UR                  [        5        UR                  U R                  5      nU R                  U5      nUR!                  5         [#        5       R%                  X@R                  U/0 S9  Us  sS S S 5        $    S S S 5        [&        e! [&         a    UR!                  SS9   M  f = f! , (       d  f       [&        e= f)Nignoreri  rQ  Tdiscard)r   catch_warningsr   r   r   
issubclassr   MappingSetsimplefilterBytesWarningrE  
start_span$MAPPED_SEARCH_STRATEGY_DO_DRAW_LABELr  r  	stop_spanr   rT  r   )rx   r{   rr  r[  rM   s        rF   r   MappedStrategy.do_draw  s   $$&$))T**z		CKK10 0 %%h=1X
1OO$HI		$"6"67A!YYq\FNN$)+77		B 8  "M '&
  '" $# - 1NN4N01 '&" $#s7   BEA6D+EE+EEEE
Ec                 |    U R                   R                   Vs/ s H  n[        XR                  S9PM     sn$ s  snf )Nr   )r  r   r   r   rx   r5   s     rF   r   MappedStrategy.branches  s>     !0099
9 8))49
 	
 
   9r   zSearchStrategy[MappedTo]c                   > [        5       n[        U R                  U5      (       a`  [        U R                  [        5      (       a)  [        U R                  [        R                  5      (       d'  U R                  [        5       ;   d  [        TU ])  U5      $ UR                  U R                  U5      n[        USS 5      U R                  L a  [        TU ])  U5      $ [        [	        U 5      " X0R                  5      U4S9$ )Nfiltered_strategyr   )_list_strategy_typer   r  r   r   r  r   
Collection_collection_ish_functionsr  r   rB   r   )rx   r   ListStrategynewr   s       rF   r   MappedStrategy.filter  s    
 +,$..==		4((Z		3>>-R-Ryy5777>),, !!$"6"6	B3+T2d6J6JJ7>),,  T
3		 :	|TTr_   )r  r  r   r   )r   rr   r  r  r  r2   r0   r   r1   ry   r3   r  r   r   r  r=  r   r   r   r  r   r   r   r   r	  rx  ry  s   @rF   r   r     s     , 
|X-. 
	+6 +d ++v +$ +!# !
($N $x $( 
(>(#;< 
 
U!8*c/2U	#U Ur_   r   c                      SSK Jn   U $ )Nr   r  )+hypothesis.strategies._internal.collectionsr  r  s    rF   r  r  )  s    Hr_   c                     [         /n [        R                  R                  S5      =n(       a  U UR                  UR
                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  R                  UR                  R                   UR                  R"                  UR$                  UR&                  UR(                  /-  n U $ )Nnumpy)sortedr   r   rL   
empty_likeeyeidentity	ones_like
zeros_likearrayasarray
asanyarrayascontiguousarrayasmatrixcopyrec
fromarraysfromrecordsdiagasarray_chkfiniteasfortranarray)funcsnps     rF   r  r  0  s    HE[[__W%%r% 	MMFFKKLLMMHHJJMM  KKGGFFLLFFFFGG  %
 	
* Lr_   zfilter not satisfiedc                     ^  \ rS rSrS\\   S\\\/\4   S4   4U 4S jjr	S\
S\4S jrS\
S\4S	 jrS\4S
 jrSS jrS\\/\4   SS4S jr\S\\/\4   4S j5       rS\S\4S jrS\S\\-  4S jr\S\\\      4S j5       rSrU =r$ )r   iQ  r5   r   .c                 B  > [         TU ]  5         [        U[        5      (       a&  UR                  U-   U l        UR
                  U l        OX l        Xl        [        U R                  [        5      (       d   e[        U R
                  [        5      (       a   eS U l        g rA   )r  ry   r   r   flat_conditionsr  rw  _FilteredStrategy__condition)rx   r5   r   r   s      rF   ry   FilteredStrategy.__init__R  s     	h 011 ((:5   :B9S9SD"#- %-"$..6666d446FGGGG7;r_   rQ   r7   c                 &    U" U R                   5      $ rA   r  r   s     rF   r   FilteredStrategy.calc_is_emptye      T++,,r_   c                 &    U" U R                   5      $ rA   r
  r   s     rF   r   "FilteredStrategy.calc_is_cacheableh  r  r_   c                     [        U S5      (       dA  SR                  U R                  SR                  S U R                   5       5      5      U l        U R
                  $ )Nr  z{!r}{}r1  c              3   @   #    U  H  nS [        U5       S3v   M     g7f)z.filter(r   Nr4  )r*  conds     rF   r,  ,FilteredStrategy.__repr__.<locals>.<genexpr>o  s'       4 >tDEQG 4s   )r  r  r  r7  r  r  rw   s    rF   r=  FilteredStrategy.__repr__k  sV    t^,, (&&  $ 4 4 !D    r_   c                 D   U R                   R                  5         U R                   nU R                   H  nUR                  U5      nM     [	        U[
        5      (       a+  [
        R                  XR                   UR                  5        g [
        R                  XS5        g )Nr   )r  r   r  r   r   r   ry   )rx   freshr  s      rF   r   FilteredStrategy.do_validatev  s     	'') &&((DLL&E )e-.. %%--u/D/D %%d26r_   r   zFilteredStrategy[Ex]c                     U R                   R                  U5      n[        U[        5      (       a-  [        UR                   U R                  UR                  -   5      $ [        X R                  5      $ rA   )r  r   r   r   r  )rx   r   outs      rF   r   FilteredStrategy.filter  sf    
 $$++I6 c+,,#%%t';';c>Q>Q'Q   %9%9::r_   c                    ^  T R                   =nb  U$ [        T R                  5      S:X  a  T R                  S   nO#[        T R                  5      S:X  a  S nOU 4S jnUT l         U$ )Nr`   r   c                     grK   r   )rr  s    rF   r  ,FilteredStrategy.condition.<locals>.<lambda>  s    $r_   c                 D   >^  [        U 4S jTR                   5       5      $ )Nc              3   2   >#    U  H  o" T5      v   M     g 7frA   r   )r*  r  r[  s     rF   r,  ?FilteredStrategy.condition.<locals>.<lambda>.<locals>.<genexpr>  s      &$8DQ$8s   )r_  r  )r[  rx   s   `rF   r  r    s    # &$($8$8& #r_   )r  r6  r  r   s   ` rF   r   FilteredStrategy.condition  sn    
 )))I6t##$),,Q/I%%&!+&II %r_   r{   c                     U R                  U5      nU[        La  [        [        U5      $ UR	                  SU < 35        g )Nr]  )r^  rU  r   r)   ra  rb  s      rF   r   FilteredStrategy.do_draw  s>    &&t,--F##CD8LMr_   c                 <   [        S5       H  nUR                  [        5        UR                  U R                  5      nU R                  U5      (       a  UR                  5         Us  $ UR                  SS9  US:X  d  Mt  SUR                  SU < S3'   M     [        $ )Nri  Tr  r   r1  rj  rk  )	rE  r  &FILTERED_SEARCH_STRATEGY_DO_DRAW_LABELr  r  r   r  rn  rU  )rx   r{   rd  r   s       rF   r^  !FilteredStrategy.do_filtered_draw  s    qAOOBCIId445E~~e$$ t,6SUDKK"4TH<N OP  $#r_   c                 |    U R                   R                   Vs/ s H  n[        XR                  S9PM     sn$ s  snf )N)r5   r   )r  r   r   r  r  s     rF   r   FilteredStrategy.branches  s@     !22;;
; h;O;OP;
 	
 
r  )__conditionr  r  r  r   )r   rr   r  r  r2   r)   rw  r   r   ry   r3   r  r   r   r  r=  r   r   r  r   r   r   r(   r^  r   r   r	  rx  ry  s   @rF   r   r   Q  s   <&r*<8=htSy>QSV>V8W<&-6 -d --v -$ -	!# 	!7,;"s 3 ;8N ; 8RD#I.  (NN Nr N$^ $=M8M $ 
(>"#56 
 
r_   r   r  c                 8   [        U[        5      (       d   e[        U [        5      (       dn  Sn[        U [        [        45      (       a  SR                  U=(       d    S5      nU(       a  US-  n[        SU SU U < S[        U 5      R                   S35      eg )	Nr1  z, such as st.sampled_from({}),z...=zExpected a SearchStrategyz	 but got z (type=r   )	r   r  r2   r   rw  r  r   r   r   )r  r6   hints      rF   r  r    s    dC    c>**cD%=))3::4=5IDCKD'vYtfSG D#Y''(+
 	
 +r_   )r1  )Yr   r   r   r   collectionsr   r   collections.abcr   r   	functoolsr   randomr   r	   typingr
   r   r   r   r   r   r   r   r   hypothesis._settingsr   r   r   r   hypothesis.controlr   r   hypothesis.errorsr   r   r   r   r   hypothesis.internal.conjecturer   r  #hypothesis.internal.conjecture.datar   $hypothesis.internal.conjecture.utilsr    r!   r"   r#   hypothesis.internal.coverager$   hypothesis.internal.reflectionr%   r&   %hypothesis.strategies._internal.utilsr'   hypothesis.utils.conventionsr(   r)   r,   r-   r.   r/   r0   r1   r  r3   r  r4   r  r$  r   r  rb   ro   r2   rw  r   r  r  r  r   r  r   r  r  rU  r   r  r   r_   rF   <module>r;     s}   
 
   ( .   
 
 
 I H L  7 >  8 C 9	s	3B		&BCLT]T]T]\"
:./56	 6}-';.( $ *>/* & W
H(!1 H( H(v H(RU H(VEDWR[ EDP
 5sTz)9#: "v "$ "\$., \$~_
N2& _
D 
^B'(B 
 
# r(:  
 


$21$5BF 
 


$21$5=KB=OBFRK  
 




 
 
	
 BFRK"$% 
 




 
 
	
 
 BFRK"$r)* 
 
.% .*=  
 .N3'(>#+>>.C. .bMU^H-wz87K/L MU` S  8C= < ((>? y
~b) y
x 
 
c 
4 
 
r_   