o
    :ÊÆhæ
  ã                   @  sP   d dl mZ d dlZd dlmZmZmZmZ dgZddd„Z			dddd„Z
dS )é    )ÚannotationsN)ÚAnyÚDictÚIterableÚOptionalÚlazy_importÚnameÚstrÚsourceÚ	namespaceúDict[str, Any]Úreturnr   c                 C  s\   d}|| dkr|d7 }|t |ƒk sJ dƒ‚|| dkst||d… |d| g|ƒ}t|| ƒS )aN  
    Import ``name`` from ``source`` in ``namespace``.

    There are two use cases:

    - ``name`` is an object defined in ``source``;
    - ``name`` is a submodule of ``source``.

    Neither :func:`__import__` nor :func:`~importlib.import_module` does
    exactly this. :func:`__import__` is closer to the intended behavior.

    r   Ú.é   z%importing from parent isn't supportedN)ÚlenÚ
__import__Úgetattr)r   r
   r   ÚlevelÚmodule© r   ú_/var/www/html/HyperOracle/crypto_trader/venv/lib/python3.10/site-packages/websockets/imports.pyÚimport_name
   s   þ
r   ÚaliasesúOptional[Dict[str, str]]Údeprecated_aliasesÚNonec                   s¢   ˆ du ri ‰ ˆdu ri ‰t ˆƒ‰t ˆ ƒ‰t ˆƒ‰ˆˆ@ r J dƒ‚ˆˆ@ r(J dƒ‚ˆˆ@ r0J dƒ‚ˆd ‰d‡ ‡‡‡fdd	„}|ˆd
< d‡‡‡fdd„}|ˆd< dS )a„  
    Provide lazy, module-level imports.

    Typical use::

        __getattr__, __dir__ = lazy_import(
            globals(),
            aliases={
                "<name>": "<source module>",
                ...
            },
            deprecated_aliases={
                ...,
            }
        )

    This function defines ``__getattr__`` and ``__dir__`` per :pep:`562`.

    Nznamespace conflictÚ__name__r   r	   r   r   c                   s    ˆ d usJ ‚zˆ |  }W n	 t y   Y nw t| |ˆƒS ˆd us"J ‚zˆ|  }W n	 t y1   Y nw tjˆ› d| › d�tdd� t| |ˆƒS tdˆ›d| ›�ƒ‚)Nr   z is deprecatedé   )Ú
stacklevelzmodule z has no attribute )ÚKeyErrorr   ÚwarningsÚwarnÚDeprecationWarningÚAttributeError)r   r
   )r   r   r   Úpackager   r   Ú__getattr__F   s(   ÿÿýz lazy_import.<locals>.__getattr__r%   úIterable[str]c                     s   t ˆˆ B ˆB ƒS )N)Úsortedr   )Úaliases_setÚdeprecated_aliases_setÚnamespace_setr   r   Ú__dir__`   s   zlazy_import.<locals>.__dir__r+   )r   r	   r   r   )r   r&   )Úset)r   r   r   r%   r+   r   )r   r(   r   r)   r   r*   r$   r   r      s   )r   r	   r
   r	   r   r   r   r   )NN)r   r   r   r   r   r   r   r   )Ú
__future__r   r    Útypingr   r   r   r   Ú__all__r   r   r   r   r   r   Ú<module>   s    
ý