
    q-PhM                       U d dl mZ d dlZd dlZd dlmZ d dlmZmZm	Z	m
Z
 d dlmZ d dlmZ d dlmZ d dlmZ erDd dlZd d	lmZ d d
lmZ ej        dk    rd dlmZ nd dlmZ ej        dk    r	d dlmZmZ nd dlmZmZ dgZed         Zded<   h dZ ej         e!e"          5  d dl#m$Z% e%j&        e%j'        e%j(        e%j)        e%j*        dZ+ddd           n# 1 swxY w Y    G d de	d          Z, G d dej-                  Z.dS )    )annotationsN)Path)TYPE_CHECKINGLiteral	TypedDictget_args)
EngineType)normalize_filepath)json)	GPUEngine)TracebackType)FloatFmt)   
   )	TypeAlias)r      )SelfUnpackConfig)
ASCII_FULLASCII_FULL_CONDENSEDASCII_NO_BORDERSASCII_BORDERS_ONLYASCII_BORDERS_ONLY_CONDENSEDASCII_HORIZONTAL_ONLYASCII_MARKDOWNMARKDOWN	UTF8_FULLUTF8_FULL_CONDENSEDUTF8_NO_BORDERSUTF8_BORDERS_ONLYUTF8_HORIZONTAL_ONLYNOTHINGr   TableFormatNames>   POLARS_VERBOSEPOLARS_FMT_NUM_LENPOLARS_FMT_STR_LENPOLARS_TABLE_WIDTHPOLARS_FMT_MAX_COLSPOLARS_FMT_MAX_ROWSPOLARS_WARN_UNSTABLEPOLARS_AUTO_STRUCTIFYPOLARS_MAX_EXPR_DEPTHPOLARS_ENGINE_AFFINITYPOLARS_FMT_NUM_DECIMALPOLARS_FMT_TABLE_FORMATTINGPOLARS_STREAMING_CHUNK_SIZEPOLARS_FMT_NUM_GROUP_SEPARATORPOLARS_FMT_TABLE_CELL_LIST_LENPOLARS_FMT_TABLE_CELL_ALIGNMENT POLARS_FMT_TABLE_ROUNDED_CORNERS"POLARS_FMT_TABLE_HIDE_COLUMN_NAMES&POLARS_FMT_TABLE_DATAFRAME_SHAPE_BELOW&POLARS_FMT_TABLE_HIDE_COLUMN_SEPARATOR'POLARS_FMT_TABLE_CELL_NUMERIC_ALIGNMENT'POLARS_FMT_TABLE_HIDE_COLUMN_DATA_TYPES(POLARS_FMT_TABLE_INLINE_COLUMN_DATA_TYPE1POLARS_FMT_TABLE_HIDE_DATAFRAME_SHAPE_INFORMATION)set_fmt_floatset_float_precisionset_thousands_separatorset_decimal_separatorset_trim_decimal_zerosc                     e Zd ZU dZded<   ded<   ded<   ded<   d	ed
<   ded<   d	ed<   d	ed<   d	ed<   ded<   ded<   d	ed<   ded<   ded<   ded<   ded<   ded<   ded<   ded<   d	ed<   d	ed<   ded<   ded<   d ed!<   ded"<   ded#<   ded$<   ded%<   d	ed&<   ded'<   d	ed(<   d	ed)<   d	ed*<   ded+<   ded,<   d	ed-<   ded.<   ded/<   ded0<   ded1<   ded2<   ded3<   ded4<   d	ed5<   d	ed6<   ded7<   ded8<   d ed9<   d:ed;<   d<S )=ConfigParametersz*Parameters supported by the polars Config.bool | Noneascii_tablesauto_structify
str | Nonedecimal_separatorstr | bool | Nonethousands_separator
int | Nonefloat_precisionFloatFmt | None	fmt_floatfmt_str_lengthsfmt_table_cell_list_lenstreaming_chunk_size)Literal['LEFT', 'CENTER', 'RIGHT'] | Nonetbl_cell_alignmenttbl_cell_numeric_alignmenttbl_colstbl_column_data_type_inlinetbl_dataframe_shape_belowTableFormatNames | Nonetbl_formattingtbl_hide_column_data_typestbl_hide_column_namestbl_hide_dtype_separatortbl_hide_dataframe_shapetbl_rowstbl_width_charstrim_decimal_zerosverboseintexpr_depth_warningset_ascii_tablesset_auto_structifyr@   r?   r>   r=   set_fmt_str_lengthsset_fmt_table_cell_list_lenset_streaming_chunk_sizeset_tbl_cell_alignmentset_tbl_cell_numeric_alignmentset_tbl_colsset_tbl_column_data_type_inlineset_tbl_dataframe_shape_belowset_tbl_formattingset_tbl_hide_column_data_typesset_tbl_hide_column_namesset_tbl_hide_dtype_separatorset_tbl_hide_dataframe_shapeset_tbl_rowsset_tbl_width_charsrA   set_verboseset_expr_depth_warningEngineType | Noneset_engine_affinityN)__name__
__module____qualname____doc____annotations__     M/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/polars/config.pyrC   rC   ]   sd        44!!!!****''''$$$$AAAAIIII,,,,****++++++++&&&&))))))))####!!!!####%%%%....####""""####++++((((EEEEMMMM0000....////////****--------####''''******r   rC   F)totalc                     e Zd ZU dZdZded<   dZded<   ddd	d_dZd`dZdadZ	dbdZ
dbdZdcdZeddd!            Zeded$            Zedfd&            Zedd'dgd)            Zedhd*            Zeddd+did.            Zedjdkd2            Zedldkd3            Zedmdnd6            Ze	 dmdod8            Zedmdpd;            Zedqdrd?            ZedsdA            ZedsdB            ZedtdD            ZedudG            ZedudH            ZedsdI            Ze	 djdkdJ            Z edjdkdK            Z!e	 	 dvdwdN            Z"edjdkdO            Z#edjdkdP            Z$edjdkdQ            Z%edjdkdR            Z&edsdS            Z'edxdU            Z(edjdkdV            Z)edjdkdW            Z*edjdkdX            Z+edyd[            Z,edmdzd^            Z-dS ){r   aQ  
    Configure polars; offers options for table formatting and more.

    Notes
    -----
    Can also be used as a context manager OR a function decorator in order to
    temporarily scope the lifetime of specific options. For example:

    >>> with pl.Config() as cfg:
    ...     # set verbose for more detailed output within the scope
    ...     cfg.set_verbose(True)  # doctest: +IGNORE_RESULT
    >>> # scope exit - no longer in verbose mode

    This can also be written more compactly as:

    >>> with pl.Config(verbose=True):
    ...     pass

    (The compact format is available for all `Config` methods that take a single value).

    Alternatively, you can use as a decorator in order to scope the duration of the
    selected options to a specific function:

    >>> @pl.Config(verbose=True)
    ... def test():
    ...     pass
    NzConfigParameters | None_context_options str_original_stateF)restore_defaultsapply_on_context_enterr   boolr   optionsUnpack[ConfigParameters]returnNonec                   |                                  | _        |r|                                  |r	|| _        dS  | j        di | d| _        dS )a	  
        Initialise a Config object instance for context manager usage.

        Any `options` kwargs should correspond to the available named "set_*"
        methods, but are allowed to omit the "set_" prefix for brevity.

        Parameters
        ----------
        restore_defaults
            set all options to their default values (this is applied before
            setting any other options).
        apply_on_context_enter
            defer applying the options until a context is entered. This allows you
            to create multiple `Config` instances with different options, and then
            reuse them independently as context managers or function decorators
            with specific bundles of parameters.
        **options
            keyword args that will set the option; equivalent to calling the
            named "set_<option>" method with the given value.

        Examples
        --------
        Customise Polars table formatting while in context scope:

        >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
        >>> with pl.Config(
        ...     # these options will be set for scope duration
        ...     tbl_formatting="MARKDOWN",
        ...     tbl_hide_dataframe_shape=True,
        ...     tbl_rows=10,
        ... ):
        ...     print(df)
        | abc | xyz   |
        | --- | ---   |
        | f64 | bool  |
        |-----|-------|
        | 1.0 | true  |
        | 2.5 | false |
        | 5.0 | true  |

        Establish several independent Config instances for use in different contexts;
        setting `apply_on_context_enter=True` defers setting the parameters until a
        context (or function, when used as a decorator) is actually entered:

        >>> cfg_polars_verbose = pl.Config(
        ...     verbose=True,
        ...     apply_on_context_enter=True,
        ... )
        >>> cfg_polars_detailed_tables = pl.Config(
        ...     tbl_rows=25,
        ...     tbl_cols=25,
        ...     tbl_width_chars=200,
        ...     apply_on_context_enter=True,
        ... )

        These Config instances can now be applied independently and re-used:

        >>> @cfg_polars_verbose
        ... def traced_function(df: pl.DataFrame) -> pl.DataFrame:
        ...     return polars_operations(df)

        >>> @cfg_polars_detailed_tables
        ... def print_detailed_frames(*frames: pl.DataFrame) -> None:
        ...     for df in frames:
        ...         print(df)
        Nr~   )saver   r   r   _set_config_params)selfr   r   r   s       r   __init__zConfig.__init__   sn    T  $yy{{ 	$!!###! 	)$+D!!! $D#..g...$(D!!!r   r   c                x    | j         p|                                 | _         | j        r | j        di | j         | S )z<Support setting Config options that are reset on scope exit.r~   )r   r   r   r   )r   s    r   	__enter__zConfig.__enter__
  sF    #3Btyy{{  	=#D#<<d&;<<<r   exc_typetype[BaseException] | Noneexc_valBaseException | Noneexc_tbTracebackType | Nonec                l    |                                                      | j                   d| _        dS )z8Reset any Config options that were set within the scope.r   N)r   loadr   )r   r   r   r   s       r   __exit__zConfig.__exit__  s5     	$$T%9:::!r   otherobjectc                p    t          |t                    sdS | j        |j        k    o| j        |j        k    S NF)
isinstancer   r   r   r   r   s     r   __eq__zConfig.__eq__  s?    %(( 	5$(== 
!U%;;	
r   c                .    |                      |           S N)r   r   s     r   __ne__zConfig.__ne__"  s    ;;u%%%%r   c                   |                                 D ]l\  }}t          | |          s|                    d          sd| }t          | |          sd|}t          |           t	          | |          |           md S )Nset_z`Config` has no option )itemshasattr
startswithAttributeErrorgetattr)r   r   optvaluemsgs        r   r   zConfig._set_config_params%  s    !--// 	& 	&JC4%% #cnnV.D.D #"Sll4%% *777$S)))GD#u%%%%	& 	&r   cfgc                   	 t          j        |          }n)# t           j        $ r}d}t          |          |d}~ww xY wt	                      }|                    di           }|                                D ]7\  }}|!t          j        	                    |d           (|t          j        |<   8|                    di                                           D ].\  }	}
t          ||	          r t          ||	          |
           /|S )a~  
        Load (and set) previously saved Config options from a JSON string.

        Parameters
        ----------
        cfg : str
            JSON string produced by `Config.save()`.

        See Also
        --------
        load_from_file : Load (and set) Config options from a JSON file.
        save : Save the current set of Config options as a JSON string or file.
        z=invalid Config string (did you mean to use `load_from_file`?)Nenvironmentdirect)r   loadsJSONDecodeError
ValueErrorr   getr   osenvironpopr   r   )clsr   r   errr   cfg_loadoptskeyr   cfg_methodnamer   s              r   r   zConfig.load.  s   	+jooGG# 	+ 	+ 	+QCS//s*	+ 88{{="--

 	& 	&HC{
sD))))"%
3%,[[2%>%>%D%D%F%F 	9 	9!NEx00 91.11%888s    =8=file
Path | strc                    	 t          t          |                                                    }n'# t          $ r}d| }t	          |          |d}~ww xY w|                     |          S )a  
        Load (and set) previously saved Config options from file.

        Parameters
        ----------
        file : Path | str
            File path to a JSON string produced by `Config.save()`.

        See Also
        --------
        load : Load (and set) Config options from a JSON string.
        save : Save the current set of Config options as a JSON string or file.
        z2invalid Config file (did you mean to use `load`?)
N)r   r
   	read_textOSErrorr   r   )r   r   r   r   r   s        r   load_from_filezConfig.load_from_fileP  sy    	+-d3344>>@@GG 	+ 	+ 	+MMMCS//s*	+ xx   s   .1 
AAAtype[Config]c                    t           D ]"}t          j                            |d           #t          D ]} t          | |          d           | S )ao  
        Reset all polars Config settings to their default state.

        Notes
        -----
        This method operates by removing all Config options from the environment,
        and then setting any local (non-env) options back to their default value.

        Examples
        --------
        >>> cfg = pl.Config.restore_defaults()  # doctest: +SKIP
        N)_POLARS_CFG_ENV_VARSr   r   r   _POLARS_CFG_DIRECT_VARSr   )r   varmethods      r   r   zConfig.restore_defaultsg  s_     ( 	& 	&CJNN3%%%% . 	' 	'F GC  &&&&
r   )if_setr   c                   fdt          t                    D             }d t                                          D             }t	          j        ||dd          }|S )a  
        Save the current set of Config options as a JSON string.

        Parameters
        ----------
        if_set
            By default this will save the state of all configuration options; set
            to `False` to save only those that have been set to a non-default value.

        See Also
        --------
        load : Load (and set) Config options from a JSON string.
        load_from_file : Load (and set) Config options from a JSON file.
        save_to_file : Save the current set of Config options as a JSON file.

        Examples
        --------
        >>> json_state = pl.Config.save()

        Returns
        -------
        str
            JSON string containing current Config options.
        c                    i | ]C}rt           j                            |          #|t           j                            |          DS r   r   r   r   ).0r   r   s     r   
<dictcomp>zConfig.save.<locals>.<dictcomp>  sQ     
 
 

 !jnnS11= $$===r   c                *    i | ]\  }}| |            S r~   r~   )r   r   	get_values      r   r   zConfig.save.<locals>.<dictcomp>  s4     
 
 
)	 IIKK
 
 
r   )r   r   ),:)
separators)sortedr   r   r   r   dumps)r   r   environment_varsdirect_varsr   s    `   r   r   zConfig.save  s    4
 
 
 
233
 
 


 
-D-J-J-L-L
 
 
 *,DD!
 
 
 r   c                    t          t          |                                                    }|                    |                                            dS )as  
        Save the current set of Config options as a JSON file.

        Parameters
        ----------
        file
            Optional path to a file into which the JSON string will be written.
            Leave as `None` to return the JSON string directly.

        See Also
        --------
        load : Load (and set) Config options from a JSON string.
        load_from_file : Load (and set) Config options from a JSON file.
        save : Save the current set of Config options as a JSON string.

        Examples
        --------
        >>> pl.Config().save_to_file("~/polars/config.json")  # doctest: +SKIP
        N)r   r
   resolve
write_textr   )r   r   s     r   save_to_filezConfig.save_to_file  sF    * &t,,--5577

#####r   )r   env_onlyr   dict[str, str | None]c                   fdt          t                    D             }|s,t                                          D ]\  }} |            ||<   |S )a  
        Show the current state of all Config variables in the environment as a dict.

        Parameters
        ----------
        if_set
            By default this will show the state of all `Config` environment variables.
            change this to `True` to restrict the returned dictionary to include only
            those that have been set to a specific value.
        env_only
            Include only Config environment variables in the output; some options (such
            as "set_fmt_float") are set directly, not via an environment variable.

        Examples
        --------
        >>> set_state = pl.Config.state(if_set=True)
        >>> all_state = pl.Config.state()
        c                    i | ]C}rt           j                            |          #|t           j                            |          DS r   r   )r   r   r   s     r   r   z Config.state.<locals>.<dictcomp>  sQ     
 
 

 !jnnS11= $$===r   )r   r   r   r   )r   r   r   config_stater   r   s    `    r   statezConfig.state  sw    ,
 
 
 
233
 
 

  	;-D-J-J-L-L ; ;)	/8y{{^,,r   TactiverD   c                v    |!t           j                            dd           n|rdnd}|t           j        d<   | S )u%  
        Use ASCII characters to display table outlines.

        Set False to revert to the standard UTF8_FULL_CONDENSED formatting style.

        See Also
        --------
        set_tbl_formatting : Set the table formatting style (includes Markdown option).

        Examples
        --------
        >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
        >>> pl.Config.set_ascii_tables(True)  # doctest: +SKIP
        # ...
        # shape: (3, 2)        shape: (3, 2)
        # ┌─────┬───────┐      +-----+-------+
        # │ abc ┆ xyz   │      | abc | xyz   |
        # │ --- ┆ ---   │      | --- | ---   |
        # │ f64 ┆ bool  │      | f64 | bool  |
        # ╞═════╪═══════╡      +=============+
        # │ 1.0 ┆ true  │  >>  | 1.0 | true  |
        # │ 2.5 ┆ false │      | 2.5 | false |
        # │ 5.0 ┆ true  │      | 5.0 | true  |
        # └─────┴───────┘      +-----+-------+
        Nr0   r   r   )r   r   r   )r   r   fmts      r   rd   zConfig.set_ascii_tables  sF    6 >JNN8$????,2M((8MC8;BJ45
r   c                    |!t           j                            dd           n)t          t	          |                    t           j        d<   | S )un  
        Allow multi-output expressions to be automatically turned into Structs.

        Examples
        --------
        >>> df = pl.DataFrame({"v": [1, 2, 3], "v2": [4, 5, 6]})
        >>> with pl.Config(set_auto_structify=True):
        ...     out = df.select(pl.all())
        >>> out
        shape: (3, 1)
        ┌───────────┐
        │ v         │
        │ ---       │
        │ struct[2] │
        ╞═══════════╡
        │ {1,4}     │
        │ {2,5}     │
        │ {3,6}     │
        └───────────┘
        Nr,   r   r   r   r   rb   r   r   s     r   re   zConfig.set_auto_structify  sC    , >JNN2D999925c&kk2B2BBJ./
r   	separatorrG   c                    t          |t                    r't          |          dk    rd|}t          |          t	          j        |           | S )u:  
        Set the decimal separator character.

        Parameters
        ----------
        separator : str, bool
            Character to use as the decimal separator.
            Set to ``None`` to revert to the default (".").

        See Also
        --------
        set_thousands_separator : Set the thousands grouping separator character.

        Examples
        --------
        >>> df = pl.DataFrame({"v": [9876.54321, 1010101.0, -123456.78]})
        >>> with pl.Config(
        ...     tbl_cell_numeric_alignment="RIGHT",
        ...     thousands_separator=".",
        ...     decimal_separator=",",
        ...     float_precision=3,
        ... ):
        ...     print(df)
        shape: (3, 1)
        ┌───────────────┐
        │             v │
        │           --- │
        │           f64 │
        ╞═══════════════╡
        │     9.876,543 │
        │ 1.010.101,000 │
        │  -123.456,780 │
        └───────────────┘
           .`separator` must be a single character; found sep)r   r   lenr   plrr@   r   r   r   s      r   r@   zConfig.set_decimal_separator  sY    H i%% 	"#i..A*=*=P9PPCS//!!i0000
r   rI   c                
   |du r+t          j        d           t          j        d           nSt          |t                    r't          |          dk    rd|}t          |          t          j        |pd           | S )u  
        Set the thousands grouping separator character.

        Parameters
        ----------
        separator : str, bool
            Set True to use the default "," (thousands) and "." (decimal) separators.
            Can also set a custom char, or set ``None`` to omit the separator.

        See Also
        --------
        set_decimal_separator : Set the decimal separator character.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "x": [1234567, -987654, 10101],
        ...         "y": [1234.5, 100000.0, -7654321.25],
        ...     }
        ... )
        >>> with pl.Config(
        ...     tbl_cell_numeric_alignment="RIGHT",
        ...     thousands_separator=True,
        ...     float_precision=2,
        ... ):
        ...     print(df)
        shape: (3, 2)
        ┌───────────┬───────────────┐
        │         x ┆             y │
        │       --- ┆           --- │
        │       i64 ┆           f64 │
        ╞═══════════╪═══════════════╡
        │ 1,234,567 ┆      1,234.50 │
        │  -987,654 ┆    100,000.00 │
        │    10,101 ┆ -7,654,321.25 │
        └───────────┴───────────────┘
        >>> with pl.Config(
        ...     tbl_cell_numeric_alignment="RIGHT",
        ...     thousands_separator=".",
        ...     decimal_separator=",",
        ...     float_precision=2,
        ... ):
        ...     print(df)
        shape: (3, 2)
        ┌───────────┬───────────────┐
        │         x ┆             y │
        │       --- ┆           --- │
        │       i64 ┆           f64 │
        ╞═══════════╪═══════════════╡
        │ 1.234.567 ┆      1.234,50 │
        │  -987.654 ┆    100.000,00 │
        │    10.101 ┆ -7.654.321,25 │
        └───────────┴───────────────┘
        T.r   r   r   r   N)r   r@   r?   r   r   r   r   r   s      r   r?   zConfig.set_thousands_separatorI  s    v %#....'C00000)S)) &c)nnq.@.@TyTT oo%'I,=>>>>
r   	precisionrK   c                .    t          j        |           | S )u
  
        Control the number of decimal places displayed for floating point values.

        Parameters
        ----------
        precision : int
            Number of decimal places to display; set to `None` to revert to the
            default/standard behaviour.

        Notes
        -----
        When setting this to a larger value you should ensure that you are aware of both
        the limitations of floating point representations, and of the precision of the
        data that you are looking at.

        This setting only applies to Float32 and Float64 dtypes; it does not cover
        Decimal dtype values (which are displayed at their native level of precision).

        Examples
        --------
        Set a large maximum float precision:

        >>> from math import pi, e
        >>> df = pl.DataFrame({"const": ["pi", "e"], "value": [pi, e]})
        >>> with pl.Config(float_precision=15):
        ...     print(df)
        shape: (2, 2)
        ┌───────┬───────────────────┐
        │ const ┆ value             │
        │ ---   ┆ ---               │
        │ str   ┆ f64               │
        ╞═══════╪═══════════════════╡
        │ pi    ┆ 3.141592653589793 │
        │ e     ┆ 2.718281828459045 │
        └───────┴───────────────────┘

        Set a fixed float precision and align numeric columns to the
        right in order to cleanly line-up the decimal separator:

        >>> df = pl.DataFrame(
        ...     {
        ...         "a": ["xx", "yy"],
        ...         "b": [-11111111, 44444444444],
        ...         "c": [100000.987654321, -23456789],
        ...     }
        ... )
        >>> with pl.Config(
        ...     tbl_cell_numeric_alignment="RIGHT",
        ...     thousands_separator=",",
        ...     float_precision=3,
        ... ):
        ...     print(df)
        shape: (2, 3)
        ┌─────┬────────────────┬─────────────────┐
        │ a   ┆              b ┆               c │
        │ --- ┆            --- ┆             --- │
        │ str ┆            i64 ┆             f64 │
        ╞═════╪════════════════╪═════════════════╡
        │ xx  ┆    -11,111,111 ┆     100,000.988 │
        │ yy  ┆ 44,444,444,444 ┆ -23,456,789.000 │
        └─────┴────────────────┴─────────────────┘
        )r   r>   )r   r   s     r   r>   zConfig.set_float_precision  s    @ 		***
r   mixedr   rM   c                8    t          j        |dn|           | S )a  
        Control how floating point values are displayed.

        Parameters
        ----------
        fmt : {"mixed", "full"}
            How to format floating point numbers:

            - "mixed": Limit the number of decimal places and use scientific
              notation for large/small values.
            - "full": Print the full precision of the floating point number.

        Examples
        --------
        "mixed" float formatting:

        >>> s = pl.Series([1.2304980958725870923, 1e6, 1e-8])
        >>> with pl.Config(set_fmt_float="mixed"):
        ...     print(s)
        shape: (3,)
        Series: '' [f64]
        [
            1.230498
            1e6
            1.0000e-8
        ]

        "full" float formatting:

        >>> with pl.Config(set_fmt_float="full"):
        ...     print(s)
        shape: (3,)
        Series: '' [f64]
        [
            1.230498095872587
            1000000
            0.00000001
        ]
        Nr   )r   )r   set_float_fmt)r   r   s     r   r=   zConfig.set_fmt_float  s&    R 	gg#>>>>
r   nc                    |!t           j                            dd           n3|dk    rd}t          |          t	          |          t           j        d<   | S )u  
        Set the number of characters used to display string values.

        Parameters
        ----------
        n : int
            Number of characters to display.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "txt": [
        ...             "Play it, Sam. Play 'As Time Goes By'.",
        ...             "This is the beginning of a beautiful friendship.",
        ...         ]
        ...     }
        ... )
        >>> df.with_columns(pl.col("txt").str.len_bytes().alias("len"))
        shape: (2, 2)
        ┌─────────────────────────────────┬─────┐
        │ txt                             ┆ len │
        │ ---                             ┆ --- │
        │ str                             ┆ u32 │
        ╞═════════════════════════════════╪═════╡
        │ Play it, Sam. Play 'As Time Go… ┆ 37  │
        │ This is the beginning of a bea… ┆ 48  │
        └─────────────────────────────────┴─────┘
        >>> with pl.Config(fmt_str_lengths=50):
        ...     print(df)
        shape: (2, 1)
        ┌──────────────────────────────────────────────────┐
        │ txt                                              │
        │ ---                                              │
        │ str                                              │
        ╞══════════════════════════════════════════════════╡
        │ Play it, Sam. Play 'As Time Goes By'.            │
        │ This is the beginning of a beautiful friendship. │
        └──────────────────────────────────────────────────┘
        Nr'   r   z number of characters must be > 0r   r   r   r   r   )r   r   r   s      r   rf   zConfig.set_fmt_str_lengths  sV    T 9JNN/6666Avv8 oo%/21vvBJ+,
r   c                    |!t           j                            dd           nt          |          t           j        d<   | S )us  
        Set the number of elements to display for List values.

        Empty lists will always print "[]". Negative values will result in all values
        being printed. A value of 0 will always "[…]" for lists with contents. A value
        of 1 will print only the final item in the list.

        Parameters
        ----------
        n : int
            Number of values to display.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "nums": [
        ...             [1, 2, 3, 4, 5, 6],
        ...         ]
        ...     }
        ... )
        >>> df
        shape: (1, 1)
        ┌─────────────┐
        │ nums        │
        │ ---         │
        │ list[i64]   │
        ╞═════════════╡
        │ [1, 2, … 6] │
        └─────────────┘
        >>> with pl.Config(fmt_table_cell_list_len=10):
        ...     print(df)
        shape: (1, 1)
        ┌────────────────────┐
        │ nums               │
        │ ---                │
        │ list[i64]          │
        ╞════════════════════╡
        │ [1, 2, 3, 4, 5, 6] │
        └────────────────────┘
        Nr3   r   r   r   r   r   r   s     r   rg   z"Config.set_fmt_table_cell_list_len1  s<    V 9JNN;TBBBB;>q66BJ78
r   sizec                    |!t           j                            dd           n3|dk     rd}t          |          t	          |          t           j        d<   | S )a  
        Overwrite chunk size used in `streaming` engine.

        By default, the chunk size is determined by the schema
        and size of the thread pool. For some datasets (esp.
        when you have large string elements) this can be too
        optimistic and lead to Out of Memory errors.

        Parameters
        ----------
        size
            Number of rows per chunk. Every thread will process chunks
            of this size.
        Nr1   r   z%number of rows per chunk must be >= 1r   )r   r  r   s      r   rh   zConfig.set_streaming_chunk_sizeb  sU      <JNN8$????axx= oo%8;D		BJ45
r   formatrR   c                    |!t           j                            dd           n'|dvrd|}t          |          |t           j        d<   | S )uW  
        Set table cell alignment.

        Parameters
        ----------
        format : str
            * "LEFT": left aligned
            * "CENTER": center aligned
            * "RIGHT": right aligned

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {"column_abc": [1.0, 2.5, 5.0], "column_xyz": [True, False, True]}
        ... )
        >>> pl.Config.set_tbl_cell_alignment("RIGHT")  # doctest: +IGNORE_RESULT
        >>> print(df)
        shape: (3, 2)
        ┌────────────┬────────────┐
        │ column_abc ┆ column_xyz │
        │        --- ┆        --- │
        │        f64 ┆       bool │
        ╞════════════╪════════════╡
        │        1.0 ┆       true │
        │        2.5 ┆      false │
        │        5.0 ┆       true │
        └────────────┴────────────┘

        Raises
        ------
        ValueError: if alignment string not recognised.
        Nr4   >   LEFTRIGHTCENTERinvalid alignment: r   r   r   r   r   r  r   s      r   ri   zConfig.set_tbl_cell_alignment|  s[    H >JNN<dCCCC666222CS//!<BBJ89
r   c                    |!t           j                            dd           n'|dvrd|}t          |          |t           j        d<   | S )u%  
        Set table cell alignment for numeric columns.

        Parameters
        ----------
        format : str
            * "LEFT": left aligned
            * "CENTER": center aligned
            * "RIGHT": right aligned

        Examples
        --------
        >>> from datetime import date
        >>> df = pl.DataFrame(
        ...     {
        ...         "abc": [11, 2, 333],
        ...         "mno": [date(2023, 10, 29), None, date(2001, 7, 5)],
        ...         "xyz": [True, False, None],
        ...     }
        ... )
        >>> pl.Config.set_tbl_cell_numeric_alignment("RIGHT")  # doctest: +IGNORE_RESULT
        >>> print(df)
        shape: (3, 3)
        ┌─────┬────────────┬───────┐
        │ abc ┆ mno        ┆ xyz   │
        │ --- ┆ ---        ┆ ---   │
        │ i64 ┆ date       ┆ bool  │
        ╞═════╪════════════╪═══════╡
        │  11 ┆ 2023-10-29 ┆ true  │
        │   2 ┆ null       ┆ false │
        │ 333 ┆ 2001-07-05 ┆ null  │
        └─────┴────────────┴───────┘

        Raises
        ------
        KeyError: if alignment string not recognised.
        Nr9   >   r  r	  r
  r  r  r  s      r   rj   z%Config.set_tbl_cell_numeric_alignment  s[    R >JNNDdKKKK666222CS//!DJBJ@A
r   c                    |!t           j                            dd           nt          |          t           j        d<   | S )u  
        Set the number of columns that are visible when displaying tables.

        Parameters
        ----------
        n : int
            Number of columns to display; if `n < 0` (eg: -1), display all columns.

        Examples
        --------
        Set number of displayed columns to a low value:

        >>> with pl.Config() as cfg:
        ...     cfg.set_tbl_cols(5)
        ...     df = pl.DataFrame({str(i): [i] for i in range(100)})
        ...     print(df)
        <class 'polars.config.Config'>
        shape: (1, 100)
        ┌─────┬─────┬─────┬───┬─────┬─────┐
        │ 0   ┆ 1   ┆ 2   ┆ … ┆ 98  ┆ 99  │
        │ --- ┆ --- ┆ --- ┆   ┆ --- ┆ --- │
        │ i64 ┆ i64 ┆ i64 ┆   ┆ i64 ┆ i64 │
        ╞═════╪═════╪═════╪═══╪═════╪═════╡
        │ 0   ┆ 1   ┆ 2   ┆ … ┆ 98  ┆ 99  │
        └─────┴─────┴─────┴───┴─────┴─────┘

        >>> with pl.Config(tbl_cols=10):
        ...     print(df)
        shape: (1, 100)
        ┌─────┬─────┬─────┬─────┬─────┬───┬─────┬─────┬─────┬─────┬─────┐
        │ 0   ┆ 1   ┆ 2   ┆ 3   ┆ 4   ┆ … ┆ 95  ┆ 96  ┆ 97  ┆ 98  ┆ 99  │
        │ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆   ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
        │ i64 ┆ i64 ┆ i64 ┆ i64 ┆ i64 ┆   ┆ i64 ┆ i64 ┆ i64 ┆ i64 ┆ i64 │
        ╞═════╪═════╪═════╪═════╪═════╪═══╪═════╪═════╪═════╪═════╪═════╡
        │ 0   ┆ 1   ┆ 2   ┆ 3   ┆ 4   ┆ … ┆ 95  ┆ 96  ┆ 97  ┆ 98  ┆ 99  │
        └─────┴─────┴─────┴─────┴─────┴───┴─────┴─────┴─────┴─────┴─────┘
        Nr)   r  r  s     r   rk   zConfig.set_tbl_cols  s<    N 9JNN0$777703ABJ,-
r   c                    |!t           j                            dd           n)t          t	          |                    t           j        d<   | S )u[  
        Display the data type next to the column name (to the right, in parentheses).

        Examples
        --------
        >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
        >>> pl.Config.set_tbl_column_data_type_inline(True)  # doctest: +SKIP
        # ...
        # shape: (3, 2)        shape: (3, 2)
        # ┌─────┬───────┐      ┌───────────┬────────────┐
        # │ abc ┆ xyz   │      │ abc (f64) ┆ xyz (bool) │
        # │ --- ┆ ---   │      ╞═══════════╪════════════╡
        # │ f64 ┆ bool  │      │ 1.0       ┆ true       │
        # ╞═════╪═══════╡  >>  │ 2.5       ┆ false      │
        # │ 1.0 ┆ true  │      │ 5.0       ┆ true       │
        # │ 2.5 ┆ false │      └───────────┴────────────┘
        # │ 5.0 ┆ true  │
        # └─────┴───────┘
        Nr;   r   r   s     r   rl   z&Config.set_tbl_column_data_type_inline  sC    . >JNNEtLLLLEHVEUEUBJAB
r   c                    |!t           j                            dd           n)t          t	          |                    t           j        d<   | S )u  
        Print the DataFrame shape information below the data when displaying tables.

        Examples
        --------
        >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
        >>> pl.Config.set_tbl_dataframe_shape_below(True)  # doctest: +SKIP
        # ...
        # shape: (3, 2)        ┌─────┬───────┐
        # ┌─────┬───────┐      │ abc ┆ xyz   │
        # │ abc ┆ xyz   │      │ --- ┆ ---   │
        # │ --- ┆ ---   │      │ f64 ┆ bool  │
        # │ f64 ┆ bool  │      ╞═════╪═══════╡
        # ╞═════╪═══════╡  >>  │ 1.0 ┆ true  │
        # │ 1.0 ┆ true  │      │ 2.5 ┆ false │
        # │ 2.5 ┆ false │      │ 5.0 ┆ true  │
        # │ 5.0 ┆ true  │      └─────┴───────┘
        # └─────┴───────┘      shape: (3, 2)
        Nr7   r   r   s     r   rm   z$Config.set_tbl_dataframe_shape_below%  sC    * >JNNCTJJJJCFs6{{CSCSBJ?@
r   rX   rounded_cornersc                   |!t           j                            dd           nQt          t                    }||vr*d|dd                    |           }t          |          |t           j        d<   |!t           j                            dd           n)t          t          |                    t           j        d<   | S )a  
        Set table formatting style.

        Parameters
        ----------
        format : str
            * "ASCII_FULL": ASCII, with all borders and lines, including row dividers.
            * "ASCII_FULL_CONDENSED": Same as ASCII_FULL, but with dense row spacing.
            * "ASCII_NO_BORDERS": ASCII, no borders.
            * "ASCII_BORDERS_ONLY": ASCII, borders only.
            * "ASCII_BORDERS_ONLY_CONDENSED": ASCII, borders only, dense row spacing.
            * "ASCII_HORIZONTAL_ONLY": ASCII, horizontal lines only.
            * "ASCII_MARKDOWN": Markdown format (ascii ellipses for truncated values).
            * "MARKDOWN": Markdown format (utf8 ellipses for truncated values).
            * "UTF8_FULL": UTF8, with all borders and lines, including row dividers.
            * "UTF8_FULL_CONDENSED": Same as UTF8_FULL, but with dense row spacing.
            * "UTF8_NO_BORDERS": UTF8, no borders.
            * "UTF8_BORDERS_ONLY": UTF8, borders only.
            * "UTF8_HORIZONTAL_ONLY": UTF8, horizontal lines only.
            * "NOTHING": No borders or other lines.

        rounded_corners : bool
            Apply rounded corners to UTF8-styled tables (no-op for ASCII formats).

        Notes
        -----
        The UTF8 styles all use one or more of the semigraphic box-drawing characters
        found in the Unicode Box Drawing block, which are not ASCII compatible:
        https://en.wikipedia.org/wiki/Box-drawing_character#Box_Drawing

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {"abc": [-2.5, 5.0], "mno": ["hello", "world"], "xyz": [True, False]}
        ... )
        >>> with pl.Config(
        ...     tbl_formatting="MARKDOWN",
        ...     tbl_hide_column_data_types=True,
        ...     tbl_hide_dataframe_shape=True,
        ... ):
        ...     print(df)
        | abc  | mno   | xyz   |
        |------|-------|-------|
        | -2.5 | hello | true  |
        | 5.0  | world | false |

        Raises
        ------
        ValueError: if format string not recognised.
        Nr0   zinvalid table format name: z
Expected one of: z, r5   )	r   r   r   r   r$   joinr   r   rb   )r   r  r  valid_format_namesr   s        r   rn   zConfig.set_tbl_formatting@  s    t >JNN8$????!)*:!;!;///pFppQUQZQZ[mQnQnpp oo%8>BJ45"JNN=tDDDD=@_AUAU=V=VBJ9:
r   c                    |!t           j                            dd           n)t          t	          |                    t           j        d<   | S )u  
        Hide table column data types (i64, f64, str etc.).

        Examples
        --------
        >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
        >>> pl.Config.set_tbl_hide_column_data_types(True)  # doctest: +SKIP
        # ...
        # shape: (3, 2)        shape: (3, 2)
        # ┌─────┬───────┐      ┌─────┬───────┐
        # │ abc ┆ xyz   │      │ abc ┆ xyz   │
        # │ --- ┆ ---   │      ╞═════╪═══════╡
        # │ f64 ┆ bool  │      │ 1.0 ┆ true  │
        # ╞═════╪═══════╡  >>  │ 2.5 ┆ false │
        # │ 1.0 ┆ true  │      │ 5.0 ┆ true  │
        # │ 2.5 ┆ false │      └─────┴───────┘
        # │ 5.0 ┆ true  │
        # └─────┴───────┘
        Nr:   r   r   s     r   ro   z%Config.set_tbl_hide_column_data_types  sC    * >JNNDdKKKKDGFDTDTBJ@A
r   c                    |!t           j                            dd           n)t          t	          |                    t           j        d<   | S )u  
        Hide table column names.

        Examples
        --------
        >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
        >>> pl.Config.set_tbl_hide_column_names(True)  # doctest: +SKIP
        # ...
        # shape: (3, 2)        shape: (3, 2)
        # ┌─────┬───────┐      ┌─────┬───────┐
        # │ abc ┆ xyz   │      │ f64 ┆ bool  │
        # │ --- ┆ ---   │      ╞═════╪═══════╡
        # │ f64 ┆ bool  │      │ 1.0 ┆ true  │
        # ╞═════╪═══════╡  >>  │ 2.5 ┆ false │
        # │ 1.0 ┆ true  │      │ 5.0 ┆ true  │
        # │ 2.5 ┆ false │      └─────┴───────┘
        # │ 5.0 ┆ true  │
        # └─────┴───────┘
        Nr6   r   r   s     r   rp   z Config.set_tbl_hide_column_names  sC    * >JNN?FFFF?B3v;;?O?OBJ;<
r   c                    |!t           j                            dd           n)t          t	          |                    t           j        d<   | S )u`  
        Hide the '---' separator displayed between the column names and column types.

        See Also
        --------
        set_tbl_column_data_type_inline : Display the data type inline with the colname.

        Examples
        --------
        >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
        >>> pl.Config.set_tbl_hide_dtype_separator(True)  # doctest: +SKIP
        # ...
        # shape: (3, 2)        shape: (3, 2)
        # ┌─────┬───────┐      ┌─────┬───────┐
        # │ abc ┆ xyz   │      │ abc ┆ xyz   │
        # │ --- ┆ ---   │      │ f64 ┆ bool  │
        # │ f64 ┆ bool  │      ╞═════╪═══════╡
        # ╞═════╪═══════╡      │ 1.0 ┆ true  │
        # │ 1.0 ┆ true  │  >>  │ 2.5 ┆ false │
        # │ 2.5 ┆ false │      │ 5.0 ┆ true  │
        # │ 5.0 ┆ true  │      └─────┴───────┘
        # └─────┴───────┘
        Nr8   r   r   s     r   rq   z#Config.set_tbl_hide_dtype_separator  sC    2 >JNNCTJJJJCFs6{{CSCSBJ?@
r   c                    |!t           j                            dd           n)t          t	          |                    t           j        d<   | S )u  
        Hide the DataFrame shape information when displaying tables.

        Examples
        --------
        >>> df = pl.DataFrame({"abc": [1.0, 2.5, 5.0], "xyz": [True, False, True]})
        >>> pl.Config.set_tbl_hide_dataframe_shape(True)  # doctest: +SKIP
        # ...
        # shape: (3, 2)        ┌─────┬───────┐
        # ┌─────┬───────┐      │ abc ┆ xyz   │
        # │ abc ┆ xyz   │      │ --- ┆ ---   │
        # │ --- ┆ ---   │      │ f64 ┆ bool  │
        # │ f64 ┆ bool  │      ╞═════╪═══════╡
        # ╞═════╪═══════╡      │ 1.0 ┆ true  │
        # │ 1.0 ┆ true  │  >>  │ 2.5 ┆ false │
        # │ 2.5 ┆ false │      │ 5.0 ┆ true  │
        # │ 5.0 ┆ true  │      └─────┴───────┘
        # └─────┴───────┘
        Nr<   r   r   s     r   rr   z#Config.set_tbl_hide_dataframe_shape  sM    * >JNNNPTUUUUNQFO OBJJK 
r   c                    |!t           j                            dd           nt          |          t           j        d<   | S )uj  
        Set the max number of rows used to draw the table (both Dataframe and Series).

        Parameters
        ----------
        n : int
            Number of rows to display; if `n < 0` (eg: -1), display all
            rows (DataFrame) and all elements (Series).

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {"abc": [1.0, 2.5, 3.5, 5.0], "xyz": [True, False, True, False]}
        ... )
        >>> with pl.Config(tbl_rows=2):
        ...     print(df)
        shape: (4, 2)
        ┌─────┬───────┐
        │ abc ┆ xyz   │
        │ --- ┆ ---   │
        │ f64 ┆ bool  │
        ╞═════╪═══════╡
        │ 1.0 ┆ true  │
        │ …   ┆ …     │
        │ 5.0 ┆ false │
        └─────┴───────┘
        Nr*   r  r  s     r   rs   zConfig.set_tbl_rows  s;    : 9JNN0$777703ABJ,-
r   widthc                    |!t           j                            dd           nt          |          t           j        d<   | S )u  
        Set the maximum width of a table in characters.

        Parameters
        ----------
        width : int
            Maximum table width in characters; if n < 0 (eg: -1), display full width.

        Examples
        --------
        >>> df = pl.DataFrame(
        ...     {
        ...         "id": ["SEQ1", "SEQ2"],
        ...         "seq": ["ATGATAAAGGAG", "GCAACGCATATA"],
        ...     }
        ... )
        >>> df
        shape: (2, 2)
        ┌──────┬──────────────┐
        │ id   ┆ seq          │
        │ ---  ┆ ---          │
        │ str  ┆ str          │
        ╞══════╪══════════════╡
        │ SEQ1 ┆ ATGATAAAGGAG │
        │ SEQ2 ┆ GCAACGCATATA │
        └──────┴──────────────┘
        >>> pl.Config.set_tbl_width_chars(12)  # doctest: +IGNORE_RESULT
        >>> df
        shape: (2, 2)
        ┌─────┬─────┐
        │ id  ┆ seq │
        │ --- ┆ --- │
        │ str ┆ str │
        ╞═════╪═════╡
        │ SEQ ┆ ATG │
        │ 1   ┆ ATA │
        │     ┆ AAG │
        │     ┆ GAG │
        │ SEQ ┆ GCA │
        │ 2   ┆ ACG │
        │     ┆ CAT │
        │     ┆ ATA │
        └─────┴─────┘
        Nr(   r  )r   r  s     r   rt   zConfig.set_tbl_width_chars  s<    \ =JNN/6666/25zzBJ+,
r   c                .    t          j        |           | S )u  
        Strip trailing zeros from Decimal data type values.

        Parameters
        ----------
        active : bool
            Enable stripping of trailing '0' characters from Decimal values.

        Examples
        --------
        >>> from decimal import Decimal as D
        >>> df = pl.DataFrame(
        ...     data={"d": [D("1.01000"), D("-5.67890")]},
        ...     schema={"d": pl.Decimal(scale=5)},
        ... )
        >>> with pl.Config(trim_decimal_zeros=False):
        ...     print(df)
        shape: (2, 1)
        ┌──────────────┐
        │ d            │
        │ ---          │
        │ decimal[*,5] │
        ╞══════════════╡
        │ 1.01000      │
        │ -5.67890     │
        └──────────────┘
        >>> with pl.Config(trim_decimal_zeros=True):
        ...     print(df)
        shape: (2, 1)
        ┌──────────────┐
        │ d            │
        │ ---          │
        │ decimal[*,5] │
        ╞══════════════╡
        │ 1.01         │
        │ -5.6789      │
        └──────────────┘
        )r   rA   r   s     r   rA   zConfig.set_trim_decimal_zerosS  s    P 	"6***
r   c                    |!t           j                            dd           n)t          t	          |                    t           j        d<   | S )z
        Enable additional verbose/debug logging.

        Examples
        --------
        >>> pl.Config.set_verbose(True)  # doctest: +SKIP
        >>> with pl.Config(verbose=True):  # doctest: +SKIP
        ...     do_polars_operations()
        Nr%   r   r   s     r   ru   zConfig.set_verbose~  sC     >JNN+T2222+.s6{{+;+;BJ'(
r   c                    |!t           j                            dd           n)t          t	          |                    t           j        d<   | S )a  
        Issue a warning when unstable functionality is used.

        Enabling this setting may help avoid functionality that is still evolving,
        potentially reducing maintenance burden from API changes and bugs.

        Examples
        --------
        >>> pl.Config.warn_unstable(True)  # doctest: +SKIP
        >>> pl.col("a").qcut(5)  # doctest: +SKIP
        UnstableWarning: `qcut` is considered unstable. It may be changed at any point without it being considered a breaking change.
        Nr+   r   r   s     r   warn_unstablezConfig.warn_unstable  sC     >JNN14888814S[[1A1ABJ-.
r   limitrb   c                l    |dk     rd}t          |          t          |          t          j        d<   | S )z
        Set the the expression depth that Polars will accept without triggering a warning.

        Having too deep expressions (several 1000s) can lead to overflowing the stack and might be worth a refactor.
        r   zlimit should be positiver-   )r   r   r   r   )r   r!  r   s      r   rv   zConfig.set_expr_depth_warning  s6     199,CS//!.1%jj
*+
r   enginerw   c                6   t          |t                    rd}t          |          t          t          t                    d                   }|h |dvrd}t          |          |!t          j                            dd           n|t          j        d<   | S )u  
        Set which engine to use by default.

        Parameters
        ----------
        engine : {None, 'auto', 'in-memory', 'streaming', 'gpu'}
            The default execution engine Polars will attempt to use
            when calling `.collect()`. However, the query is not
            guaranteed to execute with the specified engine.

        Examples
        --------
        >>> pl.Config.set_engine_affinity("streaming")  # doctest: +SKIP
        >>> lf = pl.LazyFrame({"v": [1, 2, 3], "v2": [4, 5, 6]})  # doctest: +SKIP
        >>> lf.max().collect()  # doctest: +SKIP
        shape: (3, 2)
        ┌─────┬─────┐
        │ v   ┆ v2  │
        │ --- ┆ --- │
        │ i64 ┆ i64 │
        ╞═════╪═════╡
        │ 1   ┆ 4   │
        │ 2   ┆ 5   │
        │ 3   ┆ 6   │
        └─────┴─────┘
        >>> pl.Config.set_engine_affinity("gpu")  # doctest: +SKIP
        >>> lf.max().collect()  # doctest: +SKIP
        shape: (3, 2)
        ┌─────┬─────┐
        │ v   ┆ v2  │
        │ --- ┆ --- │
        │ i64 ┆ i64 │
        ╞═════╪═════╡
        │ 1   ┆ 4   │
        │ 2   ┆ 5   │
        │ 3   ┆ 6   │
        └─────┴─────┘

        Raises
        ------
        ValueError: if engine is not recognised.
        NotImplementedError: if engine is a GPUEngine object
        z.GPU engine with non-defaults not yet supportedr   Nzinvalid enginer.   )	r   r   NotImplementedErrorr   r	   r   r   r   r   )r   r#  r   supported_enginess       r   rx   zConfig.set_engine_affinity  s    Z fi(( 	+BC%c***$Xj%9%9!%<==3,3d333"CS//!>JNN3T::::39BJ/0
r   )r   r   r   r   r   r   r   r   )r   r   )r   r   r   r   r   r   r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r   )r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r   r   r   )T)r   rD   r   r   )Fr   )r   rG   r   r   )r   rI   r   r   )r   rK   r   r   )r   )r   rM   r   r   )r   rK   r   r   )r  rK   r   r   )r  rR   r   r   r   )r  rX   r  rD   r   r   )r  rK   r   r   )r!  rb   r   r   )r#  rw   r   r   ).ry   rz   r{   r|   r   r}   r   r   r   r   r   r   r   classmethodr   r   r   r   r   r   rd   re   r@   r?   r>   r=   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   rA   ru   r   rv   rx   r~   r   r   r   r      su         8 154444O
 "'',	T) T) T) T) T) T)l   " " " "
 
 
 
& & & && & & &    [B ! ! ! [!,    [. $) & & & & & [&P $ $ $ [$. $u     [@     [B     [6 ' ' ' ' ['R ,0B B B B [BH @ @ @ @ [@D ) ) ) ) [)V 1 1 1 [1f . . . [.`    [2 * * * [*X / / / [/b * * * [*X #'    [8     [4  +/',G G G G [GR     [4     [4     [<     [8       [ D 1 1 1 [1f ( ( ( ( [(T     [      [&    [ 7 7 7 7 [7 7 7r   )/
__future__r   
contextlibr   pathlibr   typingr   r   r   r   polars._typingr	   polars._utils.variousr
   polars.dependenciesr   polars.lazyframe.engine_configr   systypesr   r   version_infor   typing_extensionsr   r   __all__r$   r}   r   suppressImportError	NameErrorpolars.polarspolarsr   get_float_fmtget_float_precisionget_thousands_separatorget_decimal_separatorget_trim_decimal_zerosr   rC   ContextDecoratorr   r~   r   r   <module>r@     s   " " " " " " "     				       > > > > > > > > > > > > % % % % % % 4 4 4 4 4 4 $ $ $ $ $ $ 4 4 4 4 4 4 3JJJ######''''''
7""$$$$$$$//////
7""'''''''''22222222*%     (   : Zi00 
 
 *"6#&#>!$!:"%"< 	
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4+ 4+ 4+ 4+ 4+y 4+ 4+ 4+ 4+nU U U U UZ( U U U U Us   %(CC C