o
    DRh
                     @  sH   d dl mZ d dlZd dlmZmZ dgZdddZ		ddddZdS )    )annotationsN)AnyIterable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   T/home/air/sanwanet/backup_V2/venv/lib/python3.10/site-packages/websockets/imports.pyimport_name
   s   
r   aliasesdict[str, str] | None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   __all__r   r   r   r   r   r   <module>   s    
