
    h4              	         % S r SSKJr  SSKrSSKJr  SSK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  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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)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=J>r>J?r?J@r@JArA  SSKBJCrC  SSKDJErEJFrF  \
(       a&  SSKJGrG  SSKJHrHJIrI  SSKJJrJ  SSKKJLrLJMrMJNrN  SSK%JOrOJPrP  SrQSrR\R                  " \\5      \R                  " \\5      \R                  " \\5      \R                  " \\5      \R                  " \\5      S.\R                  " S\ 5      \R                  " S\!5      \R                  " S\"5      \R                  " S\#5      \R                  " S\$5      S.S.rTS\US'    S5SS.     S6S jjjrS S5SSS.       S7S jjjrVS8S jrWS9S jrXS:S  jrY\R4S;S! jjrZS<S" jr[S=S# jr\ S>     S?S$ jjr]S@SAS% jjr^ SB     SCS& jjr_SSSS'S(.             SDS) jjr`SS*.       SES+ jjraSFS, jrbSGS- jrc0 \(\W" 5       _\2\S" S.SS9_\3\S" S/SS9_\4\S" S0SS9_\5\S" SSS9_\6\S" S1SS9_\=\S" S.S'S9_\>\S" S/S'S9_\?\S" S0S'S9_\@\S" SS'S9_\A\S" S1S'S9_\<\[" 5       _\*\\" 5       _\:\X" 5       _\'\Y" 5       _\8\b" 5       _\9\c" 5       _rdS2\US3'   S'S*.       SHS4 jjreg)Iz0Strategies for generating various forms of data.    )annotationsN)Mapping)datetime	timedeltatimezone)TYPE_CHECKINGAnyLiteral)ZoneInfo)InvalidArgument)EPOCHI8_MAXI8_MINI16_MAXI16_MINI32_MAXI32_MINI64_MAXI64_MINI128_MAXI128_MINU8_MAXU16_MAXU32_MAXU64_MAXU128_MAX)ArrayBinaryBooleanCategoricalDateDatetimeDecimalDurationEnumFieldFloat32Float64Int8Int16Int32Int64Int128ListNullObjectStringStructTimeUInt8UInt16UInt32UInt64UInt128)flexhash)_DEFAULT_ARRAY_WIDTH_LIMIT_DEFAULT_ENUM_CATEGORIES_LIMIT)Sequence)datetime)SearchStrategy)PolarsDataType
SchemaDictTimeUnit)DataTypeDataTypeClass   
   )          @      )TFz*dict[bool, dict[int, SearchStrategy[int]]]_INTEGER_STRATEGIESrJ   T)signedc                   [         U   U    $ )*Create a strategy for generating integers.)rL   )	bit_widthrM   s     c/home/james-whalen/.local/lib/python3.13/site-packages/polars/testing/parametric/strategies/data.pyintegersrR   b   s     v&y11    	allow_nanallow_infinityc               ,    [         R                  " XUS9$ )rO   )widthrU   rV   )stfloats)rP   rU   rV   s      rQ   rZ   rZ   i   s     99^ rS   c                 ,    [         R                  " 5       $ )z*Create a strategy for generating booleans.)rY   booleans rS   rQ   r\   r\   u   s    ;;=rS   c                 Z    [         R                  " SSS/S9n [         R                  " U SS9$ )z/Create a strategy for generating string values.  CsCc)max_codepointexclude_categoriesrG   )alphabetmax_size)rY   
characterstext)rd   s    rQ   stringsrh   z   s'    }}4T4LQH77Hq11rS   c                 ,    [         R                  " 5       $ )z'Create a strategy for generating bytes.)rY   binaryr]   rS   rQ   rj   rj      s    99;rS   c                t    [        U 5       Vs/ s H  nSU 3PM
     nn[        R                  " U5      $ s  snf )zv
Create a strategy for generating category strings.

Parameters
----------
n_categories
    The number of categories.
c)rangerY   sampled_from)n_categoriesi
categoriess      rQ   rq   rq      s9     $)#67#6aAaS'#6J7??:&& 8s   5c                 ,    [         R                  " 5       $ )z0Create a strategy for generating `time` objects.)rY   timesr]   rS   rQ   rs   rs          88:rS   c                 ,    [         R                  " 5       $ )z0Create a strategy for generating `date` objects.)rY   datesr]   rS   rQ   rv   rv      rt   rS   c                   U S;   a!  [         R                  n[         R                  nOIU S:X  a2  [        [	        [
        S-  S-   S9-   n[        [	        [        S-  S9-   nOSU < 3n[        U5      eUc  [        R                  " X#5      $ [        U5      nU S:X  a  U[	        SS9-  nU[	        SS9-  n[        R                  " UU[        R                  " U5      SS	9R                  S
 5      $ )z
Create a strategy for generating `datetime` objects in the time unit's range.

Parameters
----------
time_unit
    Time unit for which the datetime objects are valid.
time_zone
    Time zone for which the datetime objects are valid.
)usmsnsr_      microsecondsinvalid time unit: )daysF)	min_value	max_value	timezonesallow_imaginaryc                Z    U R                  [        R                  5      R                  S S9$ )N)tzinfo)
astimezoner   utcreplace)dts    rQ   <lambda>datetimes.<locals>.<lambda>   s    R]]8<<0888ErS   )r   minmaxr   r   r   r   r   rY   	datetimesr   justmap)	time_unit	time_zoner   r   msgtime_zone_infos         rQ   r   r      s     L LL	LL		d	I7d?Q3FGG	I7d?CC	#I=1c""||I11i(N DYA&&	YA&&	 <<''.)	
 
c
EFGrS   c                V   U S:X  a+  [         R                  " [        [        S9[        [        S9S9$ U S:X  a1  [         R                  " [        [        S-  S9[        [        S-  S9S9$ U S:X  a+  [         R                  " [        [        S9[        [        S9S9$ SU < 3n[        U5      e)z
Create a strategy for generating `timedelta` objects in the time unit's range.

Parameters
----------
time_unit
    Time unit for which the timedelta objects are valid.
rx   r|   )r   r   rz   r_   ry   r~   )rY   
timedeltasr   r   r   r   )r   r   s     rQ   	durationsr      s     D}}W5W5
 	
 
d	}}W_=W_=
 	
 
d	 }}W5W5
 	

 $I=1c""rS   c                    U c  Sn [         R                  " U S9nUR                  SX-
   35      nUR                  U5      nUR	                  U5      n[
        R                  " UUSSUS9$ )a$  
Create a strategy for generating `Decimal` objects.

Parameters
----------
precision
    Maximum number of digits in each number.
    If set to `None`, the precision is set to 38 (the maximum supported by Polars).
scale
    Number of digits to the right of the decimal point in each number.
&   )precz1E+F)r   r   rU   rV   places)decimalContextcreate_decimal
next_minuscopy_negaterY   decimals)	precisionscalerl   exclusive_limitr   r   s         rQ   r   r      st     	Y'A&&Y->,?'@AO_-Ii(I;; rS   Fselect_frommin_sizere   uniquec                   Uc  US:X  a  [         OUS-  nUb,  U R                  5       (       d  [        R                  " U5      nO[	        U 4UUUUS.UD6n[        R
                  " UUUU(       a  [        S9$ SS9$ )a  
Create a strategy for generating lists of the given data type.

.. warning::
    This functionality is currently considered **unstable**. It may be
    changed at any point without it being considered a breaking change.

Parameters
----------
inner_dtype
    Data type of the list elements. If the data type is not fully instantiated,
    defaults will be used, e.g. `Datetime` will become `Datetime('us')`.
select_from
    The values to use for the innermost lists. If set to `None` (default),
    the default strategy associated with the innermost data type is used.
min_size
    The minimum length of the generated lists.
max_size
    The maximum length of the generated lists. If set to `None` (default), the
    maximum is set based on `min_size`: `3` if `min_size` is zero,
    otherwise `2 * min_size`.
unique
    Ensure that the generated lists contain unique values.
**kwargs
    Additional arguments that are passed to nested data generation strategies.

Examples
--------
...
Nr      r   )elementsr   re   	unique_by)_DEFAULT_LIST_LEN_LIMIT	is_nestedrY   rn   datalistsr9   )inner_dtyper   r   re   r   kwargsinner_strategys          rQ   r   r     s    N .6!m*A{'<'<'>'>5
#
 
 88%8	  ,0	 rS   )
allow_nullc          	     d   [        U [        5      (       a-  U R                  5        VVs/ s H  u  p4[        X45      PM     n nnU  Vs0 s H%  oUR                  [        UR                  4SU0UD6_M'     nnU(       a  [        R                  " 0 US9$ [        R                  " U5      $ s  snnf s  snf )a  
Create a strategy for generating structs with the given fields.

Parameters
----------
fields
    The fields that make up the struct. Can be either a sequence of Field
    objects or a mapping of column names to data types.
allow_null
    Allow nulls as possible values. If set to True, the returned dictionaries
    may miss certain fields and are in random order.
**kwargs
    Additional arguments that are passed to nested data generation strategies.
r   )optional)	
isinstancer   itemsr&   namer   dtyperY   fixed_dictionaries)fieldsr   r   r   r   fstratss          rQ   structsr   C  s    ( &'""8>G%$GNTUfffd177DzDVDDfFU$$R&99$$V,, HUs   B',B-c                 ,    [         R                  " 5       $ )z-Create a strategy for generating null values.)rY   noner]   rS   rQ   nullsr   b  s    779rS   c                 6    [         R                  " [        5      $ )z3Create a strategy for generating arbitrary objects.)rY   buildsobjectr]   rS   rQ   objectsr   g  s    99VrS   rG   rH   rI   rK   z(dict[DataTypeClass, SearchStrategy[Any]]_STATIC_STRATEGIESc                  [         R                  U R                  5       5      =nb  UnGOU [        :X  a-  [	        SUR                  SS5      UR                  SS5      S9nGO{U [        :X  a-  [	        SUR                  SS5      UR                  SS5      S9nGODU [        :X  a+  [        [        U SS5      =(       d    S	[        U S
S5      S9nGOU [        :X  a  [        [        U SS5      =(       d    S	S9nGOU [        :X  a  [        UR                  S[        5      S9nGOU [        :X  a  [!        U [        5      (       aS  U R                  =nR#                  5       (       a  [%        5       nGOq[&        R(                  " UR+                  5       5      nGOK[        UR                  S[,        5      S9nGO,U [.        :X  a#  [1        [        U SS5      [        U SS5      5      nOU [2        :X  a-  [        U SS5      =(       d
    [5        5       n[7        U4SU0UD6nOU [8        :X  al  [        U SS5      =(       d
    [5        5       n[        U S[:        5      nUR=                  5        VVs0 s H  u  pxUS;  d  M  Xx_M     nnn[7        U4UUUS.UD6nORU [>        :X  a8  [        U SS5      =(       d    [A        S[5        5       5      /n	[C        U	4SU0UD6nOSU  3n
[E        U
5      eU(       a  [%        5       U-  nU$ s  snnf )ap  
Create a strategy for generating data for the given data type.

Parameters
----------
dtype
    A Polars data type. If the data type is not fully instantiated, defaults will
    be used, e.g. `Datetime` will become `Datetime('us')`.
allow_null
    Allow nulls as possible values.
**kwargs
    Additional parameters for the strategy associated with the given `dtype`.
NrI   rU   TrV   rT   rJ   r   rx   r   )r   r   )r   ro   )ro   r   r   r   innerr   size)r   re   )r   re   r   r   f0zunsupported data type: )#r   get	base_typer'   rZ   popr(   r"   r   getattrr$   r   r    rq   _DEFAULT_N_CATEGORIESr%   r   is_emptyr   rY   rn   to_listr;   r#   r   r.   r/   r   r   r:   r   r2   r&   r   r   )r   r   r   strategycatsr   r   kvr   r   s              rQ   r   r     s     '**5??+<==J	'	jjd3!::&6=

 
'	jjd3!::&6=

 
(	e[$7?4e[$7
 
(	wuk4'H'PDQ	+	N4IJ
 
$eT""(((2244 7??4<<>:!#ZZ8VWH 
'	E;-wugq/I
 
$w-7@:@@	%w-7uf&@A#)<<>W>41Q>V5V$!$>W
!	

 
 
&$/HE$4G3H6CjCFC'w/c""7X%O% Xs   !K31K3)rJ   )rP   zLiteral[8, 16, 32, 64, 128]rM   boolreturnzSearchStrategy[int])rP   zLiteral[32, 64]rU   r   rV   r   r   zSearchStrategy[float])r   zSearchStrategy[bool])r   SearchStrategy[str])r   zSearchStrategy[bytes])ro   intr   r   )r   zSearchStrategy[time])r   zSearchStrategy[date])rx   N)r   rB   r   z
str | Noner   zSearchStrategy[datetime])rx   )r   rB   r   zSearchStrategy[timedelta])r   r   )r   
int | Noner   r   r   zSearchStrategy[decimal.Decimal])r   rC   r   zSequence[Any] | Noner   r   re   r   r   r   r   r	   r   zSearchStrategy[list[Any]])r   zSequence[Field] | SchemaDictr   r   r   r	   r   zSearchStrategy[dict[str, Any]])r   zSearchStrategy[None])r   zSearchStrategy[object])r   r@   r   r   r   r	   r   zSearchStrategy[Any])f__doc__
__future__r   r   collections.abcr   r   r   r   typingr   r	   r
   zoneinfor   hypothesis.strategies
strategiesrY   hypothesis.errorsr   polars._utils.constantsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   polars.datatypesr   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   +polars.testing.parametric.strategies._utilsr9   *polars.testing.parametric.strategies.dtyper:   r;   r<   r=   r>   r?   polars._typingr@   rA   rB   rC   rD   r   r   rR   rL   __annotations__rZ   r\   rh   rj   rq   rs   rv   r   r   r   r   r   r   r   r   r   r]   rS   rQ   <module>r      s   6 "  # 2 2 . .  " -    $       < A
 (#4CC8   ;;vv&KK)KK)KK)[[8, ;;q&!KK7#KK7#KK7#[[H%C ? & .02CG2*2<@22 "$	 			 	 		
 	
2
 $9 
'
 9='G'G+5'G'GT#B ./'*$D )-;; &; 	;
 ; ; ; ;B -(- - 	-
 $->
@XZ@(1T
"@ 
8Bt$@ 
8Bt$	@
 
8Bt$@ HS&@ 
8Ae$@ HR&@ HR&@ HR&@ Xc%(@ 	%'@ 	%'@ GI@ FH@  	%'!@" GI#@ < , 27OO*.OBEOOrS   