U
    ÷Õ/eÿ
  ã                   @  s´   U d dl mZ d dlZd dlZd dlmZmZ d dlm	Z	 d dl
mZ G dd„ deƒZejdkrrejjZded	< nd
d
ddœdd	„ZG dd„ deƒZi Zded< d
ddœdd„ZdS )é    )ÚannotationsN)ÚABCÚabstractmethod)ÚIterable)ÚProtocolc                   @  s   e Zd Zdddœdd„ZdS )Ú_EntryPointsÚstrú'Iterable[importlib.metadata.EntryPoint])ÚkwargsÚreturnc                 K  s   d S ©N© )Úselfr
   r   r   ú=/tmp/pip-unpacked-wheel-g426oqom/distributed/comm/registry.pyÚ__call__   s    z_EntryPoints.__call__N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   
   s   r   )é   é
   Ú_entry_pointsr   r	   )ÚgroupÚnamer   c                 c  s,   t j ¡  | g ¡D ]}|j|kr|V  qd S r   )Ú	importlibÚmetadataÚentry_pointsÚgetr   )r   r   Úepr   r   r   r      s    
c                   @  sT   e Zd ZdZedd„ ƒZedd„ ƒZedd„ ƒZedd	„ ƒZd
d„ Z	edd„ ƒZ
dS )ÚBackendzO
    A communication backend, selected by a given URI scheme (e.g. 'tcp').
    c                 C  s   dS )zL
        Get a connector object usable for connecting to addresses.
        Nr   )r   r   r   r   Úget_connector$   s    zBackend.get_connectorc                 K  s   dS )zJ
        Get a listener object for the scheme-less address *loc*.
        Nr   )r   ÚlocZhandle_commZdeserializeZconnection_argsr   r   r   Úget_listener*   s    zBackend.get_listenerc                 C  s   dS )zš
        Get a host name (normally an IP address) identifying the host the
        address is located on.
        *loc* is a scheme-less address.
        Nr   ©r   r    r   r   r   Úget_address_host2   s    zBackend.get_address_hostc                 C  s   dS )z 
        Resolve the address into a canonical form.
        *loc* is a scheme-less address.

        Simple implementations may return *loc* unchanged.
        Nr   r"   r   r   r   Úresolve_address:   s    zBackend.resolve_addressc                 C  s   t ‚dS )zŽ
        Get the (host, port) tuple of the scheme-less address *loc*.
        This should only be implemented by IP-based transports.
        N)ÚNotImplementedErrorr"   r   r   r   Úget_address_host_portC   s    zBackend.get_address_host_portc                 C  s   dS )zN
        Get the local listening address suitable for reaching *loc*.
        Nr   r"   r   r   r   Úget_local_address_forJ   s    zBackend.get_local_address_forN)r   r   r   Ú__doc__r   r   r!   r#   r$   r&   r'   r   r   r   r   r      s   



r   zdict[str, Backend]Úbackends)Úschemer   c                 C  s^   t  | ¡}|dk	r|S t| ddD ]}| ¡ ƒ }|t | < |  S td| ›dtt ƒ› dƒ‚dS )zÍ
    Get the Backend instance for the given *scheme*.
    It looks for matching scheme in dask's internal cache, and falls-back to
    package metadata for the group name ``distributed.comm.backends``
    Nzdistributed.comm.backends)r   r   zunknown address scheme z (known schemes: ú))r)   r   r   ÚloadÚ
ValueErrorÚsorted)r*   ÚbackendZbackend_class_epr   r   r   Úget_backendU   s    
 ÿ

ÿr0   )Ú
__future__r   Úimportlib.metadatar   ÚsysÚabcr   r   Úcollections.abcr   Útypingr   r   Úversion_infor   r   r   Ú__annotations__r   r)   r0   r   r   r   r   Ú<module>   s    
5