§
    ÚóÉj  ã                  óà  — U d Z 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 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 g d¢ZdZde d<   	  eddd¬¦  «        Z! edede¬¦  «        Z"ed7d„¦   «         Z# G d„ dee!ef         e	e!e"f         ¦  «        Z$ G d„ d e	e!e"f         ¦  «        Z%ed8d&„¦   «         Z&d9d*„Z'd:d.„Z(d;d0„Z)d<d1„Z*d<d2„Z+d<d3„Z,d=d6„Z-dS )>ar  Runtime discovery of, and dispatch to, Narwhals plugin backends.

A plugin backend registers an [entry point](https://packaging.python.org/en/latest/specifications/entry-points/)
in the `narwhals.plugins` group. Plugins are discovered at runtime, so their names
cannot be enumerated in the `Literal` unions that describe built-in backends.

`PluginName` bridges that gap: a plugin's entry point name, wrapped as
`PluginName("my-plugin")`, is accepted wherever a `backend` is expected.

The contract for plugin authors is that the wrapped string **must** name an
installed plugin's entry point in the `narwhals.plugins` group.
é    )ÚannotationsN)Úcache)ÚTYPE_CHECKINGÚAnyÚProtocol)ÚCompliantNamespace)Ú
PluginName)ÚTypeVar)ÚIterator)ÚEntryPoints)Ú	TypeAlias)ÚLiteralString)ÚCompliantDataFrameAnyÚCompliantFrameAnyÚCompliantLazyFrameAnyÚCompliantSeriesAny)ÚVersion)ÚPluginr	   Ú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     ús/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib/python3.11/site-packages/narwhals/plugins.pyÚ_discover_entrypointsr#   9   s,   € à6Ð6Ð6Ð6Ð6Ð6à€EØˆ3�UÐÑÔÐó    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_nativeB   ó   € € € r$   N)r'   r   r   r   )Ú__name__Ú
__module__Ú__qualname__r   r*   r$   r"   r&   r&   A   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_PACKAGEF   s   € Ø/2¨sr$   Úversionr   ú'PluginNamespace[FrameT, FromNativeR_co]c                ó   — d S r)   r*   )r+   r3   s     r"   Ú__narwhals_namespace__zPlugin.__narwhals_namespace__I   s   € à25°#r$   Únative_objectÚobjectÚboolc               ó   — d S r)   r*   )r+   r7   s     r"   Ú	is_nativezPlugin.is_nativeL   r,   r$   N)r   r   )r3   r   r   r4   )r7   r8   r   r9   )r-   r.   r/   Úpropertyr2   r6   r;   r*   r$   r"   r   r   E   sH   € € € € € ØØ2Ð2Ð2ñ „XØ2ð6ð 6ð 6ð 6ð ?Ð>Ð>Ð>Ð>Ð>r$   r   ÚclsÚtypeÚtype_Ústrr9   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>R   s8   øè è € ÐGÐG¸�5˜AœL×.Ò.¨sÑ3Ô3Ð3ÐGÐGÐGÐGÐGÐGr$   F)ÚanyÚmroÚ	TypeError)r=   r?   s    `r"   Ú	_might_berK   O   sU   ø€ ðÝÐGÐGÐGÐG¸S¿WºW¹Y¼YÐGÑGÔGÑGÔGÐGøÝð ð ð Øˆuˆuðøøøs   ƒ,0 °
>½>r7   r   Úpluginc                ó¶   — |j         }t          j                             |¦  «        d uo1t	          t          | ¦  «        |¦  «        o|                     | ¦  «        S r)   )r2   ÚsysÚmodulesÚgetrK   r>   r;   )r7   rL   Úpkgs      r"   Ú_is_native_pluginrR   W   sU   € Ø
Ô
€CåŒ�Š˜ÑÔ DÐ(ð 	,Ý•d˜=Ñ)Ô)¨3Ñ/Ô/ð	,à×Ò˜]Ñ+Ô+ðr$   r3   r   úIterator[CompliantAny]c              #  óÎ   K  — t          ¦   «         D ]S}|                     ¦   «         }t          | |¦  «        r-|                     |¬¦  «        }|                     | ¦  «        V — ŒTd S )N)r3   )r#   ÚloadrR   r6   r   )r7   r3   Úentry_pointrL   Úcompliant_namespaces        r"   Ú_iter_from_nativerX   `   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)ÚnextrX   )r7   r3   s     r"   r   r   h   s   € õ( Õ! -°Ñ9Ô9¸4Ñ@Ô@Ð@r$   c                óN   — ddl m}m}  |t          | |j        ¦  «        ¦  «        S )zQCheck whether an installed plugin converts `native_object` to an eager DataFrame.r   )r   Úis_compliant_dataframe)Únarwhals._utilsr   r]   r   ÚMAIN)r7   r   r]   s      r"   Úis_native_dataframer`      ó7   € à?Ð?Ð?Ð?Ð?Ð?Ð?Ð?à!Ð!¥+¨m¸W¼\Ñ"JÔ"JÑKÔKÐKr$   c                óN   — ddl m}m}  |t          | |j        ¦  «        ¦  «        S )zJCheck whether an installed plugin converts `native_object` to a LazyFrame.r   )r   Úis_compliant_lazyframe)r^   r   rc   r   r_   )r7   r   rc   s      r"   Úis_native_lazyframerd   †   ra   r$   c                óN   — ddl m}m}  |t          | |j        ¦  «        ¦  «        S )zGCheck whether an installed plugin converts `native_object` to a Series.r   )r   Úis_compliant_series)r^   r   rf   r   r_   )r7   r   rf   s      r"   Úis_native_seriesrg   �   s7   € à<Ð<Ð<Ð<Ð<Ð<Ð<Ð<àÐ�{¨=¸'¼,ÑGÔGÑHÔHÐHr$   Únative_object_typeú
str | Nonec                óR   — t          | d¦  «        r	 dS t          | d¦  «        r	 dS d S )NÚdaftz¸Hint: 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.Ú
datafusionzÈHint: it looks like you passed a `datafusion.DataFrame` but don't have `narwhals-datafusion` installed.
Please refer to https://github.com/s5dsn-eqee/narwhals-datafusion for installation instructions.)rK   )rh   s    r"   Ú_show_suggestionsrm   ”   sQ   € ÝÐ# VÑ,Ô,ð 
ðkð	
ð 	
õ Ð# \Ñ2Ô2ð 
ðoð	
ð 	
ð ˆ4r$   )r   r   )r=   r>   r?   r@   r   r9   )r7   r   rL   r   r   r9   )r7   r   r3   r   r   rS   )r7   r   r3   r   r   rY   )r7   r   r   r9   )rh   r>   r   ri   ).Ú__doc__Ú
__future__r   rN   Ú	functoolsr   Útypingr   r   r   Únarwhals._compliantr   Únarwhals._typingr	   Ú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   rK   rR   rX   r   r`   rd   rg   rm   r*   r$   r"   ú<module>r{      s  ððð ð ð #Ð "Ð "Ð "Ð "Ð "à 
€
€
€
Ø Ð Ð Ð Ð Ð Ø /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /à 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø +Ð +Ð +Ð +Ð +Ð +àð 'Ø(Ð(Ð(Ð(Ð(Ð(Ø.Ð.Ð.Ð.Ð.Ð.Ø Ð Ð Ð Ð Ð à/Ð/Ð/Ð/Ð/Ð/ðð ð ð ð ð ð ð ð ð ð ð ð 'Ð&Ð&Ð&Ð&Ð&ð 2Ð
1Ð
1€ð Ið ð ð ð ñ ð Hà	ˆØØ
Ø;ð
ñ 
ô 
€ð
 �Ø˜L°DÀ,ðñ ô €ð
 ðð ð ñ „ðð?ð ?ð ?ð ?ð ?Ð(¨°¨Ô5°xÀÈÐ@VÔ7Wñ ?ô ?ð ?ð?ð ?ð ?ð ?ð ?ˆX�f˜nÐ,Ô-ñ ?ô ?ð ?ð ðð ð ñ „ððð ð ð ðAð Að Að AðAð Að Að Að.Lð Lð Lð LðLð Lð Lð LðIð Ið Ið Iðð ð ð ð ð r$   