
    %
i1                     <    d Z ddlZddlZddlZ G d d          ZdS )z&Utilities for working with Connections    Nc                   4    e Zd ZdZd	dZd Zd Zd
dZd ZdS )SimpleConnectionz"A simple, single connection objectNr   c                 f    d | _         d | _        || _        ||                     |||           d S d S N)cpcookiedebugConnect)self
coInstanceeventInstance
eventCLSIDr	   s        C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\win32com/client/connect.py__init__zSimpleConnection.__init__   sA    
!LL]J????? "!    c                 \    	 |                                   d S # t          j        $ r Y d S w xY wr   )
Disconnect	pythoncomerrorr   s    r   __del__zSimpleConnection.__del__   sA    	OO 	 	 	DD	s    ++c                     | j         rt          j        j        j        nd }t          j        j                            ||          S )N)useDispatcher)r	   win32comserverpolicyDispatcherWin32traceutilwrap)r   objr   s      r   _wrapzSimpleConnection._wrap   s>    ;?:OHO"774 	 #((M(JJJr   c                 (   	 |j         }n# t          $ r |}Y nw xY w|                    t          j                  }||j        }|                     |          }|                    |          | _        | j        	                    |          | _
        d S r   )_oleobj_AttributeErrorQueryInterfacer   IID_IConnectionPointContainerCLSIDr!   FindConnectionPointr   Adviser   )r   r   r   r   oleobjcpccomEventInstances          r   r
   zSimpleConnection.Connect   s    	 (FF 	  	  	 FFF	 ##I$KLL&,J::m44))*55gnn%566s   
 c                     | j         6| j        r&| j                             | j                   d | _        d | _         d S d S r   )r   r   Unadviser   s    r   r   zSimpleConnection.Disconnect+   sD    w{ #  ---"DGGG	 r   )NNNr   r   )	__name__
__module____qualname____doc__r   r   r!   r
   r    r   r   r   r      sv        ((@ @ @ @  K K K
7 
7 
7 
7    r   r   )r2   r   win32com.server.policyr   win32com.server.utilr   r3   r   r   <module>r6      sa    , ,            ( ( ( ( ( ( ( ( ( (r   