
    iG                         U d Z ddlZddlZddlmZ ddlmZmZmZm	Z	m
Z
mZ i Zeee
eef   f   ed<    G d d      Zddeeee
eef   f      d	dfd
Zy)z
Legacy import handler for Pinecone.

This module provides a simple way to handle legacy imports that were previously
available via star imports but are no longer imported at the top level.
    N)
ModuleType)DictOptionalSetAnyTuplecastLEGACY_IMPORTSc                   D    e Zd ZdZdedeeeeef   f   fdZdedefdZ	y)	LegacyImportProxyz
    A proxy module that handles legacy imports with warnings.

    This class is used to replace the pinecone module in sys.modules
    to handle legacy imports that were previously available via star imports.
    original_modulelegacy_importsc                 L    || _         || _        t               | _        i | _        y)z
        Initialize the proxy module.

        Args:
            original_module: The original module to proxy.
            legacy_imports: Dictionary of legacy imports to handle.
        N)_original_module_legacy_importsset_warned_imports_loaded_modules)selfr   r   s      o/var/www/catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/pinecone/utils/legacy_imports.py__init__zLegacyImportProxy.__init__   s&     !0-),/1    namereturnc                    	 t        | j                  |      S # t        $ r Y nw xY w|| j                  v r| j                  |   \  }}|| j                  vr@	 t        j                  |      | j                  |<   n# t        $ r t        d| d      w xY w| j                  |   }t        ||      rt        ||      S t        d| d      )a  
        Handle attribute access for legacy imports.

        Args:
            name: The name of the attribute being accessed.

        Returns:
            The requested attribute.

        Raises:
            AttributeError: If the attribute cannot be found.
        z$module 'pinecone' has no attribute '')	getattrr   AttributeErrorr   r   	importlibimport_moduleImportErrorhasattr)r   r   module_pathactual_namemodules        r   __getattr__zLegacyImportProxy.__getattr__*   s    	400$77 		 4''''+';';D'A$K $"6"66Y8A8O8OP[8\D((5" Y(+OPTvUV)WXXY ))+6Fv{+v{33CD6KLLs    	$$"A9 9BN)
__name__
__module____qualname____doc__r   r   strr   r   r&    r   r   r   r      sC    2 2T#uSRUXBV=W 2.M .M .Mr   r   r   r   c                     | t         } dt        j                  vryt        j                  d   }t        ||       }t	        t
        |      t        j                  d<   y)z
    Set up the legacy import handler.

    Args:
        legacy_imports: Optional dictionary of legacy imports to handle.
                       If None, uses the default LEGACY_IMPORTS dictionary.
    Npinecone)r
   sysmodulesr   r	   r   )r   r   proxys      r   setup_legacy_importsr2   [   sS     ' $ kk*-Oo~>E #:u5CKK
r   )N)r*   r   r/   typesr   typingr   r   r   r   r   r	   r
   r+   __annotations__r   r2   r,   r   r   <module>r6      su     
  8 8.S%S/)* CM CML6$sE#s(O7K2L)M 6Y] 6r   