
    'hN                       % S SK Jr  S SKrS SKrS SKJr  S SKJr  S SKJ	r	J
r
JrJr  S SKJr  S SKJrJrJr  S SKJr  S S	KJr  \R.                  " \5         S S
KJrJr  SSS5        \	(       a1  S SKJr  S SKJrJr  S SKJ r   \RB                  S:  a  S SKJ"r"  OS SK#J"r"  \RB                  S:  a  SS jr$OSS jr$\\%\4   r&\\\\4   r'S\(S'   S/r)SS jr* " S S\&5      r+g! , (       d  f       N= f)    )annotationsN)OrderedDict)Mapping)TYPE_CHECKINGLiteralUnionoverload)PythonDataType)DataTypeDataTypeClassis_polars_dtype)parse_into_dtype)DuplicateError)&init_polars_schema_from_arrow_c_schema'polars_schema_field_from_arrow_c_schema)Iterable	DataFrame	LazyFrame)ArrowSchemaExportable)   
   )	TypeAliasc                ,    [        U R                  5      $ N)bool__annotations__tps    `C:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\polars/schema.py_required_init_argsr!   !   s     B&&''    c                     SU R                   ;   $ )N__init__)__dict__r   s    r    r!   r!   '   s     R[[((r"   r   SchemaInitDataTypeSchemac                    [        U [        5      (       dR  U R                  5       (       d%  U R                  5       (       d  [	        U 5      (       a  SU < 3n[        U5      eU " 5       n U $ )Nz%dtypes must be fully-specified, got: )
isinstancer   	is_nested
is_decimalr!   	TypeError)r   msgs     r    _check_dtyper.   3   sQ    b(##<<>>R]]__0CB0G0G9"@CC. TIr"   c                     ^  \ rS rSrSr SSS.     SU 4S jjjjrSS jrSS jr      SU 4S jjrSS	 jr	SS
 jr
\SS j5       r\SS.SS jj5       rSS.SS jjrSS jrSS jrSrU =r$ )r'   =   ao  
Ordered mapping of column names to their data type.

Parameters
----------
schema
    The schema definition given by column names and their associated
    Polars data type. Accepts a mapping or an iterable of tuples.

Examples
--------
Define a schema by passing instantiated data types.

>>> schema = pl.Schema(
...     {
...         "foo": pl.String(),
...         "bar": pl.Duration("us"),
...         "baz": pl.Array(pl.Int8, 4),
...     }
... )
>>> schema
Schema({'foo': String, 'bar': Duration(time_unit='us'), 'baz': Array(Int8, shape=(4,))})

Access the data type associated with a specific column name.

>>> schema["baz"]
Array(Int8, shape=(4,))

Access various schema properties using the `names`, `dtypes`, and `len` methods.

>>> schema.names()
['foo', 'bar', 'baz']
>>> schema.dtypes()
[String, Duration(time_unit='us'), Array(Int8, shape=(4,))]
>>> schema.len()
3
T)check_dtypesc                 > [        US5      (       a!  [        U[        5      (       d  [        X5        g [        U[        5      (       a  UR                  5       O
U=(       d    SnU H  n[        US5      (       a  [        U5      OUu  pVXP;   a  SU S3n[        U5      eU(       d  [        TU ]%  XV5        MQ  [        U5      (       a  [        TU ]%  U[        U5      5        M|  X`U'   M     g )N__arrow_c_schema__ z7iterable passed to pl.Schema contained duplicate name '')hasattrr)   r'   r   r   itemsr   r   super__setitem__r   r.   )	selfschemar1   inputvnamer   r-   	__class__s	           r    r$   Schema.__init__d   s     6/00FF9S9S24@",VW"="=FLbA 1233 8: D |OPTvUVW$S))#D- $$#D,r*:;T
! r"   c                   [        U[        5      (       d  g[        U 5      [        U5      :w  a  g[        U R	                  5       UR	                  5       5       H'  u  u  p#u  pEX$:w  d  UR                  U5      (       a  M'    g   g)NFT)r)   r   lenzipr7   is_)r:   othernm1tp1nm2tp2s         r    __eq__Schema.__eq__   se    %))t9E
"&)$**,&F"JS
z 'G r"   c                .    U R                  U5      (       + $ r   )rJ   )r:   rE   s     r    __ne__Schema.__ne__   s    ;;u%%%r"   c                L   > [        [        U5      5      n[        TU ]  X5        g r   )r.   r   r8   r9   )r:   r>   dtyper?   s      r    r9   Schema.__setitem__   s"     -e45D(r"   c                4    [        U R                  5       5      $ )z
Get the column names of the schema.

Examples
--------
>>> s = pl.Schema({"x": pl.Float64(), "y": pl.Datetime(time_zone="UTC")})
>>> s.names()
['x', 'y']
)listkeysr:   s    r    namesSchema.names   s     DIIK  r"   c                4    [        U R                  5       5      $ )z
Get the data types of the schema.

Examples
--------
>>> s = pl.Schema({"x": pl.UInt8(), "y": pl.List(pl.UInt8)})
>>> s.dtypes()
[UInt8, List(UInt8)]
)rS   valuesrU   s    r    dtypesSchema.dtypes   s     DKKM""r"   c                   g r   r4   r:   eagers     r    to_frameSchema.to_frame   s    ?Br"   .)r^   c                   g r   r4   r]   s     r    r_   r`      s    DGr"   c               8    SSK JnJn  U(       a  U" U S9$ U" U S9$ )u  
Create an empty DataFrame (or LazyFrame) from this Schema.

Parameters
----------
eager
    If True, create a DataFrame; otherwise, create a LazyFrame.

Examples
--------
>>> s = pl.Schema({"x": pl.Int32(), "y": pl.String()})
>>> s.to_frame()
shape: (0, 2)
┌─────┬─────┐
│ x   ┆ y   │
│ --- ┆ --- │
│ i32 ┆ str │
╞═════╪═════╡
└─────┴─────┘
>>> s.to_frame(eager=False)  # doctest: +IGNORE_RESULT
<LazyFrame at 0x11BC0AD80>
r   r   )r;   )polarsr   r   )r:   r^   r   r   s       r    r_   r`      s    . 	0).y%JIT4JJr"   c                    [        U 5      $ )z
Get the number of schema entries.

Examples
--------
>>> s = pl.Schema({"x": pl.Int32(), "y": pl.List(pl.String)})
>>> s.len()
2
>>> len(s)
2
)rB   rU   s    r    rB   
Schema.len   s     4yr"   c                t    U R                  5        VVs0 s H  u  pXR                  5       _M     snn$ s  snnf )a4  
Return a dictionary of column names and Python types.

Examples
--------
>>> s = pl.Schema(
...     {
...         "x": pl.Int8(),
...         "y": pl.String(),
...         "z": pl.Duration("us"),
...     }
... )
>>> s.to_python()
{'x': <class 'int'>, 'y':  <class 'str'>, 'z': <class 'datetime.timedelta'>}
)r7   	to_python)r:   r>   r   s      r    rg   Schema.to_python   s-      6:ZZ\B\lln$\BBBs   4r4   r   )r;   zMapping[str, SchemaInitDataType] | Iterable[tuple[str, SchemaInitDataType] | ArrowSchemaExportable] | ArrowSchemaExportable | Noner1   r   returnNone)rE   objectri   r   )r>   strrP   z)DataType | DataTypeClass | PythonDataTyperi   rj   )ri   z	list[str])ri   zlist[DataType])r^   zLiteral[False]ri   r   )r^   zLiteral[True]ri   r   )r^   r   ri   zDataFrame | LazyFrame)ri   int)ri   zdict[str, type])__name__
__module____qualname____firstlineno____doc__r$   rJ   rM   r9   rV   rZ   r	   r_   rB   rg   __static_attributes____classcell__)r?   s   @r    r'   r'   =   s    $Z    "        
     D&)) I)	)
!
# B B14G G(, K6C Cr"   )r   r   ri   r   )r   zDataType | DataTypeClassri   r   ),
__future__r   
contextlibsyscollectionsr   collections.abcr   typingr   r   r   r	   polars._typingr
   polars.datatypesr   r   r   polars.datatypes._parser   polars.exceptionsr   suppressImportErrorpolars.polarsr   r   r   rc   r   r   r   version_infor   typing_extensionsr!   rl   
BaseSchemar&   r   __all__r.   r'   r4   r"   r    <module>r      s    "  
 # # : : ) E E 4 ,% & (+4
7"$/w() h'
 %h~&M N I N*sCZ sC_ &%s   	C""
C0