
    wiX	                         d dl mZmZ d dlmZmZ 	 d dlmZ d dlm	Z	 d dl
ma n$# eef$ r  e            a e            Z	d ZY nw xY weee         ee         ef         ZdefdZ	 dd
ededdfdZdS )    )OptionalTuple)!DashboardManagerConnectionDetailsDashboardStartedEvent)connect_to_dashboard)DASHBOARD_STARTED_EVENT)$DASHBOARD_MANAGER_CONNECTION_DETAILSc                      d S )N )_s    x/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/mpire/dashboard/connection_utils.pyr   r      s        returnc                  V    t           j        t           j        t          j                    fS )a  
    Obtains the connection details of a dasbhoard. These details are needed to be passed on to child process when the
    start method is either forkserver or spawn.

    :return: Dashboard manager host, port_nr and whether a dashboard is started/connected
    )r	   hostportr   is_setr   r   r    get_dashboard_connection_detailsr      s&     157[7`#*,,. .r   Tdashboard_connection_detailsauto_connectNc                     | \  }}}|Z|Zt          j                    sI|r|rt          ||           dS |t          _        |t          _        |rt          j                     dS dS dS dS dS )aF  
    Sets the dashboard connection details and connects to an existing dashboard if needed.

    :param dashboard_connection_details:  Dashboard manager host, port_nr and whether a dashboard is started/connected
    :param auto_connect: Whether to automatically connect to a server when the dashboard_started event is set
    N)r   r   r   r	   r   r   set)r   r   dashboard_manager_hostdashboard_manager_port_nrdashboard_starteds        r   set_dashboard_connectionr      s     LhH57H*/H/T'.00 0U 	. 	. !:<RSSSSS8N058Q05  .'+----- 	+*/T/T/T/T. .r   )T)typingr   r   "mpire.dashboard.connection_classesr   r   mpire.dashboardr   mpire.dashboard.dashboardr   mpire.dashboard.managerr	   ImportErrorModuleNotFoundErrorstrintboolDashboardConnectionDetailsr   r   r   r   r   <module>r(      sC   " " " " " " " " g g g g g g g g	444444AAAAAALLLLLLL()   +L+L+N+N(3355    	 #8C=(3-#EF .*D . . . . 37. .;U .+/.;?. . . . . .s   % AA