
    bi                        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                  f    e Zd ZdZ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_internal_callc               d    |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.

        z'ScanCastOptions is considered unstable.N)r   r   r   r   r   r   )selfr   r   r   r   r   r   s          ^/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/polars/io/scan_options/cast_options.py__init__zScanCastOptions.__init__   s8    x "#LM($*%:"#6     c                     t        d      S )NT)r   )r    r   r   _defaultzScanCastOptions._default\   s    d33r   c                D    t         t        dddgddg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ignoreTr   )r   r   )clss    r   _default_icebergz ScanCastOptions._default_iceberg`   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   boolreturnNone)r)   r   )	__name__
__module____qualname____doc__r   staticmethodr"   classmethodr'   r!   r   r   r   r      s    %
 5= )1 ,4<C:A$C7 2C7&	C7)C7  :C7 8C7 C7 
C7L 4 4 - -r   r   )
__future__r   typingr   r   polars._utils.unstabler   collections.abcr   typing_extensionsr   r   __annotations__r   r   r   r!   r   r   <module>r7      sR    " ) 9*+ %%9: : '(Q R I R8< 5 <a- a-r   