o
    Ð­jë
  ã                   @  sP   d dl mZ d dlZd dlmZ d dlmZ dgZddd„Z		dddd„Z	dS )é    )ÚannotationsN)ÚIterable)ÚAnyÚ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   úO/var/www/html/CropPilot/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__G   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__a   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   Úcollections.abcr   Útypingr   Ú__all__r   r   r   r   r   r   Ú<module>   s    
ý