
    %
iV                         U d Z ddlmZ ddlZddlmZ ddlZddlZddlZddl	m
Z
 ddlmZ  G d d          Z G d	 d
e          Z G d de          Z G d de          Z	 ddlZeZded<   dS # e$ r eZY dS w xY w)zNDispatcher

Please see policy.py for a discussion on dispatchers and policies
    )annotationsN)NoReturn)IsCOMServerException)IIDToInterfaceNamec                  z    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd ZddZd ZdS )DispatcherBasea  The base class for all Dispatchers.

    This dispatcher supports wrapping all operations in exception handlers,
    and all the necessary delegation to the policy.

    This base class supports the printing of "unexpected" exceptions.  Note, however,
    that exactly where the output of print goes may not be useful!  A derived class may
    provide additional semantics for this.
    c                \     ||          | _         t          t          dd           | _        d S )Nlogger)policygetattrwin32comr
   )selfpolicyClassobjects      C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\win32com/server/dispatcher.py__init__zDispatcherBase.__init__   s,    !k&)) h$77    c                    	 | j                             ||           t          j        | |          S #  |                                  Y d S xY wN)r   _CreateInstance_	pythoncom
WrapObject_HandleException_)r   clsidreqIIDs      r   r   zDispatcherBase._CreateInstance_#   sV    	%K((777'f555	%""$$$$$$s	   /2 Ac                p    	 | j                             |          S #  |                                  Y d S xY wr   )r   _QueryInterface_r   )r   iids     r   r   zDispatcherBase._QueryInterface_*   sA    	%;//444	%""$$$$$$    5c                v    	 | j                             ||||          S #  |                                  Y d S xY wr   )r   _Invoke_r   r   dispidlcidwFlagsargss        r   r!   zDispatcherBase._Invoke_0   sG    	%;''fdCCC	%""$$$$$$s    8c                r    	 | j                             ||          S #  |                                  Y d S xY wr   )r   _GetIDsOfNames_r   r   namesr$   s      r   r(   zDispatcherBase._GetIDsOfNames_6   sC    	%;..ud;;;	%""$$$$$$    6c                r    	 | j                             ||          S #  |                                  Y d S xY wr   )r   _GetTypeInfo_r   r   indexr$   s      r   r-   zDispatcherBase._GetTypeInfo_<   sC    	%;,,UD999	%""$$$$$$r+   c                n    	 | j                                         S #  |                                  Y d S xY wr   )r   _GetTypeInfoCount_r   r   s    r   r1   z!DispatcherBase._GetTypeInfoCount_B   s?    	%;11333	%""$$$$$$    4c                r    	 | j                             ||          S #  |                                  Y d S xY wr   )r   _GetDispID_r   r   namefdexs      r   r5   zDispatcherBase._GetDispID_H   sC    	%;**4666	%""$$$$$$r+   c                z    	 | j                             ||||||          S #  |                                  Y d S xY wr   )r   
_InvokeEx_r   r   r#   r$   r%   r&   kwargsserviceProviders          r   r:   zDispatcherBase._InvokeEx_N   sR    	%;))fdFO  	%""$$$$$$s   ! :c                r    	 | j                             ||          S #  |                                  Y d S xY wr   )r   _DeleteMemberByName_r   r6   s      r   r?   z#DispatcherBase._DeleteMemberByName_V   sC    	%;33D$???	%""$$$$$$r+   c                p    	 | j                             |          S #  |                                  Y d S xY wr   )r   _DeleteMemberByDispID_r   r   ids     r   rA   z%DispatcherBase._DeleteMemberByDispID_\   sA    	%;55b999	%""$$$$$$r   c                r    	 | j                             ||          S #  |                                  Y d S xY wr   )r   _GetMemberProperties_r   r   rC   r8   s      r   rE   z$DispatcherBase._GetMemberProperties_b   sC    	%;44R>>>	%""$$$$$$r+   c                p    	 | j                             |          S #  |                                  Y d S xY wr   )r   _GetMemberName_r   r   r#   s     r   rH   zDispatcherBase._GetMemberName_h   sA    	%;..v666	%""$$$$$$r   c                r    	 | j                             ||          S #  |                                  Y d S xY wr   )r   _GetNextDispID_r   r   r8   flagss      r   rK   zDispatcherBase._GetNextDispID_n   sC    	%;..tU;;;	%""$$$$$$r+   c                n    	 | j                                         S #  |                                  Y d S xY wr   )r   _GetNameSpaceParent_r   r2   s    r   rO   z#DispatcherBase._GetNameSpaceParent_t   s?    	%;33555	%""$$$$$$r3   returnr   c                    t                      s5| j        | j                            d           nt          j                      )zfCalled whenever an exception is raised.

        Default behaviour is to print the exception.
        Nzpythoncom server error)r   r
   	exception	traceback	print_excr2   s    r   r   z DispatcherBase._HandleException_z   sF     $%% 	&{&%%&>????#%%%r   c                   | j         Dd                    t          t          |                    }| j                             |           d S |d d         D ]}t          |d           t          |d                    d S )N )end)r
   joinmapstrdebugprint)r   r&   recordargs       r   _trace_zDispatcherBase._trace_   s    ;"XXc#tnn--FKf%%%%%CRCy $ $cs#####$r(OOOOOr   N)rP   r   )__name__
__module____qualname____doc__r   r   r   r!   r(   r-   r1   r5   r:   r?   rA   rE   rH   rK   rO   r   r`    r   r   r   r      s"        8 8 8% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %% % %       r   r   c                  `    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd ZdS )DispatcherTracezGA dispatcher, which causes a 'print' line for each COM function called.c                    t                               | |          }|sA|                     d                    | j        j        t          |          |                     |S )Nz5in {!r}._QueryInterface_ with unsupported IID {} ({}))r   r   r`   formatr   _obj_r   )r   r   rcs      r   r   z DispatcherTrace._QueryInterface_   sd    ,,T377 	LLGNNK%'9#'>'>   
 	r   c                n    |                      d||fz             t                              | ||          S )Nz&in _GetIDsOfNames_ with '%s' and '%d'
)r`   r   r(   r)   s      r   r(   zDispatcherTrace._GetIDsOfNames_   s6    >%NOOO--dE4@@@r   c                n    |                      d||fz             t                              | ||          S )Nz(in _GetTypeInfo_ with index=%d, lcid=%d
)r`   r   r-   r.   s      r   r-   zDispatcherTrace._GetTypeInfo_   s6    @E4=PQQQ++D%>>>r   c                `    |                      d           t                              |           S )Nzin _GetTypeInfoCount_
)r`   r   r1   r2   s    r   r1   z"DispatcherTrace._GetTypeInfoCount_   s)    .///00666r   c                p    |                      d||||           t                              | ||||          S )Nzin _Invoke_ with)r`   r   r!   r"   s        r   r!   zDispatcherTrace._Invoke_   s9    'vtDDD&&tVT64HHHr   c                h    |                      d||           t                              | ||          S )Nzin _GetDispID_ with)r`   r   r5   r6   s      r   r5   zDispatcherTrace._GetDispID_   s1    *D$777))$d;;;r   c           
         |                      d                    | j        j        |||||                     t                              | ||||||          S )Nz(in {!r}._InvokeEx_-{}{!r} [{:x},{},{!r}])r`   ri   r   rj   r   r:   r;   s          r   r:   zDispatcherTrace._InvokeEx_   sf    6==!64 	
 	
 	

 ((&$fo
 
 	
r   c                h    |                      d||           t                              | ||          S )Nzin _DeleteMemberByName_ with)r`   r   r?   r6   s      r   r?   z$DispatcherTrace._DeleteMemberByName_   s1    3T4@@@224tDDDr   c                d    |                      d|           t                              | |          S )Nzin _DeleteMemberByDispID_ with)r`   r   rA   rB   s     r   rA   z&DispatcherTrace._DeleteMemberByDispID_   s-    5r:::44T2>>>r   c                h    |                      d||           t                              | ||          S )Nzin _GetMemberProperties_ with)r`   r   rE   rF   s      r   rE   z%DispatcherTrace._GetMemberProperties_   s1    4b$???33D"dCCCr   c                d    |                      d|           t                              | |          S )Nzin _GetMemberName_ with)r`   r   rH   rI   s     r   rH   zDispatcherTrace._GetMemberName_   s-    .777--dF;;;r   c                h    |                      d||           t                              | ||          S )Nzin _GetNextDispID_ with)r`   r   rK   rL   s      r   rK   zDispatcherTrace._GetNextDispID_   s1    .e<<<--dD%@@@r   c                `    |                      d           t                              |           S )Nzin _GetNameSpaceParent_)r`   r   rO   r2   s    r   rO   z$DispatcherTrace._GetNameSpaceParent_   s)    .///224888r   N)ra   rb   rc   rd   r   r(   r-   r1   r!   r5   r:   r?   rA   rE   rH   rK   rO   re   r   r   rg   rg      s        QQ  A A A? ? ?7 7 7I I I< < <
 
 
E E E? ? ?D D D< < <A A A9 9 9 9 9r   rg   c                      e Zd ZdZd ZdS )DispatcherWin32tracezNA tracing dispatcher that sends its output to the win32trace remote collector.c                    t                               | ||           | j        dd l}|                     d|d           d S )Nr   z2Object with win32trace dispatcher created (object=))rg   r   r
   win32traceutilr`   )r   r   r   r|   s       r   r   zDispatcherWin32trace.__init__   sR      {F;;;;!!!!U&UUUVVVVVr   N)ra   rb   rc   rd   r   re   r   r   ry   ry      s.        XXW W W W Wr   ry   c                      e Zd ZdZd ZdS )DispatcherOutputDebugStringzHA tracing dispatcher that sends its output to win32api.OutputDebugStringc                    |d d         D ]&}t          j        t          |          dz              't          j        t          |d                   dz              d S )NrW   rV   
)win32apiOutputDebugStringr[   )r   r&   r_   s      r   r`   z#DispatcherOutputDebugString._trace_   s]    9 	7 	7C&s3xx#~6666"3tBx==4#788888r   N)ra   rb   rc   rd   r`   re   r   r   r~   r~      s)        RR9 9 9 9 9r   r~   ztype[DispatcherTrace]DefaultDebugDispatcher)rd   
__future__r   rS   typingr   r   r   r   win32com.server.exceptionr   win32com.utilr   r   rg   ry   r~   
win32tracer   __annotations__ImportErrorre   r   r   <module>r      s    
 # " " " " "                 : : : : : : , , , , , ,} } } } } } } }@A9 A9 A9 A9 A9n A9 A9 A9HW W W W W? W W W9 9 9 9 9/ 9 9 9-4HHHHHHH - - -,-s   $A1 1A<;A<