
    .h                        U d dl mZ d dlmZmZ d dlmZ erd dlmZ d dl	m
Z
 ed   Zded<   ed	   Zded
<   daded<    G d d      Zy)    )annotations)TYPE_CHECKINGLiteral)issue_unstable_warning)
Collection)	TypeAlias)upcastdowncastr   FloatCastOption)nanosecond-downcastconvert-timezoneDatetimeCastOptionNzScanCastOptions | None_DEFAULT_CAST_OPTIONS_ICEBERGc                  l    e Zd ZdZdddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d
dZedd       Zedd       Zy	)ScanCastOptionszOptions for scanning files.forbidraiseFinteger_cast
float_castdatetime_castmissing_struct_fieldsextra_struct_fieldscategorical_to_string_internal_callc               r    |st        d       || _        || _        || _        || _        || _        || _        y)a  
        Common configuration for scanning files.

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

        Parameters
        ----------
        integer_cast
            Configuration for casting from integer types:

            * `upcast`: Allow lossless casting to wider integer types.
            * `forbid`: Raises an error if dtypes do not match.

        float_cast
            Configuration for casting from float types:

            * `upcast`: Allow casting to higher precision float types.
            * `downcast`: Allow casting to lower precision float types.
            * `forbid`: Raises an error if dtypes do not match.

        datetime_cast
            Configuration for casting from datetime types:

            * `nanosecond-downcast`: Allow nanosecond precision datetime to be             downcasted to any lower precision. This has a similar effect to             PyArrow's `coerce_int96_timestamp_unit`.
            * `convert-timezone`: Allow casting to a different timezone.
            * `forbid`: Raises an error if dtypes do not match.

        missing_struct_fields
            Configuration for behavior when struct fields defined in the schema
            are missing from the data:

            * `insert`: Inserts the missing fields.
            * `raise`: Raises an error.

        extra_struct_fields
            Configuration for behavior when extra struct fields outside of the
            defined schema are encountered in the data:

            * `ignore`: Silently ignores.
            * `raise`: Raises an error.

        categorical_to_string
            Configuration for behavior when reading in a column whose expected
            type is string, but type in the file is categorical.

            * `allow`: Categorical is casted to string.
            * `forbid`: Raises an error.

        z'ScanCastOptions is considered unstable.N)r   r   r   r   r   r   r   )selfr   r   r   r   r   r   r   s           a/var/www/html/ai-service/venv/lib/python3.12/site-packages/polars/io/scan_options/cast_options.py__init__zScanCastOptions.__init__   s@    H "#LM($*%:"#6 %:"    c                     t        d      S )NT)r   )r    r    r   _defaultzScanCastOptions._defaulte   s    d33r    c           	     F    t         t        dddgddgdddd	      a t         S )
z
        Default options suitable for Iceberg / Deltalake.

        This in general has all casting options enabled. Note: do not modify the
        returned config object, it is a cached global object.
        r	   r
   r   r   insertignoreallowTr   )r   r   )clss    r   _default_icebergz ScanCastOptions._default_icebergi   s=     )0,;%$j146HI&.$,&-#-) -,r    N)r   zLiteral['upcast', 'forbid']r   zALiteral['forbid'] | FloatCastOption | Collection[FloatCastOption]r   zGLiteral['forbid'] | DatetimeCastOption | Collection[DatetimeCastOption]r   zLiteral['insert', 'raise']r   zLiteral['ignore', 'raise']r   zLiteral['allow', 'forbid']r   boolreturnNone)r+   r   )	__name__
__module____qualname____doc__r   staticmethodr#   classmethodr)   r"   r    r   r   r      s    %
 5= )1 ,4<C:A<D$L; 2L;&	L;)L;  :L; 8L;  :L; L; 
L;^ 4 4 - -r    r   )
__future__r   typingr   r   polars._utils.unstabler   collections.abcr   typing_extensionsr   r   __annotations__r   r   r   r"   r    r   <module>r9      sR    " ) 9*+ %%9: : '(Q R I R8< 5 <k- k-r    