
    Lpjd                       S SK Jr  S SKrS SKJrJr  S SKJr  \(       ah  S SKJr  S SK	r	S SK
Jr  S SKrS SKrS SKJr  S SKrS SKrS SKrS SKJr  S SKJr  S SKJr  S SKJ r   S S	K!JrJ"r"  S S
K#J$r$  S SK%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/  \0" S/5      r1ScS jr2ScS jr3ScS jr4ScS jr5ScS jr6ScS jr7ScS jr8ScS jr9ScS jr:ScS jr;ScS jr<ScS jr=ScS jr>ScS jr?ScS jr@ScS jrASdS jrBSeS jrCSfS jrDSfS  jrESgS! jrFSgS" jrGShS# jrHSiS$ jrISiS% jrJSjS& jrKSjS' jrLSkS( jrMSlS) jrNSlS* jrOSmS+ jrPSmS, jrQSnS- jrRSoS. jrSSpS/ jrTSpS0 jrUSqS1 jrVSqS2 jrWSrS3 jrXSrS4 jrYSsS5 jrZSsS6 jr[StS7 jr\StS8 jr]SuS9 jr^SuS: jr_SvS; jr`SwS< jraSxS= jrbSxS> jrcSyS? jrdSyS@ jreSzSA jrfS{SB jrgS|SC jrhS}SD jriS}SE jrjS~SF jrkS~SG jrlSSH jrmSSI jrnSSJ jroSSK jrpSSL jrqSSM jrrSSN jrsSSO jrtSSP jruSSQ jrvSSR jrwSSS jrxSST jrySSU jrz    SSV jr{SSW jr|SSX jr}SSY jr~SSZ jrSS[ jrSS\ jr    SS] jr    SS^ jrSS_ jrSS` jr    SSa jr/ SbQrg)    )annotationsN)TYPE_CHECKINGAny)issue_warning)	TypeGuard	DataFrame)TypeIs)SQLFrameDataFrame)r	   	LazyFrameSeries)
IntoDataFrameTIntoLazyFrameTIntoSeriesTPandasLikeDType_1DArray_1DArrayInt_2DArray_NDArray_NumpyScalar_ShapeT	fireducksc                 B    [         R                  R                  SS5      $ )z;Get Polars module (if already imported - else return None).polarsNsysmodulesget     Q/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/narwhals/dependencies.py
get_polarsr#   1       ;;??8T**r!   c                 B    [         R                  R                  SS5      $ )z;Get pandas module (if already imported - else return None).pandasNr   r    r!   r"   
get_pandasr'   6   r$   r!   c                 B    [         R                  R                  SS5      $ )zAGet modin.pandas module (if already imported - else return None).zmodin.pandasNr   r    r!   r"   	get_modinr)   ;   s    ;;??>400r!   c                 B    [         R                  R                  SS5      $ )z9Get cudf module (if already imported - else return None).cudfNr   r    r!   r"   get_cudfr,   @       ;;??64((r!   c                 B    [         R                  R                  SS5      $ )z9Get cupy module (if already imported - else return None).cupyNr   r    r!   r"   get_cupyr0   E   r-   r!   c                 B    [         R                  R                  SS5      $ )z<Get pyarrow module (if already imported - else return None).pyarrowNr   r    r!   r"   get_pyarrowr3   J       ;;??9d++r!   c                 B    [         R                  R                  SS5      $ )z:Get numpy module (if already imported - else return None).numpyNr   r    r!   r"   	get_numpyr7   O   s    ;;??7D))r!   c                 B    [         R                  R                  SS5      $ )z2Get dask (if already imported - else return None).daskNr   r    r!   r"   get_daskr:   T   r-   r!   c                 B    [         R                  R                  SS5      $ )zCGet dask.dataframe module (if already imported - else return None).zdask.dataframeNr   r    r!   r"   get_dask_dataframer<   Y   s    ;;??+T22r!   c                 B    [         R                  R                  SS5      $ )z;Get duckdb module (if already imported - else return None).duckdbNr   r    r!   r"   
get_duckdbr?   ^   r$   r!   c                 B    [         R                  R                  SS5      $ )z9Get ibis module (if already imported - else return None).ibisNr   r    r!   r"   get_ibisrB   c   r-   r!   c                     [        5       =n b  [        U S5      (       a  U R                  $ [        R                  R                  SS5      $ )z>Get dask_expr module (if already imported - else return None).N	dask_expr)r<   hasattrrD   r   r   r   )dds    r"   get_dask_exprrG   h   s;     ""/GB4L4L||;;??;--r!   c                 B    [         R                  R                  SS5      $ )z<Get pyspark module (if already imported - else return None).pysparkNr   r    r!   r"   get_pysparkrJ   o   r4   r!   c                 B    [         R                  R                  SS5      $ )z@Get pyspark.sql module (if already imported - else return None).zpyspark.sqlNr   r    r!   r"   get_pyspark_sqlrL   t   s    ;;??=$//r!   c                 B    [         R                  R                  SS5      $ )zHGet pyspark.sql.connect module (if already imported - else return None).zpyspark.sql.connectNr   r    r!   r"   get_pyspark_connectrN   y   s    ;;??0$77r!   c                 B    [         R                  R                  SS5      $ )z=Get sqlframe module (if already imported - else return None).sqlframeNr   r    r!   r"   get_sqlframerQ   ~   s    ;;??:t,,r!   c          	         [        U 5      (       d  [        U 5      (       aV  SSKJn  [        R
                  " S5      R                  R                  nSU" U 5       SU SU SU S3	n[        U[        5        g g )	Nr   qualified_type_name   You passed a `` to ``.

Hint: Instead of e.g. `z(frame)`, did you mean `z(frame.to_native())`?)
is_narwhals_dataframeis_narwhals_lazyframenarwhals._utilsrT   r   	_getframef_codeco_namer   UserWarning)framerT   callermsgs       r"   _warn_if_narwhals_df_or_lfrc      s}    U##'<U'C'C7q!((00078vh G&&,X .#H$9; 	
 	c;' (Dr!   c          	         [        U 5      (       aV  SSKJn  [        R                  " S5      R
                  R                  nSU" U 5       SU SU SU S3	n[        U[        5        g g )	Nr   rS   rU   rV   rW   rX   z(ser)`, did you mean `z(ser.to_native())`?)	is_narwhals_seriesr[   rT   r   r\   r]   r^   r   r_   )serrT   ra   rb   s       r"   _warn_if_narwhals_seriesrg      sq    #7q!((00056fVH E&&,X .#H$79 	
 	c;' r!   c                   ^ ^ [        5       =nSL=(       a    [        T UR                  5      =(       d    [        U U4S j[         5       5      $ )zBCheck whether `df` is a pandas DataFrame without importing pandas.Nc              3     >#    U  HP  n[         R                  R                  US 5      =mS L=(       a     [        TTR                  R
                  5      v   MR     g 7fN)r   r   r   
isinstancer&   r	   ).0module_namedfmods     r"   	<genexpr>'_is_pandas_dataframe.<locals>.<genexpr>   sR      V (K T2	24? 	1r3:://0	1'   AA)r'   rk   r	   anyIMPORT_HOOKS)rn   pdro   s   ` @r"   _is_pandas_dataframerv      sF    <R,MB1M RU V (V S r!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a pandas DataFrame without importing pandas.

Warning:
    This method cannot be called on a Narwhals DataFrame/LazyFrame.
)rc   rv   rn   s    r"   is_pandas_dataframery           r"##r!   c                   ^ ^ [        5       =nSL=(       a    [        T UR                  5      =(       d    [        UU 4S j[         5       5      $ )z@Check whether `ser` is a pandas Series without importing pandas.Nc              3     >#    U  HP  n[         R                  R                  US 5      =mS L=(       a     [        TTR                  R
                  5      v   MR     g 7frj   )r   r   r   rk   r&   r   )rl   rm   ro   rf   s     r"   rp   $_is_pandas_series.<locals>.<genexpr>   sR      T (K T2	24? 	/sCJJ--.	/'rr   )r'   rk   r   rs   rt   )rf   ru   ro   s   ` @r"   _is_pandas_seriesr~      sF    <R,KC1K PS T (T Q r!   c                .    [        U 5        [        U 5      $ )zCheck whether `ser` is a pandas Series without importing pandas.

Warning:
    This method cannot be called on Narwhals Series.
)rg   r~   rf   s    r"   is_pandas_seriesr           S!S!!r!   c                   ^ ^ [        5       =nSL=(       a    [        T UR                  5      =(       d    [        U U4S j[         5       5      $ )zACheck whether `index` is a pandas Index without importing pandas.Nc              3     >#    U  HP  n[         R                  R                  US 5      =mS L=(       a     [        TTR                  R
                  5      v   MR     g 7frj   )r   r   r   rk   r&   Index)rl   rm   indexro   s     r"   rp   "is_pandas_index.<locals>.<genexpr>   sR      U (K T2	24? 	0ucjj../	0'rr   )r'   rk   r   rs   rt   )r   ru   ro   s   ` @r"   is_pandas_indexr      sF    <R,LE2881L QT U (U R r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )z@Check whether `df` is a modin DataFrame without importing modin.N)r)   rk   r	   )rn   mpds     r"   _is_modin_dataframer      s"    ;Ct+M
2}}0MMr!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a modin DataFrame without importing modin.

Warning:
    This method cannot be called on a Narwhals DataFrame/LazyFrame.
)rc   r   rx   s    r"   is_modin_dataframer           r"r""r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )z>Check whether `ser` is a modin Series without importing modin.N)r)   rk   r   )rf   r   s     r"   _is_modin_seriesr      s"    ;Ct+K
3

0KKr!   c                .    [        U 5        [        U 5      $ )z~Check whether `ser` is a modin Series without importing modin.

Warning:
    This method cannot be called on Narwhals Series.
)rg   r   r   s    r"   is_modin_seriesr      s     S!C  r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )z?Check whether `index` is a modin Index without importing modin.N)r)   rk   r   )r   r   s     r"   is_modin_indexr      s"    ;Ct+L
5))0LLr!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )z>Check whether `df` is a cudf DataFrame without importing cudf.N)r,   rk   r	   )rn   r+   s     r"   _is_cudf_dataframer      s"    JDt+N
2~~0NNr!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a cudf DataFrame without importing cudf.

Warning:
    This method cannot be called on a Narwhals DataFrame/LazyFrame.
)rc   r   rx   s    r"   is_cudf_dataframer           r"b!!r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )z<Check whether `ser` is a cudf Series without importing cudf.N)r,   rk   r   )rf   r+   s     r"   _is_cudf_seriesr      s"    JDt+L
30LLr!   c                .    [        U 5        [        U 5      $ )z|Check whether `ser` is a cudf Series without importing cudf.

Warning:
    This method cannot be called on Narwhals Series.
)rg   r   r   s    r"   is_cudf_seriesr     s     S!3r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )z=Check whether `index` is a cudf Index without importing cudf.N)r,   rk   r   )r   r+   s     r"   is_cudf_indexr     s)    JDt+ 
zz1 r!   c                    [        5       =nS L=(       a+    [        XR                  5      =(       a    U R                  S:H  $ )NrU   )r0   rk   ndarraysize)objr/   s     r"   is_cupy_scalarr     s7    	D( 	sLL)	HHMr!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )z>Check whether `df` is a Dask DataFrame without importing Dask.N)r<   rk   r	   )rn   rF   s     r"   _is_dask_dataframer     s#    $&&Bt3T
2||8TTr!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a Dask DataFrame without importing Dask.

Warning:
    This method cannot be called on a Narwhals DataFrame/LazyFrame.
)rc   r   rx   s    r"   is_dask_dataframer   !  r   r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )zACheck whether `df` is a DuckDB Relation without importing DuckDB.N)r?   rk   DuckDBPyRelation)rn   r>   s     r"   _is_duckdb_relationr   +  s+     l"F4/ J
##5 r!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a DuckDB Relation without importing DuckDB.

Warning:
    This method cannot be called on Narwhals DataFrame/LazyFrame.
)rc   r   rx   s    r"   is_duckdb_relationr   2  r   r!   c                ~    [        5       =nSL=(       a)    [        XR                  R                  R                  5      $ )z:Check whether `df` is a Ibis Table without importing Ibis.N)rB   rk   exprtypesTable)rn   rA   s     r"   _is_ibis_tabler   <  s,    JDt+U
2yy?T?T0UUr!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a Ibis Table without importing Ibis.

Warning:
    This method cannot be called on Narwhals DataFrame/LazyFrame.
)rc   r   rx   s    r"   is_ibis_tabler   A  s     r""r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )zBCheck whether `df` is a Polars DataFrame without importing Polars.N)r#   rk   r	   rn   pls     r"   _is_polars_dataframer   K  "    ,Bt+L
2||0LLr!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a Polars DataFrame without importing Polars.

Warning:
    This method cannot be called on a Narwhals DataFrame/LazyFrame.
)rc   r   rx   s    r"   is_polars_dataframer   P  rz   r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )zBCheck whether `df` is a Polars LazyFrame without importing Polars.N)r#   rk   r   r   s     r"   _is_polars_lazyframer   Z  r   r!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a Polars LazyFrame without importing Polars.

Warning:
    This method cannot be called on Narwhals DataFrame/LazyFrame.
)rc   r   rx   s    r"   is_polars_lazyframer   _  rz   r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )z@Check whether `ser` is a Polars Series without importing Polars.N)r#   rk   r   )rf   r   s     r"   _is_polars_seriesr   i  s"    ,Bt+J
3		0JJr!   c                .    [        U 5        [        U 5      $ )zCheck whether `ser` is a Polars Series without importing Polars.

Warning:
    This method cannot be called on Narwhals Series.
)rg   r   r   s    r"   is_polars_seriesr   n  r   r!   c                    [        [        5       =n5      =(       a(    [        US5      =(       a    [        XR                  5      $ )NSchema)boolr#   rE   rk   r   r   r   s     r"   is_polars_schemar   x  s0    :<R YWR%:Yz#yy?Yr!   c                d    [        [        5       =n5      =(       a    [        XR                  5      $ rj   )r   r#   rk   DataTyper   s     r"   is_polars_data_typer     s"    jl"#D
3(DDr!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )zHCheck whether `ser` is a PyArrow ChunkedArray without importing PyArrow.N)r3   rk   ChunkedArray)rf   pas     r"   _is_pyarrow_chunked_arrayr     s"    -B,QC1QQr!   c                .    [        U 5        [        U 5      $ )zCheck whether `ser` is a PyArrow ChunkedArray without importing PyArrow.

Warning:
    This method cannot be called on Narwhals Series.
)rg   r   r   s    r"   is_pyarrow_chunked_arrayr     s     S!$S))r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )z@Check whether `df` is a PyArrow Table without importing PyArrow.N)r3   rk   r   )rn   r   s     r"   _is_pyarrow_tabler     s"    -B,IB1IIr!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a PyArrow Table without importing PyArrow.

Warning:
    This method cannot be called on a Narwhals DataFrame/LazyFrame.
)rc   r   rx   s    r"   is_pyarrow_tabler     s     r"R  r!   c                V    [        5       =nS L=(       a    [        XR                  5      $ rj   )r3   rk   Scalarr   r   s     r"   is_pyarrow_scalarr     s"    -B,KC1KKr!   c                d    [        [        5       =n5      =(       a    [        XR                  5      $ rj   )r   r3   rk   r   r   s     r"   is_pyarrow_schemar     s"    km#$CC)CCr!   c                d    [        [        5       =n5      =(       a    [        XR                  5      $ rj   )r   r3   rk   r   r   s     r"   is_pyarrow_data_typer     s"    km#$EC)EEr!   c                h    [        [        5       =nSL=(       a    [        XR                  5      5      $ )zDCheck whether `df` is a PySpark DataFrame without importing PySpark.N)r   rL   rk   r	   )rn   pyspark_sqls     r"   _is_pyspark_dataframer     s2    ')	)$6 	2r001 r!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a PySpark DataFrame without importing PySpark.

Warning:
    This method cannot be called on a Narwhals DataFrame/LazyFrame.
)rc   r   rx   s    r"   is_pyspark_dataframer     s     r" $$r!   c                ^    [        5       b   SSKJn  [	        X5      $ g! [         a     gf = f)zLCheck whether `df` is a PySpark Connect DataFrame without importing PySpark.r   r   F)rN   pyspark.sql.connect.dataframer	   ImportErrorrk   rn   r	   s     r"   _is_pyspark_connect_dataframer     s7    (	? "((  		s    
,,c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a PySpark Connect DataFrame without importing PySpark.

Warning:
    This method cannot be called on a Narwhals DataFrame/LazyFrame.
)rc   r   rx   s    r"   is_pyspark_connect_dataframer     s     r"(,,r!   c                <    [        5       b  SSKJn  [        X5      $ g)zFCheck whether `df` is a SQLFrame DataFrame without importing SQLFrame.r   )BaseDataFrameF)rQ   sqlframe.base.dataframer   rk   )rn   r   s     r"   _is_sqlframe_dataframer     s    ~!9",,r!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a SQLFrame DataFrame without importing SQLFrame.

Warning:
    This method cannot be called on a Narwhals DataFrame/LazyFrame.
)rc   r   rx   s    r"   is_sqlframe_dataframer     s     r"!"%%r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )z=Check whether `arr` is a NumPy Array without importing NumPy.N)r7   rk   r   arrnps     r"   is_numpy_arrayr     s"    +Bd*Jz#zz/JJr!   c                D    [        U 5      =(       a    U R                  S:H  $ )z@Check whether `arr` is a 1D NumPy Array without importing NumPy.rU   r   ndimr   s    r"   is_numpy_array_1dr         #0388q=0r!   c                    [        5       =n=(       a8    [        U 5      =(       a&    UR                  U R                  UR                  5      $ rj   )r7   r   
issubdtypedtypeintegerr   s     r"   is_numpy_array_1d_intr     s9    {	 	1c"	1MM#))RZZ0r!   c                    [        5       =n=(       a8    [        U 5      =(       a&    UR                  U R                  UR                  5      $ rj   )r7   r   r   r   bool_r   s     r"   is_numpy_array_1d_boolr    s9    {	 	/c"	/MM#))RXX.r!   c                D    [        U 5      =(       a    U R                  S:H  $ )z@Check whether `arr` is a 2D NumPy Array without importing NumPy.   r   r   s    r"   is_numpy_array_2dr    r   r!   c                V    [        5       =nSL=(       a    [        XR                  5      $ )zACheck whether `scalar` is a NumPy Scalar without importing NumPy.N)r7   rk   generic)scalarr   s     r"   is_numpy_scalarr	    s$    
 +Bd*Mz&**/MMr!   c                `    [        U 5      =(       d    [        U 5      =(       d    [        U 5      $ )zzCheck whether `df` is a pandas-like DataFrame without doing any imports.

By "pandas-like", we mean: pandas, Modin, cuDF.
)rv   r   r   rx   s    r"   _is_pandas_like_dataframer    s&    
  #X':2'>XBTUWBXXr!   c                .    [        U 5        [        U 5      $ )zCheck whether `df` is a pandas-like DataFrame without doing any imports.

By "pandas-like", we mean: pandas, Modin, cuDF.

Warning:
    This method cannot be called on a Narwhals DataFrame/LazyFrame.
)rc   r  rx   s    r"   is_pandas_like_dataframer    s     r"$R((r!   c                `    [        U 5      =(       d    [        U 5      =(       d    [        U 5      $ )zxCheck whether `ser` is a pandas-like Series without doing any imports.

By "pandas-like", we mean: pandas, Modin, cuDF.
)r~   r   r   r   s    r"   _is_pandas_like_seriesr  "  s$    
 S!R%5c%:Roc>RRr!   c                .    [        U 5        [        U 5      $ )zCheck whether `ser` is a pandas-like Series without doing any imports.

By "pandas-like", we mean: pandas, Modin, cuDF.

Warning:
    This method cannot be called on Narwhals Series.
)rg   r  r   s    r"   is_pandas_like_seriesr  *  s     S!!#&&r!   c                `    [        U 5      =(       d    [        U 5      =(       d    [        U 5      $ )zyCheck whether `index` is a pandas-like Index without doing any imports.

By "pandas-like", we mean: pandas, Modin, cuDF.
)r   r   r   )r   s    r"   is_pandas_like_indexr  6  s%     	O."7O=;Or!   c                    [        [        5       =n5      =(       a=    [        XR                  R                  R
                  [        5       R                  45      $ rj   )r   r'   rk   api
extensionsExtensionDtyper7   r   r   ru   s     r"   is_pandas_like_dtyper  @  sB    jl"# 
ff..	0A0AB) r!   c                    [        [        5       =n5      =(       a<    [        XR                  R                  R
                  5      =(       a    [        U S5      $ )Nto_arrow)r   r'   rk   r  r  r  rE   r  s     r"   is_cudf_dtyper  F  sD     	:<R  	%sVV..==?	%C$r!   c                    SSK Jn  SSKJn  U" U S5      =(       dG    [	        U 5      =(       d5    [        U 5      =(       d#    [        U 5      =(       d    UR                  U 5      $ )Nr   plugins_hasattr_static__narwhals_series__)narwhalsr  r[   r!  r   r   r  is_native_seriesr   r  r!  s      r"   _is_native_seriesr&  P  sX     / 	23 	)S!	)$S)	) "#&	) ##C(r!   c                    SSK Jn  SSKJn  U" U S5      =(       dG    [	        U 5      =(       d5    [        U 5      =(       d#    [        U 5      =(       d    UR                  U 5      $ )Nr   r  r   __narwhals_dataframe__)r#  r  r[   r!  r   r   r  is_native_dataframer%  s      r"   _is_native_dataframer*  ]  sX     / 	56 	,$	,S!	, %S)	, &&s+r!   c                X   SSK Jn  SSKJn  U" U S5      =(       d    [	        U 5      =(       d}    [        U 5      =(       dk    [        U 5      =(       dY    [        U 5      =(       dG    [        U 5      =(       d5    [        U 5      =(       d#    [        U 5      =(       d    UR                  U 5      $ )Nr   r  r   __narwhals_lazyframe__)r#  r  r[   r!  r   r   r   r   r   r   r   is_native_lazyframer%  s      r"   _is_native_lazyframer.  j  s     / 	56 	,$	,c"	, s#	, #		,
 !%	, )-	, "#&	, &&s+
r!   c                H    SSK Jn  [        X5      =(       d    [        U 5      $ )a	  Check whether `native_series` can be converted to a Narwhals Series.

Arguments:
    native_series: The object to check.

Examples:
    >>> import pandas as pd
    >>> import polars as pl
    >>> import numpy as np
    >>> import narwhals as nw

    >>> s_pd = pd.Series([1, 2, 3])
    >>> s_pl = pl.Series([1, 2, 3])
    >>> np_arr = np.array([1, 2, 3])

    >>> nw.dependencies.is_into_series(s_pd)
    True
    >>> nw.dependencies.is_into_series(s_pl)
    True
    >>> nw.dependencies.is_into_series(np_arr)
    False
r   r   )narwhals.seriesr   rk   r&  )native_seriesr   s     r"   is_into_seriesr2  {  s    . 'm,P0A-0PPr!   c                H    SSK Jn  [        X5      =(       d    [        U 5      $ )aP  Check whether `native_dataframe` can be converted to a Narwhals DataFrame.

Arguments:
    native_dataframe: The object to check.

Examples:
    >>> import pandas as pd
    >>> import polars as pl
    >>> import numpy as np
    >>> from narwhals.dependencies import is_into_dataframe

    >>> df_pd = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
    >>> df_pl = pl.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
    >>> np_arr = np.array([[1, 4], [2, 5], [3, 6]])

    >>> is_into_dataframe(df_pd)
    True
    >>> is_into_dataframe(df_pl)
    True
    >>> is_into_dataframe(np_arr)
    False
r   r   )narwhals.dataframer	   rk   r*  )native_dataframer	   s     r"   is_into_dataframer6    %    . -&2 6J7 r!   c                H    SSK Jn  [        X5      =(       d    [        U 5      $ )aQ  Check whether `native_lazyframe` can be converted to a Narwhals LazyFrame.

Arguments:
    native_lazyframe: The object to check.

Examples:
    >>> import pandas as pd
    >>> import polars as pl
    >>> import numpy as np
    >>> from narwhals.dependencies import is_into_lazyframe

    >>> df_pd = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
    >>> lf_pl = pl.LazyFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
    >>> np_arr = np.array([[1, 4], [2, 5], [3, 6]])

    >>> is_into_lazyframe(df_pd)
    False
    >>> is_into_lazyframe(lf_pl)
    True
    >>> is_into_lazyframe(np_arr)
    False
r   r   )r4  r   rk   r.  )native_lazyframer   s     r"   is_into_lazyframer;    r7  r!   c                $    SSK Jn  [        X5      $ )zCheck whether `df` is a Narwhals DataFrame.

This is useful if you expect a user to pass in a Narwhals
DataFrame directly, and you want to catch both `narwhals.DataFrame`
and `narwhals.stable.v1.DataFrame`.
r   r   )r4  r	   rk   r   s     r"   rY   rY          -b$$r!   c                $    SSK Jn  [        X5      $ )zCheck whether `lf` is a Narwhals LazyFrame.

This is useful if you expect a user to pass in a Narwhals
LazyFrame directly, and you want to catch both `narwhals.LazyFrame`
and `narwhals.stable.v1.LazyFrame`.
r   r9  )r4  r   rk   )lfr   s     r"   rZ   rZ     r=  r!   c                $    SSK Jn  [        X5      $ )zCheck whether `ser` is a Narwhals Series.

This is useful if you expect a user to pass in a Narwhals
Series directly, and you want to catch both `narwhals.Series`
and `narwhals.stable.v1.Series`.
r   r   )r0  r   rk   )rf   r   s     r"   re   re     s     'c""r!   c                Z    [        U 5      =(       a    U R                  R                  5       $ rj   )re   r   
is_integerr   s    r"   is_narwhals_series_intrC    s    c"=syy';';'==r!   c                Z    [        U 5      =(       a    U R                  R                  5       $ rj   )re   r   
is_booleanr   s    r"   is_narwhals_series_boolrF    s!     c"=syy';';'==r!   ),r,   r:   r<   r?   rB   r)   r7   r'   r#   r3   rJ   rN   rL   rQ   r   r   r   r   r   r   r6  r;  r2  r   r   r   rY   rZ   re   r   ry   r   r  r  r  r   r   r   r   r   r   r   r   r   )returnr   )r`   r   rG  None)rf   r   rG  rH  )rn   r   rG  zTypeIs[pd.DataFrame])rf   r   rG  zTypeIs[pd.Series[Any]])r   r   rG  zTypeIs[pd.Index[Any]])rn   r   rG  zTypeIs[mpd.DataFrame])rf   r   rG  zTypeIs[mpd.Series])r   r   rG  zTypeIs[mpd.Index[Any]])rn   r   rG  zTypeIs[cudf.DataFrame])rf   r   rG  zTypeIs[cudf.Series[Any]])r   r   rG  zTypeIs[cudf.Index])r   r   rG  r   )rn   r   rG  zTypeIs[dd.DataFrame])rn   r   rG  zTypeIs[duckdb.DuckDBPyRelation])rn   r   rG  zTypeIs[ibis.Table])rn   r   rG  zTypeIs[pl.DataFrame])rn   r   rG  zTypeIs[pl.LazyFrame])rf   r   rG  zTypeIs[pl.Series])r   r   rG  zTypeIs[pl.Schema])r   r   rG  zTypeIs[pl.DataType])rf   r   rG  zTypeIs[pa.ChunkedArray[Any]])rn   r   rG  zTypeIs[pa.Table])r   r   rG  zTypeIs[pa.Scalar[Any]])r   r   rG  zTypeIs[pa.Schema])r   r   rG  zTypeIs[pa.DataType])rn   r   rG  zTypeIs[pyspark_sql.DataFrame])rn   r   rG  zTypeIs[PySparkConnectDataFrame])rn   r   rG  zTypeIs[SQLFrameDataFrame])r   zAny | _NDArray[_ShapeT]rG  zTypeIs[_NDArray[_ShapeT]])r   r   rG  zTypeIs[_1DArray])r   r   rG  zTypeIs[_1DArrayInt])r   r   rG  zTypeIs[_2DArray])r  r   rG  zTypeGuard[_NumpyScalar])rn   r   rG  r   )rf   r   rG  r   )r   r   rG  r   )r   r   rG  zTypeIs[PandasLikeDType])r   r   rG  z(TypeIs[pd.api.extensions.ExtensionDtype])r   Any | IntoSeriesTrG  TypeIs[IntoSeriesT])r   Any | IntoDataFrameTrG  TypeIs[IntoDataFrameT])r   Any | IntoLazyFrameTrG  TypeIs[IntoLazyFrameT])r1  rI  rG  rJ  )r5  rK  rG  rL  )r:  rM  rG  rN  )rn   zDataFrame[IntoDataFrameT] | AnyrG  z!TypeIs[DataFrame[IntoDataFrameT]])r?  zAny | LazyFrame[IntoLazyFrameT]rG  z!TypeIs[LazyFrame[IntoLazyFrameT]])rf   zAny | Series[IntoSeriesT]rG  zTypeIs[Series[IntoSeriesT]])
__future__r   r   typingr   r   narwhals._exceptionsr   r   r+   dask.dataframe	dataframerF   r>   rA   modin.pandasr&   r   ru   r   r   r2   r   pyspark.sqlsqlr   r   r	   PySparkConnectDataFrametyping_extensionsr
   narwhals._spark_like.dataframer   r4  r   r0  r   narwhals.typingr   r   r   r   r   r   r   r   r   r   	frozensetrt   r#   r'   r)   r,   r0   r3   r7   r:   r<   r?   rB   rG   rJ   rL   rN   rQ   rc   rg   rv   ry   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.  r2  r6  r;  rY   rZ   re   rC  rF  __all__r    r!   r"   <module>r]     se   # 
 % . %R(@7&  " +'+
+
1
)
)
,
*
)
3
+
)
.,
0
8
-

(
($"N
#L
!M
O
"M
 U
"#V
M
$M
$K
"ER
*J
!LDF%-&K
1
1
NY	)S	'	-

"Q8<<%'%&%%'%&%	#>>	"> >-r!   