
    q-Ph                    X   d dl mZ d dlmZ d dlmZmZ d dlmZ	 d dl
mZ d dlmZ d dlmZ d dlmZmZ d d	lmZ d d
lmZmZ er*d dlZd dlmZ d dlmZmZ ej        dk    rd dlmZ nd dlmZ  ed          	 d)dd eddd*d            Z  ed          	 d)ddd dddd+d(            Z!dS ),    )annotations)Sequence)TYPE_CHECKINGAnyN)InvalidArgument)
deprecated)is_polars_dtype)
_COL_LIMITcolumn)lists)_instantiate_dtypedtypes)SearchStrategy)OneOrMoreDataTypesPolarsDataType)      zX`columns` is deprecated; use `column` instead, in conjunction with a list comprehension.F)dtypemin_colsmax_colsuniquecolsint | Sequence[str] | Noner   OneOrMoreDataTypes | Noner   intr   r   boolreturnlist[column]c                   | (t          j        ||                                          } t          | t                    rd t          |           D             }n| }t          |          }|dg|z  }not          |          r|g|z  }nYt          |t                    r0t          |          x}|k    rd| d| d}	t          |	          |}n|d}	t          |	          fdt          ||          D             S )	aG  
    Define multiple columns for use with the @dataframes strategy.

    .. deprecated:: 0.20.26
        Use :class:`column` instead, in conjunction with a list comprehension.

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

    Generate a fixed sequence of `column` objects suitable for passing to the
    @dataframes strategy, or using standalone (note that this function is not itself
    a strategy).

    Notes
    -----
    Additional control is available by creating a sequence of columns explicitly,
    using the `column` class (an especially useful option is to override the default
    data-generating strategy for a given col/dtype).

    Parameters
    ----------
    cols : {int, [str]}, optional
        integer number of cols to create, or explicit list of column names. if
        omitted a random number of columns (between mincol and max_cols) are
        created.
    dtype : PolarsDataType, optional
        a single dtype for all cols, or list of dtypes (the same length as `cols`).
        if omitted, each generated column is assigned a random dtype.
    min_cols : int, optional
        if not passing an exact size, can set a minimum here (defaults to 0).
    max_cols : int, optional
        if not passing an exact size, can set a maximum value here (defaults to
        MAX_COLS).
    unique : bool, optional
        indicate if the values generated for these columns should be unique
        (per-column).

    Examples
    --------
    >>> from polars.testing.parametric import columns, dataframes
    >>> from hypothesis import given
    >>> @given(dataframes(columns(["x", "y", "z"], unique=True)))  # doctest: +SKIP
    ... def test_unique_xyz(df: pl.DataFrame) -> None:
    ...     assert_something(df)
    N)	min_value	max_valuec                    g | ]}d | S )col ).0ns     k/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/polars/testing/parametric/strategies/legacy.py
<listcomp>zcolumns.<locals>.<listcomp>Z   s    ???a	a		???    zgiven z dtypes for z namesz is not a valid polars datatypec                :    g | ]\  }}t          ||           S ))namer   r   )r   )r%   nmtpr   s      r'   r(   zcolumns.<locals>.<listcomp>m   s,    VVVRF"V444VVVr)   )stintegersexample
isinstancer   rangelenr	   r   r   zip)
r   r   r   r   r   namesn_colsr   n_dtypesmsgs
       `     r'   columnsr9      s0   v |{XBBBJJLL$ ??5;;???ZZF}37&6/			 	#6!	E8	$	$ #E

"Hv--?8?????C!#&&&999c""" WVVV3ufCUCUVVVVr)   z:`create_list_strategy` is deprecated; use `lists` instead.)select_fromsizemin_sizemax_sizer   inner_dtypePolarsDataType | Noner:   Sequence[Any] | Noner;   
int | Noner<   r=   SearchStrategy[list[Any]]c                   ||x}}| !t                                                      } n!t          |                                           } t          | ||||          S )a  
    Create a strategy for generating Polars :class:`List` data.

    .. deprecated:: 0.20.26
        Use :func:`lists` instead.

    Parameters
    ----------
    inner_dtype : PolarsDataType
        type of the inner list elements (can also be another List).
    select_from : list, optional
        randomly select the innermost values from this list (otherwise
        the default strategy associated with the innermost dtype is used).
    size : int, optional
        if set, generated lists will be of exactly this size (and
        ignore the min_size/max_size params).
    min_size : int, optional
        set the minimum size of the generated lists (default: 0 if unset).
    max_size : int, optional
        set the maximum size of the generated lists (default: 3 if
        min_size is unset or zero, otherwise 2x min_size).
    unique : bool, optional
        ensure that the generated lists contain unique values.

    Examples
    --------
    Create a strategy that generates a list of i32 values:

    >>> from polars.testing.parametric import create_list_strategy
    >>> lst = create_list_strategy(inner_dtype=pl.Int32)  # doctest: +SKIP
    >>> lst.example()  # doctest: +SKIP
    [-11330, 24030, 116]
    N)r:   r<   r=   r   )r   r0   r   r   )r>   r:   r;   r<   r=   r   s         r'   create_list_strategyrD   p   sq    V ""8hh&&(((55==??   r)   )N)r   r   r   r   r   r   r   r   r   r   r   r   )r>   r?   r:   r@   r;   rA   r<   r   r=   rA   r   r   r   rB   )"
__future__r   collections.abcr   typingr   r   hypothesis.strategies
strategiesr.   hypothesis.errorsr   polars._utils.deprecationr   polars.datatypesr	   )polars.testing.parametric.strategies.corer
   r   )polars.testing.parametric.strategies.datar   *polars.testing.parametric.strategies.dtyper   r   sysr   polars._typingr   r   version_infowarningstyping_extensionsr9   rD   r$   r)   r'   <module>rU      s   " " " " " " $ $ $ $ $ $ % % % % % % % % " " " " " " - - - - - - 0 0 0 0 0 0 , , , , , , H H H H H H H H ; ; ; ; ; ; Q Q Q Q Q Q Q Q 
1JJJ444444AAAAAAAA
7""'''''''000000 0 
 (,MW (,MW MW MW MW MW	 MW` HII)-8 )-8 8 8 8 8 JI8 8 8r)   