Ë
    kQêjÜ   ã                  ó8  — d dl mZ d dlZd dlZ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mZ dZdZdZdZdZdZdZdZ G d	„ d
e«      Zd d„Zer!d dlZd dlZd dlZd dlZd dl Z d dl!Z!d dl"Z"d dl#Z#nX ed«      \  ZZ ed«      \  ZZ ed«      \  ZZ ed«      \  Z"Z ed«      \  ZZ ed«      \  Z!Z ed«      \  Z Z ed«      \  Z#Z ed¬«      d!d„«       Z$ddœd"d„Z%ddœd"d„Z&ddœd"d„Z'ddœd"d„Z(ddœd"d„Z)ddœd"d„Z*ddœd"d„Z+ddœd"d„Z,g d¢Z-y)#é    )ÚannotationsN)Ú	lru_cache)Úimport_module)Ú	find_spec)Ú
ModuleType)ÚTYPE_CHECKINGÚAnyÚClassVarÚHashableÚcastTc                  ód   ‡ — e Zd ZU dZdZddddddd	d
œZded<   	 	 	 	 	 	 dˆ fd„Zdd„Zdd„Z	ˆ xZ
S )Ú_LazyModulea/  
    Module that can act both as a lazy-loader and as a proxy.

    Notes
    -----
    We do NOT register this module with `sys.modules` so as not to cause
    confusion in the global environment. This way we have a valid proxy
    module for our own use, but it lives _exclusively_ within lance.

    Tznp.zpd.zpl.ztorch.ztf.zray.zlance.)ÚnumpyÚpandasÚpolarsÚtorchÚ
tensorflowÚrayÚlancezClassVar[dict[str, str]]Ú_mod_pfxc               ó^   •— || _         || _        t        «       | _        t        ‰| �  |«       y)aˆ  
        Initialise lazy-loading proxy module.

        Parameters
        ----------
        module_name : str
            the name of the module to lazy-load (if available).

        module_available : bool
            indicate if the referenced module is actually available (we will proxy it
            in both cases, but raise a helpful error when invoked if it doesn't exist).

        N)Ú_module_availableÚ_module_nameÚglobalsÚ_globalsÚsuperÚ__init__)ÚselfÚmodule_nameÚmodule_availableÚ	__class__s      €úY/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/lancedb/dependencies.pyr   z_LazyModule.__init__<   s+   ø€ ð& "2ˆÔØ'ˆÔÜ›	ˆŒÜ‰Ñ˜Õ%ó    c                ó¬   — t        | j                  «      }|| j                  | j                  <   | j                  j                  |j                  «       |S )N)r   Ú__name__r   r   Ú__dict__Úupdate)r   Úmodules     r"   Ú_importz_LazyModule._importT   s?   € ä˜tŸ}™}Ó-ˆØ+1ˆ�‰�d×'Ñ'Ñ(Ø�‰×Ñ˜VŸ_™_Ô-Øˆr#   c                ór  — |dk(  rt        | j                  ›d|›�«      ‚| j                  r| j                  «       }t	        ||«      S |dk(  r| j                  S t        j                  d|«      r|dk7  ry | j                  j                  | j                  d«      }t        |› |› d| j                  ›d�«      d ‚)	NÚ__wrapped__z object has no attribute r%   z	^__\w+__$Ú__version__Ú z
 requires z module to be installed)
ÚAttributeErrorr   r   r)   ÚgetattrÚreÚmatchr   ÚgetÚModuleNotFoundError)r   Úattrr(   Úpfxs       r"   Ú__getattr__z_LazyModule.__getattr__[   sÌ   € ð �=Ò Ü Ø×$Ñ$Ð'Ð'@ÀÀÐIóð ð
 ×!Ò!à—\‘\“^ˆFÜ˜6 4Ó(Ð(ð �ZÒØ×$Ñ$Ð$Ü�X‰X�l DÔ)¨d°mÒ.Cð ð —-‘-×#Ñ# D×$5Ñ$5°rÓ:ˆCÜ%Ø�%˜�v˜Z¨×(9Ñ(9Ð'<Ð<SÐTóàðr#   )r   Ústrr    ÚboolÚreturnÚNone)r9   r   )r4   r	   r9   r	   )r%   Ú
__module__Ú__qualname__Ú__doc__Ú__lazy__r   Ú__annotations__r   r)   r6   Ú__classcell__)r!   s   @r"   r   r   $   s`   ø… ñ	ð €Hð ØØØØØØñ*€HÐ&ó ð&àð&ð ð	&ð
 
õ&ó0÷r#   r   c                óÒ   — | t         j                  v rt         j                  |    dfS 	 t        | «      }|du xs |j                  du  }t        | |¬«      |fS # t        $ r d}Y Œw xY w)aú  
    Lazy import the given module; avoids up-front import costs.

    Parameters
    ----------
    module_name : str
        name of the module to import, eg: "polars".

    Notes
    -----
    If the requested module is not available (eg: has not been installed), a proxy
    module is created in its place, which raises an exception on any attribute
    access. This allows for import and use as normal, without requiring explicit
    guard conditions - if the module is never used, no exception occurs; if it
    is, then a helpful exception is raised.

    Returns
    -------
    tuple of (Module, bool)
        A lazy-loading module and a boolean indicating if the requested/underlying
        module exists (if not, the returned module is a proxy).

    TNF)r   r    )ÚsysÚmodulesr   Úloaderr3   r   )r   Úmodule_specr    s      r"   Ú_lazy_importrF   x   s‡   € ð2 ”c—k‘kÑ!Ü�{‰{˜;Ñ'¨Ð-Ð-ð!Ü Ó,ˆØ +¨tÐ 3Ò Q°{×7IÑ7IÈTÐ7QÐRÐô 	Ø#Ø-ô	
ð 	ðð øô ò !Ø Òð!ús   © A ÁA&Á%A&r   r   r   r   Údatasetsr   r   r   )Úmaxsizec                óh   ‡— 	 t        ˆfd„| j                  «       D «       «      S # t        $ r Y yw xY w)Nc              3  ó>   •K  — | ]  }‰› d �t        |«      v –— Œ y­w)ú.N)r7   )Ú.0ÚoÚtype_s     €r"   ú	<genexpr>z_might_be.<locals>.<genexpr>À   s    øè ø€ Ò<¨Q�e�W˜A�;¤# a£&Ô(Ñ<ùs   ƒF)ÚanyÚmroÚ	TypeError)ÚclsrN   s    `r"   Ú	_might_berT   »   s1   ø€ ðÜÓ<°#·'±'³)Ô<Ó<Ð<øÜò Ùðús   ƒ!% ¥	1°1)Ú
check_typec               ó`   — t         xr' t        t        t        |rt	        | «      n| «      d«      S )Nr   )Ú_NUMPY_AVAILABLErT   r   r   Útype©ÚobjrU   s     r"   Ú_check_for_numpyr[   Å   ó*   € Üò ¤	ÜŒX¡J”t˜C”y°CÓ8¸'ó!ð r#   c               ó`   — t         xr' t        t        t        |rt	        | «      n| «      d«      S )Nr   )Ú_PANDAS_AVAILABLErT   r   r   rX   rY   s     r"   Ú_check_for_pandasr_   Ë   ó*   € Üò ¤ÜŒX¡J”t˜C”y°CÓ8¸(ó"ð r#   c               ó`   — t         xr' t        t        t        |rt	        | «      n| «      d«      S )Nr   )Ú_POLARS_AVAILABLErT   r   r   rX   rY   s     r"   Ú_check_for_polarsrc   Ñ   r`   r#   c               ó`   — t         xr' t        t        t        |rt	        | «      n| «      d«      S )Nr   )Ú_TORCH_AVAILABLErT   r   r   rX   rY   s     r"   Ú_check_for_torchrf   ×   r\   r#   c               ó`   — t         xr' t        t        t        |rt	        | «      n| «      d«      S )NrG   )Ú_HUGGING_FACE_AVAILABLErT   r   r   rX   rY   s     r"   Ú_check_for_hugging_faceri   Ý   s*   € Ü"ò ¤yÜŒX¡J”t˜C”y°CÓ8¸*ó(ð r#   c               ó`   — t         xr' t        t        t        |rt	        | «      n| «      d«      S )Nr   )Ú_TENSORFLOW_AVAILABLErT   r   r   rX   rY   s     r"   Ú_check_for_tensorflowrl   ã   s*   € Ü ò ¤YÜŒX¡J”t˜C”y°CÓ8¸,ó&ð r#   c               ó`   — t         xr' t        t        t        |rt	        | «      n| «      d«      S )Nr   )Ú_RAY_AVAILABLErT   r   r   rX   rY   s     r"   Ú_check_for_rayro   é   s*   € Üò œiÜŒX¡J”t˜C”y°CÓ8¸%óð r#   c               ó`   — t         xr' t        t        t        |rt	        | «      n| «      d«      S )Nr   )Ú_LANCE_AVAILABLErT   r   r   rX   rY   s     r"   Ú_check_for_lancerr   ï   r\   r#   )rG   r   r   r   r   r   r   r   ri   r[   r_   rc   rl   rf   ro   rr   r   rW   r^   rb   re   rh   rk   rn   rq   )r   r7   r9   ztuple[ModuleType, bool])rS   rX   rN   r7   r9   r8   )rZ   r	   rU   r8   r9   r8   ).Ú
__future__r   r0   rB   Ú	functoolsr   Ú	importlibr   Úimportlib.utilr   Útypesr   Útypingr   r	   r
   r   r   rW   r^   rb   re   rh   rk   rn   rq   r   rF   rG   r   r   r   r   r   r   r   rT   r[   r_   rc   rf   ri   rl   ro   rr   Ú__all__© r#   r"   ú<module>r{      su  ðõ  #ã 	Û 
Ý Ý #Ý $Ý ß ?Õ ?àÐ ØÐ ØÐ ØÐ ØÐ ØÐ Ø€ØÐ ôQ�*ô Qóh+ñ\ ÛÛÛÛÛÛÛÜñ +¨7Ó3Ñ€EÐÙ ,¨XÓ 6Ñ€FÐÙ ,¨XÓ 6Ñ€FÐÙ*¨7Ó3Ñ€EÐÙ(4°ZÓ(@Ñ%€HÐ%Ù(4°\Ó(BÑ%€JÐ%Ù& uÓ-Ñ€CˆÙ*¨7Ó3Ñ€EÐñ �4Ôòó ðð 6:õ ð 7;õ ð 7;õ ð 6:õ ð =Aõ ð ;?õ ð 48õ ð 6:õ ò�r#   