
    ei                      U d dl mZ d dlZd dlZd dlZd dlmZmZmZm	Z	m
Z
mZ d dlmZ d dlmZmZ d dlmZmZmZ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"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z, d dl-m.Z. d dl/m0Z0 d dl1m2Z2m3Z3 d dl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZG d dlHmIZImJZJmKZK e"rSd dlmLZL d dlMmNZN d dlOZPd dlQZRd dlSZTd dlUmVZVmWZWmXZXmYZYmZZZm[Z[ d dl\m]Z]m^Z^m_Z_ d dl`maZa d dlbmcZcmdZdmeZemfZf d dlgmhZh d dlimjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZtmuZu d dlvmwZwmxZxmyZy d dlzm{Z{m|Z|m}Z}m~Z~mZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZmZ d dlmZ d dlmZ d dlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ eZd ed!<    e)d"e*ee#   ee#   ee#   f   #      Z e)d$      Z e)d%      Z e)d&      Z e)d'd(#      Z eXd)      Z e)d*      Z e)d+      Z e)d,      Z G d- d.e(      Z G d/ d0e(      Z G d1 d2e(      Z e)d3      Z e)d4d56      Z e)d7d56      Zd8Zd ed9<    e)d:e#      Zd;Zd ed<<   d=Zd ed><    G d? d@e(e         Z G dA dBe(e         Z G dC dDe(      Z G dE dFe(      Z G dG dHe(      Z G dI dJeee(      Z G dK dLeee(      Z G dM dNee(      Z G dO dPe      Z G dQ dRe.      ZeĐj                  dSeĐj                  dTeĐj                  dUeĐj                  dVeĐj                  dWeĐj                  dWeĐj                  dXeĐj                  dYeĐj                  dZeĐj                  d[eĐj                  d\iZd]ed^<   eĐj                  d_eĐj                  d`eĐj                  daeĐj                  dbiZdcedd<   	  edef      ddg       Zeddh       ZddiZddjZddkZddlZddmZe,	 	 	 	 	 	 ddn       Ze,	 	 	 	 	 	 ddo       Ze,	 	 	 	 	 	 ddp       Ze,	 	 	 	 	 	 ddq       Ze,	 	 	 	 	 	 ddr       Ze,	 	 	 	 	 	 dds       Ze,	 	 	 	 	 	 ddt       ZdduZddvZ	 	 	 	 	 	 ddwZddxZ	 dddy	 	 	 	 	 	 	 ddzZdd{Ze"r eed5|      Zn#d dlZej                  d}k\  r eed5|      Zndd~ZddZ	 	 	 	 	 	 ddZ	 	 	 	 	 	 	 	 ddZddZddZ	 d	 	 	 	 	 	 	 ddZ	 d	 	 	 	 	 	 	 ddZ	 	 	 	 	 	 	 	 ddZddZddZ	 	 	 	 ddZ	 	 	 	 ddZddZddZddZ	 	 	 	 ddZ	 	 	 	 ddZddZ	 	 	 	 ddZddZ	 	 	 	 	 	 	 	 ddZddd	 	 	 	 	 ddZ	 	 	 	 	 	 ddZddZ	 	 	 	 	 	 ddZddZ	 	 	 	 	 	 ddZ	 	 	 	 	 	 	 	 	 	 ddZddZd dZddZ  e       Zded<   ddZ	 	 	 	 ddZ	 	 	 	 ddZ	 	 	 	 ddZ	 	 	 	 ddZ	 	 	 	 ddZddZ	ddZ
ddZd	dZd
dZddZ	 	 	 	 	 	 	 	 ddZddZddZddZ G d d      ZddZ G d d      Z	 	 	 	 	 	 ddZ	 	 	 	 ddZddZddddZ G d de&e         Z edf      dd       ZddZ G d dee   ee(e         Z G dĄ de(e         Z G dƄ dǫ      ZddȄZ ddɄZ!	 	 	 	 	 	 ddʄZ" G d˄ de      Z#e#jH                  Z$ e%d      Z&y(      )annotationsN)
Collection	ContainerIterableIteratorMappingSequence)timezone)Enumauto)cache	lru_cachepartialwraps)	find_spec)getattr_staticgetdoc)chain)
attrgetter)	token_hex)TYPE_CHECKINGAnyCallableFinalGenericLiteralProtocolTypeVarUnioncastoverload)
NoAutoEnum)issue_deprecation_warning)assert_never
deprecated)get_cudfget_dask_dataframe
get_duckdbget_ibis	get_modin
get_pandas
get_polarsget_pyarrowget_pyspark_connectget_pyspark_sqlget_sqlframeis_narwhals_seriesis_narwhals_series_boolis_narwhals_series_intis_numpy_array_1dis_numpy_array_1d_boolis_numpy_array_1d_intis_pandas_like_dataframeis_pandas_like_series)ColumnNotFoundErrorDuplicateErrorInvalidOperationError)Set)
ModuleType)ConcatenateLiteralString	ParamSpecSelf	TypeAliasTypeIs)CompliantExprTCompliantSeriesTNativeSeriesT_co)NamespaceAccessor)Accessor	EvalNamesNativeDataFrameTNativeLazyFrameT	Namespace)NativeArrow
NativeCuDF
NativeDaskNativeDuckDB
NativeIbisNativeModinNativePandasNativePandasLikeNativePolarsNativePySparkNativePySparkConnectNativeSQLFrame)ArrowStreamExportableIntoArrowTableToNarwhalsT_co)BackendIntoBackend
_ArrowImpl	_CuDFImpl	_DaskImpl_DuckDBImpl_EagerAllowedImpl	_IbisImpl_LazyAllowedImpl_LazyFrameCollectImpl
_ModinImpl_PandasImpl_PandasLikeImpl_PolarsImpl_PySparkConnectImpl_PySparkImpl_SQLFrameImpl	DataFrame	LazyFrameDTypeSeries)CompliantDataFrameCompliantLazyFrameCompliantSeriesDTypes
FileSourceIntoSeriesTMultiIndexSelectorSingleIndexSelectorSizedMultiBoolSelectorSizedMultiIndexSelectorSizeUnitSupportsNativeNamespaceTimeUnit_1DArray_SliceIndex
_SliceName
_SliceNonerB   UnknownBackendNameFrameOrSeriesT)bound_T1_T2_T3_FnzCallable[..., Any]PRR1R2c                      e Zd ZU ded<   y)_SupportsVersionstr__version__N__name__
__module____qualname____annotations__     Q/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/narwhals/_utils.pyr   r      s    r   r   c                      e Zd ZdddZy)_SupportsGetNc                    y Nr   selfinstanceowners      r   __get__z_SupportsGet.__get__   s    r   r   )r   r   r   
Any | Nonereturnr   )r   r   r   r   r   r   r   r   r      s    Qr   r   c                      e Zd Zedd       Zy)_StoresColumnsc                     y r   r   r   s    r   columnsz_StoresColumns.columns   s    ,/r   N)r   Sequence[str])r   r   r   propertyr   r   r   r   r   r      s    	/ 
/r   r   _T
NativeT_coT)	covariantCompliantT_coz._FullContext | NamespaceAccessor[_FullContext]_IntoContext_IntoContextTz*Callable[Concatenate[_IntoContextT, P], R]_Methodz Callable[Concatenate[_T, P], R2]_Constructorc                  "    e Zd ZdZedd       Zy)_StoresNativezProvides access to a native object.

    Native objects have types like:

    >>> from pandas import Series
    >>> from pyarrow import Table
    c                     y)zReturn the native object.Nr   r   s    r   nativez_StoresNative.native        	r   N)r   r   )r   r   r   __doc__r   r   r   r   r   r   r            r   r   c                  "    e Zd ZdZedd       Zy)_StoresCompliantzProvides access to a compliant object.

    Compliant objects have types like:

    >>> from narwhals._pandas_like.series import PandasLikeSeries
    >>> from narwhals._arrow.dataframe import ArrowDataFrame
    c                     y)zReturn the compliant object.Nr   r   s    r   	compliantz_StoresCompliant.compliant   r   r   N)r   r   )r   r   r   r   r   r   r   r   r   r   r      r   r   r   c                      e Zd Zedd       Zy)_StoresBackendVersionc                     y)z#Version tuple for a native package.Nr   r   s    r   _backend_versionz&_StoresBackendVersion._backend_version   r   r   Nr   tuple[int, ...])r   r   r   r   r   r   r   r   r   r      s     r   r   c                      e Zd ZU ded<   y)_StoresVersionVersion_versionNr   r   r   r   r   r      s    ,r   r   c                      e Zd ZU ded<   y)_StoresImplementationImplementation_implementationNr   r   r   r   r   r      s    ##Ir   r   c                      e Zd ZdZy)_LimitedContextzEProvides 2 attributes.

    - `_implementation`
    - `_version`
    Nr   r   r   r   r   r   r   r   r          r   r   c                      e Zd ZdZy)_FullContextzMProvides 2 attributes.

    - `_implementation`
    - `_backend_version`
    Nr   r   r   r   r   r      r   r   r   c                      e Zd ZdZddZy)ValidateBackendVersionz=Ensure the target `Implementation` is on a supported version.c                8    | j                   j                         }y)zRaise if installed version below `nw._utils.MIN_VERSIONS`.

        **Only use this when moving between backends.**
        Otherwise, the validation will have taken place already.
        N)r   r   )r   _s     r   _validate_backend_versionz0ValidateBackendVersion._validate_backend_version   s       113r   N)r   None)r   r   r   r   r   r   r   r   r   r      s
    G4r   r   c                      e Zd Z e       Z e       Z e       Zedd       Zedd       Z	ed	d       Z
ed
d       Zedd       Zy)r   c                z    | t         j                  u rddlm} |S | t         j                  u rddlm} |S ddlm} |S )Nr   rL   )r   V1narwhals.stable.v1._namespacerM   V2narwhals.stable.v2._namespacenarwhals._namespace)r   NamespaceV1NamespaceV2rM   s       r   	namespacezVersion.namespace   s5    7::N7::N1r   c                z    | t         j                  u rddlm} |S | t         j                  u rddlm} |S ddlm} |S )Nr   )dtypes)r   r   narwhals.stable.v1r   r   narwhals.stable.v2narwhals)r   	dtypes_v1	dtypes_v2r   s       r   r   zVersion.dtypes
  s4    7::>7::>#r   c                z    | t         j                  u rddlm} |S | t         j                  u rddlm} |S ddlm} |S )Nr   )ro   )r   r   r   ro   r   r   narwhals.dataframe)r   DataFrameV1DataFrameV2ro   s       r   	dataframezVersion.dataframe  5    7::C7::C0r   c                z    | t         j                  u rddlm} |S | t         j                  u rddlm} |S ddlm} |S )Nr   )rp   )r   r   r   rp   r   r   r   )r   LazyFrameV1LazyFrameV2rp   s       r   	lazyframezVersion.lazyframe&  r   r   c                z    | t         j                  u rddlm} |S | t         j                  u rddlm} |S ddlm} |S )Nr   rs   )r   r   r   rt   r   r   narwhals.series)r   SeriesV1SeriesV2rt   s       r   serieszVersion.series4  s2    7::=O7::=O*r   N)r   ztype[Namespace[Any]])r   rx   )r   ztype[DataFrame[Any]])r   ztype[LazyFrame[Any]])r   ztype[Series[Any]])r   r   r   r   r   r   MAINr   r   r   r   r   r   r   r   r   r   r      sy    	B	B6D         r   r   c                  &   e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZ	 dZ		 dZ
	 d	Z	 d
Z	 dZ	 dZ	 dZ	 d"dZe	 	 	 	 	 	 d#d       Zed$d       Ze	 	 	 	 	 	 d%d       Zd&dZd'dZd'dZd'dZd'dZd'dZd'dZd'dZd'dZd'dZd'dZd'dZ d'dZ!d'dZ"d(d Z#y!))r   z?Implementation of native object (pandas, Polars, PyArrow, ...).pandasmodincudfpyarrowpysparkpolarsdaskduckdbibissqlframezpyspark[connect]unknownc                ,    t        | j                        S r   )r   valuer   s    r   __str__zImplementation.__str___  s    4::r   c                V   t               t        j                  t               t        j                  t               t        j                  t               t        j                  t               t        j                  t               t        j                  t               t        j                  t               t        j                   t#               t        j$                  t'               t        j(                  t+               t        j,                  i}|j/                  |t        j0                        S )zInstantiate Implementation object from a native namespace module.

        Arguments:
            native_namespace: Native namespace.
        )r+   r   PANDASr*   MODINr&   CUDFr-   PYARROWr/   PYSPARKr,   POLARSr'   DASKr(   DUCKDBr)   IBISr0   SQLFRAMEr.   PYSPARK_CONNECTgetUNKNOWN)clsnative_namespacemappings      r   from_native_namespacez$Implementation.from_native_namespaceb  s     L.//K--J++M>11~55L.// ."5"5L.//J++NN33!>#A#A
 {{+^-C-CDDr   c                R    	  | |      S # t         $ r t        j                  cY S w xY w)zInstantiate Implementation object from a native namespace module.

        Arguments:
            backend_name: Name of backend, expressed as string.
        )
ValueErrorr   r  )r  backend_names     r   from_stringzImplementation.from_stringz  s-    	*|$$ 	*!)))	*s   
 &&c                    t        |t              r| j                  |      S t        |t              r|S | j	                  |      S )zInstantiate from native namespace module, string, or Implementation.

        Arguments:
            backend: Backend to instantiate Implementation from.
        )
isinstancer   r!  r   r  )r  backends     r   from_backendzImplementation.from_backend  sL     '3' OOG$	
 '>2 	

 **73	
r   c                    | t         j                  u rd}t        |      | j                          t        j                  | | j                        }t        |      S )zCReturn the native namespace module corresponding to Implementation.z:Cannot return native namespace from UNKNOWN Implementation)r   r  AssertionErrorr   _IMPLEMENTATION_TO_MODULE_NAMEr  r
  _import_native_namespace)r   msgmodule_names      r   to_native_namespacez"Implementation.to_native_namespace  sM    >)))NC %%488tzzJ'44r   c                &    | t         j                  u S )a7  Return whether implementation is pandas.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_pandas()
            True
        )r   r  r   s    r   	is_pandaszImplementation.is_pandas       ~,,,,r   c                d    | t         j                  t         j                  t         j                  hv S )aL  Return whether implementation is pandas, Modin, or cuDF.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_pandas_like()
            True
        )r   r  r  r  r   s    r   is_pandas_likezImplementation.is_pandas_like  s(     --~/C/C^EXEXYYYr   c                d    | t         j                  t         j                  t         j                  hv S )aI  Return whether implementation is pyspark or sqlframe.

        Examples:
            >>> import pandas as pd
            >>> import narwhals as nw
            >>> df_native = pd.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_spark_like()
            False
        )r   r  r  r  r   s    r   is_spark_likezImplementation.is_spark_like  s1     ""##**
 
 	
r   c                &    | t         j                  u S )a7  Return whether implementation is Polars.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_polars()
            True
        )r   r  r   s    r   	is_polarszImplementation.is_polars  r/  r   c                &    | t         j                  u S )a4  Return whether implementation is cuDF.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_cudf()
            False
        )r   r  r   s    r   is_cudfzImplementation.is_cudf       ~****r   c                &    | t         j                  u S )a6  Return whether implementation is Modin.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_modin()
            False
        )r   r  r   s    r   is_modinzImplementation.is_modin  s     ~++++r   c                &    | t         j                  u S )a:  Return whether implementation is PySpark.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_pyspark()
            False
        )r   r  r   s    r   
is_pysparkzImplementation.is_pyspark       ~----r   c                &    | t         j                  u S )aB  Return whether implementation is PySpark.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_pyspark_connect()
            False
        )r   r  r   s    r   is_pyspark_connectz!Implementation.is_pyspark_connect   s     ~5555r   c                &    | t         j                  u S )a:  Return whether implementation is PyArrow.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_pyarrow()
            False
        )r   r  r   s    r   
is_pyarrowzImplementation.is_pyarrow  r=  r   c                &    | t         j                  u S )a4  Return whether implementation is Dask.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_dask()
            False
        )r   r  r   s    r   is_daskzImplementation.is_dask  r8  r   c                &    | t         j                  u S )a8  Return whether implementation is DuckDB.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_duckdb()
            False
        )r   r  r   s    r   	is_duckdbzImplementation.is_duckdb'  r/  r   c                &    | t         j                  u S )a4  Return whether implementation is Ibis.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_ibis()
            False
        )r   r  r   s    r   is_ibiszImplementation.is_ibis4  r8  r   c                &    | t         j                  u S )a<  Return whether implementation is SQLFrame.

        Examples:
            >>> import polars as pl
            >>> import narwhals as nw
            >>> df_native = pl.DataFrame({"a": [1, 2, 3]})
            >>> df = nw.from_native(df_native)
            >>> df.implementation.is_sqlframe()
            False
        )r   r  r   s    r   is_sqlframezImplementation.is_sqlframeA  s     ~....r   c                    t        |       S )zReturns backend version.backend_versionr   s    r   r   zImplementation._backend_versionN  s    t$$r   Nr   r   )r  
type[Self]r  r=   r   r   )r  rN  r   r   r   r   )r  rN  r$  z)IntoBackend[Backend] | UnknownBackendNamer   r   )r   r=   )r   boolr   )$r   r   r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  classmethodr  r!  r%  r,  r.  r1  r3  r5  r7  r:  r<  r?  rA  rC  rE  rG  rI  r   r   r   r   r   r   C  s'   IF EDG!G!F DF DH"(O)G! EE+5E	E E. 	* 	* 

"K
	
 
 5-Z
"-+,.6.+-+/%r   r   )   rQ     )r         )   
   )   )rR     )r         )i  rS  )rQ  rQ  )   )rR     r   z(Mapping[Implementation, tuple[int, ...]]MIN_VERSIONSzdask.dataframezmodin.pandaszpyspark.sqlzpyspark.sql.connectzMapping[Implementation, str]r(     )maxsizec                    ddl m}  ||       S )Nr   )import_module)	importlibra  )r+  ra  s     r   r)  r)  j  s    '%%r   c                  t        | t              st        |        | t        j                  u ry| }t        j                  ||j                        }t        |      }|j                         rdd l	}|j                  }n@|j                         s|j                         rdd l}|}n|j                         rdd l}|}n|}t!        |      }|t"        |   x}	k  rd| d|	 d| }
t%        |
      |S )N)r   r   r   r   zMinimum version of z supported by Narwhals is z	, found: )r#  r   r$   r  r(  r  r
  r)  rI  sqlframe._versionr   r<  r?  r  rC  r  parse_versionr]  r  )implementationimplr+  r  r  into_versionr  r  versionmin_versionr*  s              r   rL  rL  t  s    nn5^$///D044T4::FK/< ((		d557	'L)Gd!33+4#D6)CK=PYZaYbcoNr   c                b    t        t        |       dk(  rt        | d         r	| d         S |       S )NrQ  r   )listlen_is_iterable)argss    r   flattenrp    s.    CIN|DG/DQPP4PPr   c                8    t        | t        t        f      s| fS | S r   )r#  rl  tuple)args    r   tupleifyrt    s    cD%=)vJr   c                z   ddl m} t               x}"t        | |j                  |j                  f      sDt               x}Rt        | |j                  |j                  |j                  |j                  f      rdt        |       d}t        |      t        | t              xr t        | t        t        |f       S )Nr   rs   z(Expected Narwhals class or scalar, got: z`.

Hint: Perhaps you
- forgot a `nw.from_native` somewhere?
- used `pl.col` instead of `nw.col`?)r   rt   r+   r#  ro   r,   Exprrp   qualified_type_name	TypeErrorr   r   bytes)rs  rt   pdplr*  s        r   rn  rn    s    & |	(Zbii=V-W|	(sRYYr||LM 77J37O6R S3 3 	 nc8$RZc5&=Q-R)RRr   c                "    t        | t              S r   )r#  r   )vals    r   is_iteratorr~    s    c8$$r   c                    t        | t              r| n| j                  }t        j                  dd|      }t        d |j                  d      D              S )zSimple version parser; split into a tuple of ints for comparison.

    Arguments:
        version: Version string, or object with one, to parse.
    z(\D?dev.*$) c              3  \   K   | ]$  }t        t        j                  d d|             & yw)z\Dr  N)intresub).0vs     r   	<genexpr>z parse_version.<locals>.<genexpr>  s"     KqRVVE2q)*Ks   *,.)r#  r   r   r  r  rr  split)ri  version_strs     r   re  re    sH     (5'7;N;NK&&[9KKK4E4Ec4JKKKr   c                     y r   r   
obj_or_clscls_or_tuples     r   isinstance_or_issubclassr    s     r   c                     y r   r   r  s     r   r  r          r   c                     y r   r   r  s     r   r  r    s     "r   c                     y r   r   r  s     r   r  r    s     +.r   c                     y r   r   r  s     r   r  r    s     %(r   c                     y r   r   r  s     r   r  r    s     7:r   c                     y r   r   r  s     r   r  r    s     r   c                    ddl m} t        | |      rt        | |      S t        | |      xs t        | t              xr t	        | |      S )Nr   rq   )narwhals.dtypesrr   r#  type
issubclass)r  r  rr   s      r   r  r    sF    %*e$*l33j,/ :t$MJ)Mr   c                    ddl mm t        fd| D              st        fd| D              ry d| D cg c]  }t	        |       c} }t        |      c c}w )Nr   rn   c              3  6   K   | ]  }t        |        y wr   r#  )r  itemro   s     r   r  z$validate_laziness.<locals>.<genexpr>  s     
94:dI&
9   c              3  6   K   | ]  }t        |        y wr   r  )r  r  rp   s     r   r  z$validate_laziness.<locals>.<genexpr>  s     :DJtY':r  zGThe items to concatenate should either all be eager, or all lazy, got: )r   ro   rp   allr  rx  )itemsr  r*  ro   rp   s      @@r   validate_lazinessr    sW    7

95
99:E::SlqTrdhUYZ^U_TrSs
tC
C. Uss   Ac                   ddl m} ddlm} dd}t	        d|       }t	        d|      }t        t        |dd      |      rt        t        |dd      |      r ||j                  j                  j                          ||j                  j                  j                         |j                  |j                  j                  |j                  j                  j                  |j                  j                  j                                 S t        t        |dd      |      rt        t        |dd      |      r ||j                  j                  j                          ||j                  j                  j                         |j                  |j                  j                  |j                  j                  j                  |j                  j                  j                                 S t        t        |dd      |      rt        t        |dd      |      r ||j                  j                  j                          ||j                  j                  j                         |j                  |j                  j                  |j                  j                  j                  |j                  j                  j                                 S t        t        |dd      |      rt        t        |dd      |      r ||j                  j                  j                          ||j                  j                  j                         |j                  |j                  j                  |j                  j                  j                  |j                  j                  j                                 S t        |      t        |      k7  r%d	t        |       d
t        |       }t        |      | S )a  Align `lhs` to the Index of `rhs`, if they're both pandas-like.

    Arguments:
        lhs: Dataframe or Series.
        rhs: Dataframe or Series to align with.

    Notes:
        This is only really intended for backwards-compatibility purposes,
        for example if your library already aligns indices for users.
        If you're designing a new library, we highly encourage you to not
        rely on the Index.
        For non-pandas-like inputs, this only checks that `lhs` and `rhs`
        are the same length.

    Examples:
        >>> import pandas as pd
        >>> import polars as pl
        >>> import narwhals as nw
        >>> df_pd = pd.DataFrame({"a": [1, 2]}, index=[3, 4])
        >>> s_pd = pd.Series([6, 7], index=[4, 3])
        >>> df = nw.from_native(df_pd)
        >>> s = nw.from_native(s_pd, series_only=True)
        >>> nw.to_native(nw.maybe_align_index(df, s))
           a
        4  2
        3  1
    r   )PandasLikeDataFrame)PandasLikeSeriesr   c                6    | j                   sd}t        |      y )Nz'given index doesn't have a unique index)	is_uniquer  )indexr*  s     r   _validate_indexz*maybe_align_index.<locals>._validate_index$  s    ;CS/! r   _compliant_frameN_compliant_seriesz6Expected `lhs` and `rhs` to have the same length, got z and )r  r   r   r   )narwhals._pandas_like.dataframer  narwhals._pandas_like.seriesr  r    r#  getattrr  r   r  _with_compliant_with_nativelocr  rm  r  )lhsrhsr  r  r  lhs_anyrhs_anyr*  s           r   maybe_align_indexr    sI   < D="
 5#G5#G+T24G
WW&8$?AT
U0077==>0077==>&&$$11((//33G4L4L4S4S4Y4YZ
 	

 +T24G
WW&94@BR
S0077==>1188>>?&&$$11((//33--44::
 	
 ,d35E
WW&8$?AT
U1188>>?0077==>&&%%22))0044,,3399
 	
 ,d35E
WW&94@BR
S1188>>?1188>>?&&%%22))0044--44::
 	
 7|s7|#Fs7|nTYZ]^eZfYghoJr   c                    t        d|       }|j                         }t        |      st        |      r|j                  S y)a  Get the index of a DataFrame or a Series, if it's pandas-like.

    Arguments:
        obj: Dataframe or Series.

    Notes:
        This is only really intended for backwards-compatibility purposes,
        for example if your library already aligns indices for users.
        If you're designing a new library, we highly encourage you to not
        rely on the Index.
        For non-pandas-like inputs, this returns `None`.

    Examples:
        >>> import pandas as pd
        >>> import polars as pl
        >>> import narwhals as nw
        >>> df_pd = pd.DataFrame({"a": [1, 2], "b": [4, 5]})
        >>> df = nw.from_native(df_pd)
        >>> nw.maybe_get_index(df)
        RangeIndex(start=0, stop=2, step=1)
        >>> series_pd = pd.Series([1, 2])
        >>> series = nw.from_native(series_pd, series_only=True)
        >>> nw.maybe_get_index(series)
        RangeIndex(start=0, stop=2, step=1)
    r   N)r    	to_nativer7   r8   r  )objobj_any
native_objs      r   maybe_get_indexr  _  s=    4 5#G""$J
+/DZ/Pr   )r  c               V   ddl m} t        d|       }|j                         }||d}t        |      |s|d}t        |      |.t	        |      r|D cg c]  } ||d       c}n	 ||d      }n|}t        |      r9|j                  |j                  j                  |j                  |                  S t        |      r^ddlm	}	 |rd	}t        |       |	||| j                  j                  
      }|j                  |j                  j                  |            S |S c c}w )a  Set the index of a DataFrame or a Series, if it's pandas-like.

    Arguments:
        obj: object for which maybe set the index (can be either a Narwhals `DataFrame`
            or `Series`).
        column_names: name or list of names of the columns to set as index.
            For dataframes, only one of `column_names` and `index` can be specified but
            not both. If `column_names` is passed and `df` is a Series, then a
            `ValueError` is raised.
        index: series or list of series to set as index.

    Raises:
        ValueError: If one of the following conditions happens

            - none of `column_names` and `index` are provided
            - both `column_names` and `index` are provided
            - `column_names` is provided and `df` is a Series

    Notes:
        This is only really intended for backwards-compatibility purposes, for example if
        your library already aligns indices for users.
        If you're designing a new library, we highly encourage you to not
        rely on the Index.

        For non-pandas-like inputs, this is a no-op.

    Examples:
        >>> import pandas as pd
        >>> import polars as pl
        >>> import narwhals as nw
        >>> df_pd = pd.DataFrame({"a": [1, 2], "b": [4, 5]})
        >>> df = nw.from_native(df_pd)
        >>> nw.to_native(nw.maybe_set_index(df, "b"))  # doctest: +NORMALIZE_WHITESPACE
           a
        b
        4  1
        5  2
    r   )r  r   z8Only one of `column_names` or `index` should be providedz3Either `column_names` or `index` should be providedT)pass_through)	set_indexz/Cannot set index using column names on a Series)rf  )narwhals.translater  r    r  rn  r7   r  r  r  r  r8   narwhals._pandas_like.utilsr  r   )
r  column_namesr  r  df_anyr  r*  idxkeysr  s
             r   maybe_set_indexr    s7   X -%F!!#JE$5HoEMCo E" ;@@3Ys.@5t4 	 
+%%##001E1Ed1KL
 	
 Z(9CCS/!00@@


 %%f&>&>&K&KJ&WXXM1 As   D&c                   t        d|       }|j                         }t        |      rX|j                         }t	        ||      r|S |j                  |j                  j                  |j                  d                  S t        |      rX|j                         }t	        ||      r|S |j                  |j                  j                  |j                  d                  S |S )a  Reset the index to the default integer index of a DataFrame or a Series, if it's pandas-like.

    Arguments:
        obj: Dataframe or Series.

    Notes:
        This is only really intended for backwards-compatibility purposes,
        for example if your library already resets the index for users.
        If you're designing a new library, we highly encourage you to not
        rely on the Index.
        For non-pandas-like inputs, this is a no-op.

    Examples:
        >>> import pandas as pd
        >>> import polars as pl
        >>> import narwhals as nw
        >>> df_pd = pd.DataFrame({"a": [1, 2], "b": [4, 5]}, index=([6, 7]))
        >>> df = nw.from_native(df_pd)
        >>> nw.to_native(nw.maybe_reset_index(df))
           a  b
        0  1  4
        1  2  5
        >>> series_pd = pd.Series([1, 2])
        >>> series = nw.from_native(series_pd, series_only=True)
        >>> nw.maybe_get_index(series)
        RangeIndex(start=0, stop=2, step=1)
    r   T)drop)r    r  r7   __native_namespace___has_default_indexr  r  r  reset_indexr8   r  )r  r  r  r  s       r   maybe_reset_indexr    s    8 5#G""$J
+"779j*:;N&&$$11*2H2Hd2H2ST
 	
 Z("779j*:;N&&%%22:3I3It3I3TU
 	
 Nr   )strict)rR  rV  c                    t        |       dk  rt        |  S ddfd}dfd}t        |       }t        t	        |       |             }t        t        t        |            t        t        |g  |             S )NrT  Fc               3     K   d y w)NTr   )first_stoppeds   r   
first_tailzzip_strict.<locals>.first_tail  s      $s   c               3  x   K   sd} t        |       t        j                        D ]  }d} t        |        y w)Nz$zip_strict: first iterable is longerz%zip_strict: first iterable is shorter)r  r   from_iterable)r*  r   r  rests     r   zip_tailzzip_strict.<locals>.zip_tail  sB     $@C$S/),,T2 AAC$S/)s   7:)r   r   )rm  zipiterr   nextrl  map)	iterablesr  r  iterables_itfirstr  r  s        @@r   
zip_strictr    sp    9~!I&!M  	?L$|,jl;ED,/0DU*T*HJ77r   c                .    t        | |j                        S r   )r#  
RangeIndex)r  r  s     r   _is_range_indexr  -  s    c+6677r   c                    | j                   }t        ||      xr: |j                  dk(  xr) |j                  t	        |      k(  xr |j
                  dk(  S )Nr   rQ  )r  r  startstoprm  step)native_frame_or_seriesr  r  s      r   r  r  1  sW     #((E/0 	KK1	JJ#e*$	 JJ!O	r   c           	         | j                   j                         s| S | j                  | j                  j	                   | j                         j                  |i |            }t        d|      S )a-  Convert columns or series to the best possible dtypes using dtypes supporting ``pd.NA``, if df is pandas-like.

    Arguments:
        obj: DataFrame or Series.
        *args: Additional arguments which gets passed through.
        **kwargs: Additional arguments which gets passed through.

    Notes:
        For non-pandas-like inputs, this is a no-op.
        Also, `args` and `kwargs` just get passed down to the underlying library as-is.

    Examples:
        >>> import pandas as pd
        >>> import polars as pl
        >>> import narwhals as nw
        >>> import numpy as np
        >>> df_pd = pd.DataFrame(
        ...     {
        ...         "a": pd.Series([1, 2, 3], dtype=np.dtype("int32")),
        ...         "b": pd.Series([True, False, np.nan], dtype=np.dtype("O")),
        ...     }
        ... )
        >>> df = nw.from_native(df_pd)
        >>> nw.to_native(
        ...     nw.maybe_convert_dtypes(df)
        ... ).dtypes  # doctest: +NORMALIZE_WHITESPACE
        a             Int32
        b           boolean
        dtype: object
    r   )rf  r1  r  
_compliantr  r  convert_dtypesr    )r  ro  kwargsresults       r   maybe_convert_dtypesr  =  sg    B ,,.
  ##$BCMMO$B$BD$SF$STF  &))r   c                v    |dv r| S |dv r| dz  S |dv r| dz  S |dv r| dz  S |dv r| d	z  S d
|}t        |      )zScale size in bytes to other size units (eg: "kb", "mb", "gb", "tb").

    Arguments:
        sz: original size in bytes
        unit: size unit to convert into
    >   bry  >   kb	kilobytesi   >   mb	megabytesi   >   gb	gigabytesi   @>   tb	terabytesl        z9`unit` must be one of {'b', 'kb', 'mb', 'gb', 'tb'}, got r  )szunitr*  s      r   scale_bytesr  f  ss     ~	""Dy""G|""G|""G|Gx
PC
S/r   c                   ddl m} | j                  j                  j                  }| j                  }d}t        ||      r;t        | j                  |j                        r|j                  j                  d   }|S | j                  |j                  k(  rd}|S | j                  |j                  k7  rd}|S | j                         }| j                  }|j                         r8|j                         dk  r%t        d|j                        j                   dk(  }|S |j#                         r!t%        |j&                  j(                        }|S |j+                         r0dd	lm}  ||j0                        xr |j0                  j(                  }|S )
a  Return whether indices of categories are semantically meaningful.

    This is a convenience function to accessing what would otherwise be
    the `is_ordered` property from the DataFrame Interchange Protocol,
    see https://data-apis.org/dataframe-protocol/latest/API.html.

    - For Polars:
      - Enums are always ordered.
      - Categoricals are ordered if `dtype.ordering == "physical"`.
    - For pandas-like APIs:
      - Categoricals are ordered if `dtype.cat.ordered == True`.
    - For PyArrow table:
      - Categoricals are ordered if `dtype.type.ordered == True`.

    Arguments:
        series: Input Series.

    Examples:
        >>> import narwhals as nw
        >>> import pandas as pd
        >>> import polars as pl
        >>> data = ["x", "y"]
        >>>
        >>> s_pd = nw.from_native(
        ...     pd.Series(data, dtype=pd.CategoricalDtype(ordered=True)), series_only=True
        ... )
        >>> nw.is_ordered_categorical(s_pd)
        True
        >>> s_pl = nw.from_native(
        ...     pl.Series(data, dtype=pl.Categorical()), series_only=True
        ... )
        >>> nw.is_ordered_categorical(s_pl)
        False
    r   )InterchangeSeriesF
is_orderedT)rQ      zpl.Categoricalphysical)is_dictionary)narwhals._interchange.seriesr  r  r   r   r#  dtypeCategoricalr   describe_categoricalr   r  rf  r5  r   r    orderingr1  rO  catorderedrA  narwhals._arrow.utilsr   r  )r   r  r   r   r  r   rg  r   s           r   is_ordered_categoricalr	  {  sa   F ?%%..55F((IF)./Jf((5 !!66|D& M% 
	$" M! 
++	+ M !!#$$>> 5 5 7' A *FLL9BBjPF M   "&**,,-F
 M	 __;"6;;/GFKK4G4GFMr   c                <    d}t        |d       t        | ||      S )Nz}Use `generate_temporary_column_name` instead. `generate_unique_token` is deprecated and it will be removed in future versionsz1.13.0r   )n_bytesr   prefix)r#   generate_temporary_column_name)r  r   r  r*  s       r   generate_unique_tokenr    s(    	?  cH5)'7SYZZr   c                t    d}	 | t        | dz
         }||vr|S |dz  }|dkD  rd| d| }t        |      6)a  Generates a unique column name that is not present in the given list of columns.

    It relies on [python secrets token_hex](https://docs.python.org/3/library/secrets.html#secrets.token_hex)
    function to return a string nbytes random bytes.

    Arguments:
        n_bytes: The number of bytes to generate for the token.
        columns: The list of columns to check for uniqueness.
        prefix: prefix with which the temporary column name should start with.

    Returns:
        A unique token that is not present in the given list of columns.

    Raises:
        AssertionError: If a unique token cannot be generated after 100 attempts.

    Examples:
        >>> import narwhals as nw
        >>> columns = ["abc", "xyz"]
        >>> nw.generate_temporary_column_name(n_bytes=8, columns=columns) not in columns
        True
        >>> temp_name = nw.generate_temporary_column_name(
        ...     n_bytes=8, columns=columns, prefix="foo"
        ... )
        >>> temp_name not in columns and temp_name.startswith("foo")
        True
    r   rQ  d   zMInternal Error: Narwhals was not able to generate a column name with n_bytes=z and not in )r   r'  )r  r   r  countertokenr*  s         r   r  r    sm    < G
(9Wq[123L1S=*L	3  !%% r   c                  |s-t        t        | j                        j                  |            S t        |      }t	        || j                        x}r||S )N)	available)rl  setr   intersectioncheck_columns_exist)framesubsetr  to_droperrors        r   parse_columns_to_dropr    sO     C&33F;<<6lG#Gu}}EEuENr   c                H    t        | t              xr t        | t               S r   )r#  r	   r   )sequences    r   is_sequence_but_not_strr      s    h)K*Xs2K.KKr   c                B    t        | t              xr | t        d       k(  S r   )r#  slicer  s    r   is_slice_noner$    s    c5!8cU4[&88r   c                    t        |       xr. t        |       dkD  xr t        | d         xs t        |       dk(  xs% t        |       xs t	        |       xs t        |       S Nr   )r   rm  is_single_index_selectorr6   r3   is_compliant_series_intr#  s    r   is_sized_multi_index_selectorr)    sl    
 $C( Yc(Q,C#;CF#CWSUV	( !%		(
 "#&	( #3'r   c                f    t        |       xs% t        |       xs t        |       xs t        |       S r   )r   r4   r1   is_compliant_seriesr#  s    r   is_sequence_liker,    s:     	 $ 	$S!	$c"	$ s#	r   c                   t        | t              xrx t        | j                  t              xs\ t        | j                  t              xs@ t        | j
                  t        t        f      xr | j                  d u xr | j                  d u S r   )r#  r"  r  r  r  r  NoneTyper#  s    r   is_slice_indexr/  !  sr    c5! 399c" 	
chh$	
 sxx#x1 !		T!!D r   c                "    t        | t              S r   )r#  ranger#  s    r   is_ranger2  -  s    c5!!r   c                Z    t        t        | t              xr t        | t                      S r   )rO  r#  r  r#  s    r   r'  r'  1  s#    
3$BZT-B)BCCr   c                L    t        |       xs t        |       xs t        |       S r   )r'  r)  r/  r#  s    r   is_index_selectorr5  5  s+     	!% 	(-	#r   c                    t        |       xr# t        |       dkD  xr t        | d   t              xs% t	        |       xs t        |       xs t        |       S r&  )r   rm  r#  rO  r5   r2   is_compliant_series_boolr#  s    r   is_boolean_selectorr8  ?  sW     
!	%	U3s8a<+TJs1vt<T 	)!#&	)"3'	) $C(	r   c                ^    t        t        | t              xr | xr t        | d   |            S r&  )rO  r#  rl  )r  tps     r   
is_list_ofr;  J  s)    
3%H#H*SVR2HIIr   c                &    t        d | D              S )Nc              3  <   K   | ]  }t        |t                y wr   )r;  rO  )r  preds     r   r  z3predicates_contains_list_of_bool.<locals>.<genexpr>R  s     =$z$%=s   any)
predicatess    r    predicates_contains_list_of_boolrB  O  s     =*===r   c                x    t        t        |       xr% t        t        |       d       x}xr t	        ||            S r   )rO  r   r  r  r#  )r  r:  r  s      r   is_sequence_ofrD  U  s>    $ 	"49d++U	"ub! r   c               L    | ||}|S | ||  }|S | |	 |S d}t        |      )Nz,Cannot pass both `strict` and `pass_through`r  )r  r  pass_through_defaultr*  s       r   validate_strict_and_pass_thoughrG  ^  s_     ~,.+  
	 4!z  
L4  =or   r  F)warn_versionrequiredc                     d fd}|S )a8  Decorator to transition from `native_namespace` to `backend` argument.

    Arguments:
        warn_version: Emit a deprecation warning from this version.
        required: Raise when both `native_namespace`, `backend` are `None`.

    Returns:
        Wrapped function, with `native_namespace` **removed**.
    c               6     t               d fd       }|S )Nc                     |j                  dd       }|j                  dd       }||rd}t        |       |}n2||d}t        |      ||rdj                   d}t        |      ||d<    | i |S )Nr$  r  z`native_namespace` is deprecated, please use `backend` instead.

Note: `native_namespace` will remain available in `narwhals.stable.v1`.
See https://narwhals-dev.github.io/narwhals/backcompat/ for more information.
r  z0Can't pass both `native_namespace` and `backend`z `backend` must be specified in `z`.)popr#   r  r   )ro  kwdsr$  r  r*  fnrI  rH  s        r   wrapperz=deprecate_native_namespace.<locals>.decorate.<locals>.wrapper~  s    hhy$/G#xx(:DA+j 
 .cLI*!-'2EH o%!)go(8RH o%%DOt$t$$r   )ro  P.argsrN  P.kwargsr   r   )r   )rO  rP  rI  rH  s   ` r   decoratez,deprecate_native_namespace.<locals>.decorate}  s     	r	% 
	%* r   )rO  Callable[P, R]r   rT  r   )rH  rI  rS  s   `` r   deprecate_native_namespacerU  p  s    2 Or   c                    t        | t        d       t        |t        t        d       d       | dk  rd}t        |      |(|dk  rd}t        |      || kD  rd}t	        |      | |fS | }| |fS )Nwindow_size
param_namemin_samplesrQ  z+window_size must be greater or equal than 1z+min_samples must be greater or equal than 1z6`min_samples` must be less or equal than `window_size`)ensure_typer  r  r  r;   )rW  rZ  r*  s      r   _validate_rolling_argumentsr\    s     S];S$t*GQ;o??CS/!$JC',, ## "##r   c           
        	 t        j                         j                  }|j                         j                         }t        d |D              }|dz   |k  rt        |t        |             }dd|z   d}|t        |       z
  }|dd	|dz  z   |  d	|dz  |dz  z   z   d
z  }|dd|z   d
z  }||z
  dz  }||z
  dz  ||z
  dz  z   }	|D ]$  }
|dd	|z   |
 d	|	|z   t        |
      z
  z   d
z  }& |dd|z   dz  }|S dt        |       z
  }dd dd	|dz  z   |  d	|dz  |dz  z   z   dd d	S # t        $ r# t	        t        j
                  dd            }Y :w xY w)NCOLUMNSP   c              3  2   K   | ]  }t        |        y wr   )rm  )r  lines     r   r  z generate_repr.<locals>.<genexpr>  s     >3t9>   rT  u   ┌u   ─u   ┐
| z|
-u   └u   ┘'   uu   ───────────────────────────────────────u   ┐
|u/   |
| Use `.to_native` to see native output |
└)
osget_terminal_sizer   OSErrorr  getenv
expandtabs
splitlinesmaxrm  )headernative_reprterminal_widthnative_linesmax_native_widthlengthoutputheader_extrastart_extra	end_extrara  diffs               r   generate_reprry    s   7--/77 ))+668L>>>!~-%s6{3uv~&e,F+Ac\Q./0PQ@QT`cdTd@d9e8ffijjAcVn%S)) 00Q6..14AQ8QUV7VV	  	kD#-.tfSIHX<X[^_c[d<d5e4ffijjF	kC's++FD
l^ 419vhsdai$(.B'C&D E9,c	'  7RYYy"567s   D/ /(EEc              h    t        |       j                  |      x}rt        j                  ||      S y r   )r  
differencer9   'from_missing_and_available_column_names)r  r  missings      r   r  r    s;     f+((33w3"JJY
 	
 r   c                *   t        |       t        t        |             k7  rmddlm}  ||       }|j	                         D ci c]  \  }}|dkD  s|| }}}dj                  d |j	                         D              }d| }t        |      y c c}}w )Nr   )CounterrQ  r  c              3  4   K   | ]  \  }}d | d| d  yw)z
- 'z' z timesNr   )r  kr  s      r   r  z0check_column_names_are_unique.<locals>.<genexpr>  s#     LAaS1#V,Ls   z"Expected unique column names, got:)rm  r  collectionsr  r  joinr:   )r   r  r  r  r  
duplicatesr*  s          r   check_column_names_are_uniquer    s    
7|s3w<((''"'.}}@tq!!a%ad@
@ggL9I9I9KLL23%8S!! ) As   BBc                    | h dnt        | t              r| hn
t        |       }|d hn>t        |t        t        f      rt        |      hn|D ch c]  }|t        |      nd  c}}||fS c c}w )N>   smsnsus)r#  r   r  r
   )	time_unit	time_zone
time_unitstz
time_zoness        r   _parse_time_unit_and_time_zoner    s      	  i% [^   
 i#x1 )n<EFbc"gT1F  z!! Gs   A-c                    t        | |j                        xr4 | j                  |v xr$ | j                  |v xs d|v xr | j                  d uS )N*)r#  Datetimer  r  )r  r   r  r  s       r   %dtype_matches_time_unit_and_time_zoner    sW     	5&//* 	
__
*	
 OOz) Cz!AeooT&Ar   c                   | j                   S r   r   )r  s    r   get_column_namesr    s    ==r   c                J    | j                   D cg c]	  }||vs| c}S c c}w r   r  )r  namescol_names      r   exclude_column_namesr  
  s!    %*]]Lhe6KHLLLs   	  c                    d fd}|S )Nc                   S r   r   )_framer  s    r   rO  z$passthrough_column_names.<locals>.fn  s    r   )r  r   r   r   r   )r  rO  s   ` r   passthrough_column_namesr    s     Ir   r   	_SENTINELc                0    t        | |t              t        uS r   )r   r  )r  attrs     r   _hasattr_staticr    s    #tY/y@@r   c                    t        | d      S )N__narwhals_dataframe__r  r#  s    r   is_compliant_dataframer    s     3 899r   c                    t        | d      S )N__narwhals_lazyframe__r  r#  s    r   is_compliant_lazyframer  '  s     3 899r   c                    t        | d      S )N__narwhals_series__r  r#  s    r   r+  r+  -  s     3 566r   c                P    t        |       xr | j                  j                         S r   )r+  r  
is_integerr#  s    r   r(  r(  3  !     s#>		(<(<(>>r   c                P    t        |       xr | j                  j                         S r   )r+  r  
is_booleanr#  s    r   r7  r7  9  r  r   c                6    t        | d      xr t        | d      S )Nr   	_accessorr  r#  s    r   _is_namespace_accessorr  ?  s     3,Rk1RRr   c                   | t         j                  t         j                  t         j                  t         j                  t         j
                  hv S )z.Return True if `impl` allows eager operations.)r   r  r  r  r  r  rg  s    r   is_eager_allowedr  I  sA      r   c               d    | t         j                  t         j                  t         j                  hv S )z4Return True if `LazyFrame.collect(impl)` is allowed.)r   r  r  r  r  s    r   can_lazyframe_collectr  T  s&    N))>+@+@.BXBXYYYr   c                   | t         j                  t         j                  t         j                  t         j                  t         j
                  t         j                  t         j                  hv S )z1Return True if `DataFrame.lazy(impl)` is allowed.)r   r  r  r  r  r  r  r  r  s    r   is_lazy_allowedr  Y  sS    &&  r   c                    t        | d      S )Nr  r  r#  s    r   has_native_namespacer  f  s    3 677r   c                    t        | d      S )N__arrow_c_stream__r  r#  s    r   supports_arrow_c_streamr  j  s    3 455r   c                H      fd|D        }t        t        ||            S )aO  Remap join keys to avoid collisions.

    If left keys collide with the right keys, append the suffix.
    If there's no collision, let the right keys be.

    Arguments:
        left_on: Left keys.
        right_on: Right keys.
        suffix: Suffix to append to right keys.

    Returns:
        A map of old to new right keys.
    c              3  6   K   | ]  }|v r|  n|  y wr   r   )r  keyleft_onsuffixs     r   r  z(_remap_full_join_keys.<locals>.<genexpr>~  s*      8;C7N3%x3r  )dictr  )r  right_onr  right_keys_suffixeds   ` ` r   _remap_full_join_keysr  n  s(     ?G H1233r   c                   t        d      rV|j                  j                  j                  d      j                  }|j
                  j                  | |      j                  S dt        |       d}t        |      )zGuards `ArrowDataFrame.from_arrow` w/ safer imports.

    Arguments:
        data: Object which implements `__arrow_c_stream__`.
        context: Initialized compliant object.
    r  )contextzB'pyarrow>=14.0.0' is required for `from_arrow` for object of type r  )
r   r   r   r%  r   
_dataframe
from_arrowr   rw  ModuleNotFoundError)datar  r  r*  s       r   _into_arrow_tabler    sp     ''44Y?II}}''b'9@@@NObcgOhNkkl
mC
c
""r   c                   | S )a  Visual-only marker for unstable functionality.

    Arguments:
        fn: Function to decorate.

    Returns:
        Decorated function (unchanged).

    Examples:
        >>> from narwhals._utils import unstable
        >>> @unstable
        ... def a_work_in_progress_feature(*args):
        ...     return args
        >>>
        >>> a_work_in_progress_feature.__name__
        'a_work_in_progress_feature'
        >>> a_work_in_progress_feature(1, 2, 3)
        (1, 2, 3)
    r   )rO  s    r   unstabler    s	    ( Ir   c                .     t         fddD               S )a  Determines if a datetime format string is 'naive', i.e., does not include timezone information.

    A format is considered naive if it does not contain any of the following

    - '%s': Unix timestamp
    - '%z': UTC offset
    - 'Z' : UTC timezone designator

    Arguments:
        format: The datetime format string to check.

    Returns:
        bool: True if the format is naive (does not include timezone info), False otherwise.
    c              3  &   K   | ]  }|v  
 y wr   r   )r  xformats     r   r  z#_is_naive_format.<locals>.<genexpr>  s     :11;:s   )z%sz%zZr?  )r  s   `r   _is_naive_formatr    s     :(9::::r   c                  Z    e Zd ZdZd	d
dZddZddZ	 d		 	 	 	 	 ddZddZe	dd       Z
y)not_implementeda  Mark some functionality as unsupported.

    Arguments:
        alias: optional name used instead of the data model hook [`__set_name__`].

    Returns:
        An exception-raising [descriptor].

    Notes:
        - Attribute/method name *doesn't* need to be declared twice
        - Allows different behavior when looked up on the class vs instance
        - Allows us to use `isinstance(...)` instead of monkeypatching an attribute to the function

    Examples:
        >>> from narwhals._utils import not_implemented
        >>> class Thing:
        ...     def totally_ready(self) -> str:
        ...         return "I'm ready!"
        ...
        ...     not_ready_yet = not_implemented()
        >>>
        >>> thing = Thing()
        >>> thing.totally_ready()
        "I'm ready!"
        >>> thing.not_ready_yet()
        Traceback (most recent call last):
            ...
        NotImplementedError: 'not_ready_yet' is not implemented for: 'Thing'.
        ...
        >>> isinstance(Thing.not_ready_yet, not_implemented)
        True

    [`__set_name__`]: https://docs.python.org/3/reference/datamodel.html#object.__set_name__
    [descriptor]: https://docs.python.org/3/howto/descriptor.html
    Nc                   || _         y r   )_alias)r   aliass     r   __init__znot_implemented.__init__  s     #(r   c                f    dt        |       j                   d| j                   d| j                   S )N<z>: r  )r  r   _name_owner_namer   s    r   __repr__znot_implemented.__repr__  s1    4:&&'s4+;+;*<Adjj\JJr   c                P    |j                   | _        | j                  xs || _        y r   )r   r  r  r  r   r   names      r   __set_name__znot_implemented.__set_name__  s     %++-
r   c                   || S t        |dt        j                        }|t        j                  urt        |      }n| j                  }t        | j                  |       y )Nr   )r  r   r  reprr  _raise_not_implemented_errorr  )r   r   r   rf  whos        r   r   znot_implemented.__get__  s\      K !+<n>T>TU!7!77~&C""C$TZZ5r   c                $    | j                  d      S )Nraise)r   )r   ro  rN  s      r   __call__znot_implemented.__call__  s     ||G$$r   c               2     |        } t        |      |      S )zAlt constructor, wraps with `@deprecated`.

        Arguments:
            message: **Static-only** deprecation message, emitted in an IDE.

        [descriptor]: https://docs.python.org/3/howto/descriptor.html
        )r%   )r  messager  s      r   r%   znot_implemented.deprecated  s     e"z'"3''r   r   )r  z
str | Noner   r   rM  )r   type[_T]r  r   r   r   )r   z_T | Literal['raise'] | Noner   ztype[_T] | Noner   r   )ro  r   rN  r   r   r   )r  r?   r   rA   )r   r   r   r   r  r  r  r   r  rP  r%   r   r   r   r  r    sU    "H(
K. PT4=L	$%
 	( 	(r   r  c               (    | d|d}t        |      )Nz is not implemented for: z.

If you would like to see this functionality in `narwhals`, please open an issue at: https://github.com/narwhals-dev/narwhals/issues)NotImplementedError)whatr  r*  s      r   r  r    s,    (+C7 3S 	S 
 c
""r   c                      e Zd ZU dZded<   ded<   ded<   	 eddd       Zedd       Zdd	Z	dd
Z
ddZ	 	 	 	 ddZy)requiresa#  Method decorator for raising under certain constraints.

    Attributes:
        _min_version: Minimum backend version.
        _hint: Optional suggested alternative.

    Examples:
        >>> from narwhals._utils import requires, Implementation
        >>> class SomeBackend:
        ...     _implementation = Implementation.PYARROW
        ...     _backend_version = 20, 0, 0
        ...
        ...     @requires.backend_version((9000, 0, 0))
        ...     def really_complex_feature(self) -> str:
        ...         return "hello"
        >>> backend = SomeBackend()
        >>> backend.really_complex_feature()
        Traceback (most recent call last):
            ...
        NotImplementedError: `really_complex_feature` is only available in 'pyarrow>=9000.0.0', found version '20.0.0'.
    r   _min_versionr   _hint_wrapped_namec               D    | j                  |       }||_        ||_        |S )zMethod decorator for raising below a minimum `_backend_version`.

        Arguments:
            minimum: Minimum backend version.
            hint: Optional suggested alternative.
        )__new__r  r  )r  minimumhintr  s       r   rL  zrequires.backend_version;  s&     kk#"	
r   c               2    dj                  d | D              S )Nr  c              3  "   K   | ]  }|  	 y wr   r   )r  ds     r   r  z,requires._unparse_version.<locals>.<genexpr>J  s     811#8s   )r  rK  s    r   _unparse_versionzrequires._unparse_versionH  s    xx8888r   c               N    d| j                   vr| d| j                    | _         y y Nr  )r  )r   r  s     r   _qualify_accessor_namezrequires._qualify_accessor_nameL  s/    d((($*81T-?-?,@!AD )r   c                   t        |      r(| j                  |j                         |j                  }n|}|j                  t        |j                        fS r   )r  r  r  r   r   r   r   )r   r   r   s      r   _unwrap_contextzrequires._unwrap_contextQ  sJ    !(+''(:(:; **I I))3y/H/H+IIIr   c          	     $   | j                  |      \  }}|| j                  k\  ry | j                  | j                        }| j                  |      }d| j                   d| d| d|d	}| j                  r| d| j                   }t        |      )N`z` is only available in 'z>=z', found version r  
)r  r  r  r  r  r  )r   r   ri  r$  r  foundr*  s          r   _ensure_versionzrequires._ensure_versionY  s    //9d'''''(9(9:%%g.$$$%%=gYb	Qbchbkklm::EDJJ<(C!#&&r   c               V     j                    _        t              d fd       }|S )Nc                >    j                  |         | g|i |S r   )r  )r   ro  rN  rO  r   s      r   rP  z"requires.__call__.<locals>.wrapperi  s&      *h....r   )r   r   ro  rQ  rN  rR  r   r   )r   r  r   )r   rO  rP  s   `` r   r  zrequires.__call__d  s.      [[	r	/ 
	/
 r   N)r  )r  r   r  r   r   rA   )rL  r   r   r   )r  rH   r   r   )r   r   r   ztuple[tuple[int, ...], str])r   r   r   r   )rO  _Method[_IntoContextT, P, R]r   r  )r   r   r   r   r   rP  rL  staticmethodr  r  r  r  r  r   r   r   r  r    sm    , "!J
 
 
 9 9B
J	'.	%r   r  c                    | j                   |j                  | j                         nd }| j                  |j                  | j                        dz   nd }| j                  }|||fS )NrQ  )r  r  r  r  )	str_slicer   r  r  r  s        r   convert_str_slice_to_int_slicer  r  sZ     /8oo.IGMM)//*tE090J7==(1,PTD>>D4r   c                    d fd}|S )zSteal the class-level docstring from parent and attach to child `__init__`.

    Returns:
        Decorated constructor.

    Notes:
        - Passes static typing (mostly)
        - Passes at runtime
    c                   | j                   dk(  r+t        t              t              rt              | _        | S dt
        j                    d| j                  d}t        |      )Nr  z`@zL` is only allowed to decorate an `__init__` with a class-level doc.
Method: z	
Parent: )r   r  r  r   r   inherit_docr   rx  )
init_childr*  	tp_parents     r   rS  zinherit_doc.<locals>.decorate  sp    *,DOT1R!'	!2J%%& '!..1 2 m% 	
 nr   )r  _Constructor[_T, P, R2]r   r  r   )r  rS  s   ` r   r  r  {  s    	 Or   c                   t        | t              r| n
t        |       }|j                  dk7  r|j                  nd}| d|j                   j	                  d      S )Nbuiltinsr  r  )r#  r  r   r   lstrip)r  r:  modules      r   rw  rw    sL    3%49B mmz9R]]rFXQr{{m$++C00r   rX  c              :   t        | |      sdj                  d |D              }d|dt        |       }|rYd}t        |       }t	        |      dkD  rt        |        d}| | d}d	t	        |      z  d
t	        |      z  z   }| d| | d| }t        |      y)a  Validate that an object is an instance of one or more specified types.

    Parameters:
        obj: The object to validate.
        *valid_types: One or more valid types that `obj` is expected to match.
        param_name: The name of the parameter being validated.
            Used to improve error message clarity.

    Raises:
        TypeError: If `obj` is not an instance of any of the provided `valid_types`.

    Examples:
        >>> from narwhals._utils import ensure_type
        >>> ensure_type(42, int, float)
        >>> ensure_type("hello", str)

        >>> ensure_type("hello", int, param_name="test")
        Traceback (most recent call last):
            ...
        TypeError: Expected 'int', got: 'str'
            test='hello'
                 ^^^^^^^
        >>> import polars as pl
        >>> import pandas as pd
        >>> df = pl.DataFrame([[1], [2], [3], [4], [5]], schema=[*"abcde"])
        >>> ensure_type(df, pd.DataFrame, param_name="df")
        Traceback (most recent call last):
            ...
        TypeError: Expected 'pandas.core.frame.DataFrame', got: 'polars.dataframe.frame.DataFrame'
            df=polars.dataframe.frame.DataFrame(...)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    z | c              3  2   K   | ]  }t        |        y wr   )rw  )r  r:  s     r   r  zensure_type.<locals>.<genexpr>  s     L"1"5Lrb  z	Expected z, got: z    (   z(...)=rd  ^r	  N)r#  r  rw  r  rm  rx  )	r  rY  valid_typestp_namesr*  left_padr}  assign	underlines	            r   r[  r[    s    B c;'::LLL(W-@-E,HIHs)C3x"},S12%8 z*Q/Fs6{*sSX~>IEF8C59+6Cn (r   c                  (    e Zd ZdZddZddZddZy)	_DeferredIterablezLStore a callable producing an iterable to defer collection until we need it.c                   || _         y r   
_into_iter)r   	into_iters     r   r  z_DeferredIterable.__init__  s	    6?r   c              #  @   K   | j                         E d {    y 7 wr   r*  r   s    r   __iter__z_DeferredIterable.__iter__  s     ??$$$s   c                \    | j                         }t        |t              r|S t        |      S r   )r+  r#  rr  )r   its     r   to_tuplez_DeferredIterable.to_tuple  s&    __E*r9b	9r   N)r,  zCallable[[], Iterable[_T]]r   r   )r   zIterator[_T])r   ztuple[_T, ...])r   r   r   r   r  r.  r1  r   r   r   r(  r(    s    V@%:r   r(  @   c                J    |rdj                  | g|      n| }t        |      S r  )r  r   )r  nestedr  s      r   deep_attrgetterr5    s%    (.388TOFO$DDdr   c                &     t        |g| |       S )z+Perform a nested attribute lookup on `obj`.)r5  )r  name_1r4  s      r   deep_getattrr8    s    +?6+F+C00r   c                      e Zd Zy)	CompliantN)r   r   r   r   r   r   r:  r:    s    r   r:  c                  "    e Zd ZdZedd       Zy)Narwhalsa  Minimal *Narwhals-level* protocol.

    Provides access to a compliant object:

        obj: Narwhals[NativeT_co]]
        compliant: Compliant[NativeT_co] = obj._compliant

    Which itself exposes:

        implementation: Implementation = compliant.implementation
        native: NativeT_co = compliant.native

    This interface is used for revealing which `Implementation` member is associated with **either**:
    - One or more [nominal] native type(s)
    - One or more [structural] type(s)
      - where the true native type(s) are [assignable to] *at least* one of them

    These relationships are defined in the `@overload`s of `_Implementation.__get__(...)`.

    [nominal]: https://typing.python.org/en/latest/spec/glossary.html#term-nominal
    [structural]: https://typing.python.org/en/latest/spec/glossary.html#term-structural
    [assignable to]: https://typing.python.org/en/latest/spec/glossary.html#term-assignable
    c                     y r   r   r   s    r   r  zNarwhals._compliant  s    36r   N)r   zCompliant[NativeT_co])r   r   r   r   r   r  r   r   r   r<  r<    s    0 6 6r   r<  c                  j   e Zd ZdZddZedd       Zedd       Zedd       Zedd       Ze	 	 	 	 	 	 dd       Zedd       Ze	 	 	 	 	 	 dd	       Zedd
       Ze	 	 	 	 	 	 dd       Zedd       Zedd       Ze	 	 	 	 	 	 d d       Zed!d       Ze	 	 	 	 	 	 d"d       Zed#d       Zd$dZy)%_ImplementationzDescriptor for matching an opaque `Implementation` on a generic class.

    Based on [pyright comment](https://github.com/microsoft/pyright/issues/3071#issuecomment-1043978070)
    c                    || _         y r   )r   r  s      r   r  z_Implementation.__set_name__  s	    !r   c                     y r   r   r   s      r   r   z_Implementation.__get__      TWr   c                     y r   r   r   s      r   r   z_Implementation.__get__  rB  r   c                     y r   r   r   s      r   r   z_Implementation.__get__      RUr   c                     y r   r   r   s      r   r   z_Implementation.__get__      PSr   c                     y r   r   r   s      r   r   z_Implementation.__get__  s     r   c                     y r   r   r   s      r   r   z_Implementation.__get__  rE  r   c                     y r   r   r   s      r   r   z_Implementation.__get__  s     25r   c                     y r   r   r   s      r   r   z_Implementation.__get__"  rB  r   c                     y r   r   r   s      r   r   z_Implementation.__get__$  s     r   c                     y r   r   r   s      r   r   z_Implementation.__get__(  rG  r   c                     y r   r   r   s      r   r   z_Implementation.__get__*  rG  r   c                     y r   r   r   s      r   r   z_Implementation.__get__,  s     .1r   c                     y r   r   r   s      r   r   z_Implementation.__get__1  s    KNr   c                     y r   r   r   s      r   r   z_Implementation.__get__3  r  r   c                     y r   r   r   s      r   r   z_Implementation.__get__7  s    QTr   c                6    || S |j                   j                  S r   )r  r   r   s      r   r   z_Implementation.__get__9  s    'tPX-@-@-P-PPr   N)r   	type[Any]r  r   r   r   )r   zNarwhals[NativePolars]r   r   r   rj   )r   zNarwhals[NativePandas]r   r   r   rh   )r   zNarwhals[NativeModin]r   r   r   rg   )r   zNarwhals[NativeCuDF]r   r   r   r`   )r   zNarwhals[NativePandasLike]r   r   r   ri   )r   zNarwhals[NativeArrow]r   r   r   r_   )r   z3Narwhals[NativePolars | NativeArrow | NativePandas]r   r   r   z&_PolarsImpl | _PandasImpl | _ArrowImpl)r   zNarwhals[NativeDuckDB]r   r   r   rb   )r   zNarwhals[NativeSQLFrame]r   r   r   rm   )r   zNarwhals[NativeDask]r   r   r   ra   )r   zNarwhals[NativeIbis]r   r   r   rd   )r   z.Narwhals[NativePySpark | NativePySparkConnect]r   r   r   z"_PySparkImpl | _PySparkConnectImpl)r   r   r   ztype[Narwhals[Any]]r   rA   )r   zDataFrame[Any] | Series[Any]r   r   r   rc   )r   zLazyFrame[Any]r   r   r   re   )r   zNarwhals[Any] | Noner   r   r   r   )r   r   r   r   r  r!   r   r   r   r   r?  r?    s|   
" W WW WU US S2;>	  U U5K5TW5	/5 5 W W09<	  S SS S1F1OR1	+1 1 N N 4 =@ 	    T TQr   r?  c                p    dd l }t        | |j                        r|j                  j	                  |       S | S r&  )r  r#  RecordBatchReaderTablefrom_batches)tblpas     r   to_pyarrow_tabler[  =  s/    #r++,xx$$S))Jr   c               T    t        | t              r| S ddlm} t         ||             S )Nr   )Path)r#  r   pathlibr]  )sourcer]  s     r   normalize_pathr`  E  s#    &#tF|r   c                D    t        | t              r| f|z  S t        |       S )zEnsure the given bool or sequence of bools is the correct length.

    Stolen from https://github.com/pola-rs/polars/blob/b8bfb07a4a37a8d449d6d1841e345817431142df/py-polars/polars/_utils/various.py#L580-L594
    )r#  rO  rr  )r
  n_matchs     r   extend_boolrc  M  s#     ",E4!8E8gJeElJr   c                      e Zd ZdZddZy)
_NoDefault
NO_DEFAULTc                     y)Nz<no_default>r   r   s    r   r  z_NoDefault.__repr__]  s    r   NrM  )r   r   r   
no_defaultr  r   r   r   re  re  X  s     Jr   re  )r+  r   r   r=   )rf  r   r   r   )ro  r   r   z	list[Any])rs  r   r   r   )rs  zAny | Iterable[Any]r   rO  )r}  zIterable[_T] | Anyr   zTypeIs[Iterator[_T]])ri  z#str | ModuleType | _SupportsVersionr   r   )r  r  r  r  r   zTypeIs[type[_T]])r  object | typer  r  r   zTypeIs[_T | type[_T]])r  r  r  tuple[type[_T1], type[_T2]]r   zTypeIs[type[_T1 | _T2]])r  ri  r  rj  r   z#TypeIs[_T1 | _T2 | type[_T1 | _T2]])r  r  r  &tuple[type[_T1], type[_T2], type[_T3]]r   zTypeIs[type[_T1 | _T2 | _T3]])r  ri  r  rk  r   z/TypeIs[_T1 | _T2 | _T3 | type[_T1 | _T2 | _T3]])r  r   r  ztuple[type, ...]r   zTypeIs[Any])r  r   r  r   r   rO  )r  Iterable[Any]r   r   )r  r   r  z-Series[Any] | DataFrame[Any] | LazyFrame[Any]r   r   )r  z-DataFrame[Any] | LazyFrame[Any] | Series[Any]r   r   r   )r  r   r  zstr | list[str] | Noner  z6Series[IntoSeriesT] | list[Series[IntoSeriesT]] | Noner   r   )r  r   r   r   )r  rl  r   zIterable[tuple[Any, ...]])r  r   r  r   r   zTypeIs[pd.RangeIndex])r  zpd.Series[Any] | pd.DataFramer  r   r   rO  )r  r   ro  rO  r  z
bool | strr   r   )r  r  r  r   r   zint | float)r   zSeries[Any]r   rO  )nw)r  r  r   Container[str]r  r   r   r   )r  r   r  zIterable[str]r  rO  r   z	list[str])r  Sequence[_T] | Anyr   TypeIs[Sequence[_T]])r  r   r   zTypeIs[_SliceNone])r  r   r   zCTypeIs[SizedMultiIndexSelector[Series[Any] | CompliantSeries[Any]]])r  ro  r   z-TypeIs[Sequence[_T] | Series[Any] | _1DArray])r  r   r   zTypeIs[_SliceIndex])r  r   r   zTypeIs[range])r  r   r   zTypeIs[SingleIndexSelector])r  r   r   zTTypeIs[SingleIndexSelector | MultiIndexSelector[Series[Any] | CompliantSeries[Any]]])r  r   r   zBTypeIs[SizedMultiBoolSelector[Series[Any] | CompliantSeries[Any]]])r  r   r:  r  r   zTypeIs[list[_T]])rA  zCollection[Any]r   zTypeIs[Collection[list[bool]]])r  r   r:  r  r   rp  )r  bool | Noner  rq  rF  rO  r   rO  )rH  r   rI  rO  r   z*Callable[[Callable[P, R]], Callable[P, R]])rW  r  rZ  z
int | Noner   ztuple[int, int])rn  r   ro  r   r   r   )r  Collection[str]r  rr  r   zColumnNotFoundError | None)r   rr  r   r   )r  z$TimeUnit | Iterable[TimeUnit] | Noner  z7str | timezone | Iterable[str | timezone | None] | Noner   z%tuple[Set[TimeUnit], Set[str | None]])
r  rr   r   rx   r  zSet[TimeUnit]r  zSet[str | None]r   rO  )r  r   r   r   )r  r   r  rn  r   r   )r  r   r   zEvalNames[Any])r  r   r  r   r   rO  )r  z\CompliantDataFrame[CompliantSeriesT, CompliantExprT, NativeDataFrameT, ToNarwhalsT_co] | Anyr   z^TypeIs[CompliantDataFrame[CompliantSeriesT, CompliantExprT, NativeDataFrameT, ToNarwhalsT_co]])r  zJCompliantLazyFrame[CompliantExprT, NativeLazyFrameT, ToNarwhalsT_co] | Anyr   zLTypeIs[CompliantLazyFrame[CompliantExprT, NativeLazyFrameT, ToNarwhalsT_co]])r  z'CompliantSeries[NativeSeriesT_co] | Anyr   z)TypeIs[CompliantSeries[NativeSeriesT_co]])r  r   r   z'TypeIs[NamespaceAccessor[_FullContext]])rg  r   r   zTypeIs[_EagerAllowedImpl])rg  r   r   zTypeIs[_LazyFrameCollectImpl])rg  r   r   zTypeIs[_LazyAllowedImpl])r  r   r   zTypeIs[SupportsNativeNamespace])r  r   r   zTypeIs[ArrowStreamExportable])r  rr  r  rr  r  r   r   zdict[str, str])r  r[   r  r   r   pa.Table)rO  r   r   r   )r  r   r   rO  )r  r   r  r   r   r  )r  r   r   r   r   z"tuple[int | None, int | None, Any])r  zCallable[P, R1]r   z<Callable[[_Constructor[_T, P, R2]], _Constructor[_T, P, R2]])r  zobject | type[Any]r   r   )r  r   r"  rT  rY  r   r   r   )r  r   r4  r   r   zattrgetter[Any])r  r   r7  r   r4  r   r   r   )rY  zpa.Table | pa.RecordBatchReaderr   rs  )r_  ry   r   r   )r
  zbool | Iterable[bool]rb  r  r   zSequence[bool]('  
__future__r   rg  r  syscollections.abcr   r   r   r   r   r	   datetimer
   enumr   r   	functoolsr   r   r   r   importlib.utilr   inspectr   r   	itertoolsr   operatorr   secretsr   typingr   r   r   r   r   r   r   r   r   r    r!   narwhals._enumr"   narwhals._exceptionsr#   narwhals._typing_compatr$   r%   narwhals.dependenciesr&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   narwhals.exceptionsr9   r:   r;   r<   typesr=   r   rz  r  r{  r  rZ  typing_extensionsr>   r?   r@   rA   rB   rC   narwhals._compliantrD   rE   rF   !narwhals._compliant.any_namespacerG   narwhals._compliant.typingrH   rI   rJ   rK   r   rM   narwhals._nativerN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   narwhals._translaterZ   r[   r\   narwhals._typingr]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   r   ro   rp   r  rr   r   rt   narwhals.typingru   rv   rw   rx   ry   rz   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  r  r  r  r]  r(  r)  rL  rp  rt  rn  r~  re  r  r  r  r  r  r  r  r  version_infor  r  r  r  r	  r  r  r  r   r$  r)  r,  r/  r2  r'  r5  r8  r;  rB  rD  rG  rU  r\  ry  r  r  r  r  r  r  r  objectr  r  r  r  r+  r(  r7  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rw  r[  r(  r5  r8  r:  r<  r?  r[  r`  rc  re  rh  r  r.  r   r   r   <module>r     s	   " 	 	 
 X X   6 6 $ *       & : <     * [ Z#   WVC  .    ZY    & 8%&    ( %(	'ininfSk&Q RN %.C
%.C
%.C
%3
4C#AA	B	B8 Rx R0 0
 T]\T2
48Ji J|<A A<i <HZ( x. H -X -
JH J
+^X (*? 	42H 	4Id IXM%Z M%b 9)EF""F:6Z:6  ).M""$9	@  <  D 2& &  <QS*%L 
$, 

 
  -5   
 
 
""$?"" 
"
 
..-H.(. 
.
 
(($J("( 
(
 
::-S:4: 
:
 
#3 

Y	YKYYxF ,0S EI	S	S(S B	S
 Sl,^ T*J
7"S.
	8<8	9	MP			&*	&* $&*0:&*&*R*?F :>[[)[36[[ :>*&*&)*&36*&*&Z#0@DL9	H	2	"D	Y	GJ
>>#> 	
 
& &&)-&/&R$$#-$$0<.=""3"F" +"*

 
.;
IX
	
M 8	5 A:

:
::	S:Q:7	07.7?	0?.??	0?.?SZ

8644(74AD44,# .;$S( S(l#S Sl$1'A61 IK ,^: : 2 
1
*4hz6J
7x
# 7:3Q 3QlK KK K  ""
 :r   