
    0Fie                    b    d dl mZ d dlZd dlmZ  G d d          Zd Zed             Zd ZdS )	    )annotationsN)without_property_validationc                      e Zd ZdZd Zd ZdS )DashboardComponentaT  Base class for Dask.distributed UI dashboard components.

    This class must have two attributes, ``root`` and ``source``, and one
    method ``update``:

    *  source: a Bokeh ColumnDataSource
    *  root: a Bokeh Model
    *  update: a method that consumes the messages dictionary found in
               distributed.bokeh.messages
    c                "    d | _         d | _        d S N)sourceroot)selfs    Ilib/python3.11/site-packages/distributed/dashboard/components/__init__.py__init__zDashboardComponent.__init__   s    			    c                    dS )z=Reads from bokeh.distributed.messages and updates self.sourceN )r   messagess     r   updatezDashboardComponent.update   s      r   N)__name__
__module____qualname____doc__r   r   r   r   r   r   r      sA        	 	  L L L L Lr   r   c                    t          j        |          |                     fd|           t          | |           dS )a  Add periodic callback to doc in a way that avoids reference cycles

    If we instead use ``doc.add_periodic_callback(component.update, 100)`` then
    the component stays in memory as a reference cycle because its method is
    still around.  This way we avoid that and let things clean up a bit more
    nicely.

    TODO: we still have reference cycles.  Docs seem to be referred to by their
    add_periodic_callback methods.
    c                 "    t                     S r   r   )refs   r   <lambda>z'add_periodic_callback.<locals>.<lambda>)   s    fSkk r   N)weakrefr   add_periodic_callback_attach)doc	componentintervalr   s      @r   r   r      sJ     +i
 
 C11118<<<Cr   c                J     |             }||                                  d S d S r   r   )r   comps     r   r   r   -   s,    355D r   c                    t          | d          st                      | _        | j                            |           d S )N
components)hasattrsetr%   add)r   r    s     r   r   r   4   s;    3%% Ny!!!!!r   )	
__future__r   r   bokeh.core.propertiesr   r   r   r   r   r   r   r   <module>r+      s    " " " " " "  = = = = = =L L L L L L L L(  "   " " " " "r   