
    %
i+                     d    d Z ddlZddlZddlZddlmZ ddlmZ ddgZg dZ	 G d	 d
          Z
dS )zcUtilities for Server Side connections.

A collection of helpers for server side connection points.
    N)olectl   )COMExceptionEnumConnectionPointsFindConnectionPoint)EnumConnectionsUnadviseAdviseGetConnectionPointContainerGetConnectionInterfacec                   p    e Zd Zeez   Zej        ej        gZ	d Z
d Zd Zd Zd Zd Zd Zd Zd	 Zd
 ZdS )ConnectableServerc                 "    d| _         i | _        d S )Nr   )cookieNoconnectionsselfs    C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\win32com/server/connect.py__init__zConnectableServer.__init__    s        c                 4    t          t          j                  Nr   winerror	E_NOTIMPLr   s    r   r   z!ConnectableServer.EnumConnections%       8-...r   c                 4    t          t          j                  r   r   r   s    r   r   z(ConnectableServer.GetConnectionInterface(   r   r   c                 J    t           j        j                            |           S r   )win32comserverutilwrapr   s    r   r   z-ConnectableServer.GetConnectionPointContainer+   s    #((...r   c                    	 |                     | j        d         t          j                  }n-# t          j        $ r t          t          j                  w xY w| xj        dz  c_        || j	        | j        <   | j        S )Nr   scoder   )
QueryInterface_connect_interfaces_	pythoncomIID_IDispatch	com_errorr   r   CONNECT_E_NOCONNECTIONr   r   )r   pUnk	interfaces      r   r
   zConnectableServer.Advise.   s    	D++)!,i.E II " 	D 	D 	DV%BCCCC	D*3'}s	   +. *Ac                 h    	 | j         |= d S # t          $ r t          t          j                  w xY w)Nr$   )r   KeyErrorr   r   E_UNEXPECTED)r   cookies     r   r	   zConnectableServer.Unadvise;   sG    	< ((( 	< 	< 	<X%:;;;;	<s    %1c                 4    t          t          j                  r   r   r   s    r   r   z&ConnectableServer.EnumConnectionPointsC   r   r   c                 `    || j         v r$t          j        j                            |           S d S r   )r'   r   r    r!   r"   )r   iids     r   r   z%ConnectableServer.FindConnectionPointF   s1    $+++?',,T222 ,+r   c                     | j                                         D ]>}	  ||f|z     # t          j        $ r }|                     ||           Y d }~7d }~ww xY wd S r   )r   valuesr(   r*   _OnNotifyFail)r   broadcaster	extraArgsr-   detailss        r   _BroadcastNotifyz"ConnectableServer._BroadcastNotifyK   s     )0022 	7 	7I7i\I5666& 7 7 7""9g666666667	7 	7s   	'AAAc                 *    t          d|           d S )Nz#Ignoring COM error to connection - )print)r   r-   r:   s      r   r7   zConnectableServer._OnNotifyFailT   s    ?G??@@@@@r   N)__name__
__module____qualname__!IConnectionPointContainer_methodsIConnectionPoint_methods_public_methods_r(   IID_IConnectionPointIID_IConnectionPointContainer_com_interfaces_r   r   r   r   r
   r	   r   r   r;   r7    r   r   r   r      s        8;SS&/  
/ / // / // / /  < < </ / /3 3 3
7 7 7A A A A Ar   r   )__doc__r(   win32com.server.utilr   r   r   	exceptionr   rA   rB   r   rG   r   r   <module>rK      s    
                # # # # # # &<=R$S !   =A =A =A =A =A =A =A =A =A =Ar   