U
    /e                     @  sl   d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 G dd de
ZG dd	 d	e
ZG d
d de
ZdS )ztThis file contains custom objects.
These are mostly regular objects with more useful _repr_ and _repr_html_ methods.    )annotations)urlparse)get_environmentget_template)format_dashboard_linkc                   @  s   e Zd ZdZdd ZdS )HasWhatz;A dictionary of all workers and which keys that worker has.c                 C  s   t dj| dS )Nzhas_what.html.j2)Zhas_whatr   renderself r   7/tmp/pip-unpacked-wheel-g426oqom/distributed/objects.py_repr_html_   s    zHasWhat._repr_html_N__name__
__module____qualname____doc__r   r   r   r   r   r      s   r   c                   @  s   e Zd ZdZdd ZdS )WhoHasz9A dictionary of all keys and which workers have that key.c                 C  s   t dj| dS )Nzwho_has.html.j2)Zwho_hasr   r
   r   r   r   r      s    zWhoHas._repr_html_Nr   r   r   r   r   r      s   r   c                   @  s   e Zd ZdZdd ZdS )SchedulerInfoz<A dictionary of information about the scheduler and workers.c                 C  s2   dd }t  }||jd< |djf d| i| S )Nc                 S  sN   z2d| kr| d nt | d j}t|| d d W S  tk
rH   Y d S X d S )NhostaddressZservicesZ	dashboard)r   hostnamer   KeyError)serverr   r   r   r   _format_dashboard_address   s    
z<SchedulerInfo._repr_html_.<locals>._format_dashboard_addressZformat_dashboard_addresszscheduler_info.html.j2Z	scheduler)r   filtersr   r	   )r   r   environmentr   r   r   r      s    
zSchedulerInfo._repr_html_Nr   r   r   r   r   r      s   r   N)r   
__future__r   urllib.parser   Zdask.widgetsr   r   Zdistributed.utilsr   dictr   r   r   r   r   r   r   <module>   s   