
    IZj                       U d dl mZ d dlZd dlmZ d dlmZmZmZ d dl	m
Z
 d dlmZ er*d dl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 d dlmZ ddgZdZded<   	  eddd          Z edede          Zed2d            Z  G d de
eef         eeef                   Z! G d deeef                   Z"ed3d$            Z#d4d(Z$d5d,Z%d6d.Z&d7d1Z'dS )8    )annotationsN)cache)TYPE_CHECKINGAnyProtocol)CompliantNamespace)TypeVar)Iterator)EntryPoints)	TypeAlias)LiteralString)CompliantDataFrameAnyCompliantFrameAnyCompliantLazyFrameAnyCompliantSeriesAny)VersionPluginfrom_nativezBCompliantDataFrameAny | CompliantLazyFrameAny | CompliantSeriesAnyr   CompliantAnyFrameTr   z-CompliantDataFrameAny | CompliantLazyFrameAny)bounddefaultFromNativeR_coT)r   	covariantr   returnr   c                 *    ddl m}  d} | |          S )Nr   )entry_pointsznarwhals.plugins)group)importlib.metadatar   )epsr   s     \/Users/jameslopez/projects/MentorCore/.venv/lib/python3.11/site-packages/narwhals/plugins.py_discover_entrypointsr"   +   s,    666666E3U    c                      e Zd ZddZdS )PluginNamespacedatar   r   r   c                   d S N )selfr&   s     r!   r   zPluginNamespace.from_native4         r#   N)r&   r   r   r   )__name__
__module____qualname__r   r)   r#   r!   r%   r%   3   s        >>>>>>r#   r%   c                  6    e Zd Zedd            ZddZddZdS )r   r   r   c                    d S r(   r)   )r*   s    r!   NATIVE_PACKAGEzPlugin.NATIVE_PACKAGE8   s    /2sr#   versionr   'PluginNamespace[FrameT, FromNativeR_co]c                    d S r(   r)   )r*   r2   s     r!   __narwhals_namespace__zPlugin.__narwhals_namespace__;   s    25#r#   native_objectobjectboolc                   d S r(   r)   )r*   r6   s     r!   	is_nativezPlugin.is_native>   r+   r#   N)r   r   )r2   r   r   r3   )r6   r7   r   r8   )r,   r-   r.   propertyr1   r5   r:   r)   r#   r!   r   r   7   sH        222 X26 6 6 6 ?>>>>>r#   clstypetype_strr8   c                    	 t          fd|                                 D                       S # t          $ r Y dS w xY w)Nc              3  P   K   | ] }|j                             d           v V  !dS ).N)r-   split).0or>   s     r!   	<genexpr>z_might_be.<locals>.<genexpr>D   s8      GG5AL..s333GGGGGGr#   F)anymro	TypeError)r<   r>   s    `r!   	_might_berJ   A   sU    GGGGSWWYYGGGGGG   uus   ,0 
>>r6   r   pluginc                    |j         }t          j                            |          d uo1t	          t          |           |          o|                    |           S r(   )r1   sysmodulesgetrJ   r=   r:   )r6   rK   pkgs      r!   _is_native_pluginrQ   I   sU    

CD( 	,d=))3//	,]++r#   r2   r   Iterator[CompliantAny]c              #     K   t                      D ]S}|                                }t          | |          r-|                    |          }|                    |           V  Td S )N)r2   )r"   loadrQ   r5   r   )r6   r2   entry_pointrK   compliant_namespaces        r!   _iter_from_nativerW   R   s      ,.. A A$))++]F33 	A"("?"?"?"P"P%11-@@@@@	A Ar#   CompliantAny | Nonec                >    t          t          | |          d          S )a  Attempt to convert `native_object` to a Compliant object, using any available plugin(s).

    Arguments:
        native_object: Raw object from user.
        version: Narwhals API version.

    Returns:
        If the following conditions are met
            - at least 1 plugin is installed
            - at least 1 installed plugin supports `type(native_object)`

        Then for the **first matching plugin**, the result of the call below.
        This *should* be an object accepted by a Narwhals Dataframe, Lazyframe, or Series:

            plugin: Plugin
            plugin.__narwhals_namespace__(version).from_native(native_object)

        In all other cases, `None` is returned instead.
    N)nextrW   )r6   r2   s     r!   r   r   Z   s    ( !-994@@@r#   native_object_type
str | Nonec                ,    t          | d          r	 dS d S )NdaftzHint: it looks like you passed a `daft.DataFrame` but don't have `narwhals-daft` installed.
Please refer to https://github.com/narwhals-dev/narwhals-daft for installation instructions.)rJ   )r[   s    r!   _show_suggestionsr_   q   s,    #V,, 
k	
 	
 4r#   )r   r   )r<   r=   r>   r?   r   r8   )r6   r   rK   r   r   r8   )r6   r   r2   r   r   rR   )r6   r   r2   r   r   rX   )r[   r=   r   r\   )(
__future__r   rM   	functoolsr   typingr   r   r   narwhals._compliantr   narwhals._typing_compatr	   collections.abcr
   r   r   r   typing_extensionsr   narwhals._compliant.typingr   r   r   r   narwhals.utilsr   __all__r   __annotations__r   r   r"   r%   r   rJ   rQ   rW   r   r_   r)   r#   r!   <module>rk      s   " " " " " " " 



       / / / / / / / / / / 2 2 2 2 2 2 + + + + + + '((((((......      //////            '&&&&& ]
# I      H	
;
 
 

 LD,  
    ? ? ? ? ?(5x@V7W ? ? ?? ? ? ? ?Xfn,- ? ? ?       A A A AA A A A.     r#   