o
    g                     @   sb   d dl Z d dlZd dlZeeZG dd dZG dd deZG dd dZG dd	 d	eZ	dS )
    Nc                   @   s0   e Zd Zdd Zedd Zdd Zdd Zd	S )
OperationProxyc                 C   s   || _ || _d S N)_proxy_op_name)selfservice_proxyoperation_name r	   C/home/ubuntu/webapp/venv/lib/python3.10/site-packages/zeep/proxy.py__init__	   s   
zOperationProxy.__init__c                 C   s   t | jjj| j S r   )strr   _binding_operationsr   r   r	   r	   r
   __doc__   s   zOperationProxy.__doc__c                 C   sf   | j jj}|r-|r-t|}t|t|krtdt|tr&|	| |S |
| |S |r1|S |S )Nz#Incompatible soapheaders definition)r   _client_default_soapheaderscopydeepcopytype
ValueError
isinstancelistextendupdate)r   operation_soap_headersdefault_headersmergedr	   r	   r
   _merge_soap_headers   s   




z"OperationProxy._merge_soap_headersc                 O   s<   |  |d}|r||d< | jj| jj| jj| j||S )dCall the operation with the given args and kwargs.

        :rtype: zeep.xsd.CompoundValue

        _soapheaders)r   getr   r   sendr   _binding_optionsr   )r   argskwargssoap_headersr	   r	   r
   __call__$   s   zOperationProxy.__call__N)__name__
__module____qualname__r   propertyr   r   r'   r	   r	   r	   r
   r      s    
r   c                   @      e Zd Zdd ZdS )AsyncOperationProxyc                    s<   |  |d|d< | jj| jj| jj| j||I dH S )r   r    N)r   r!   r   r   
send_asyncr   r#   r   )r   r$   r%   r	   r	   r
   r'   8   s   
zAsyncOperationProxy.__call__N)r(   r)   r*   r'   r	   r	   r	   r
   r-   7       r-   c                       s<   e Zd Zdd Zdd Zdd Zdd Z fd	d
Z  ZS )ServiceProxyc                    0   | _ | _| _ fdd j D  _d S )Nc                       i | ]}|t  |qS r	   )r   .0namer   r	   r
   
<dictcomp>N       z)ServiceProxy.__init__.<locals>.<dictcomp>r   r#   r   allr   r   clientbindingbinding_optionsr	   r   r
   r   J      
zServiceProxy.__init__c                 C   s   | | S )XReturn the OperationProxy for the given key.

        :rtype: OperationProxy()

        r	   r   keyr	   r	   r
   __getattr__R   s   zServiceProxy.__getattr__c                 C   s(   z| j | W S  ty   td| w )r?   zService has no operation %r)r   KeyErrorAttributeErrorr@   r	   r	   r
   __getitem__Z   s
   zServiceProxy.__getitem__c                 C   s   t | j S )z6Return iterator over the services and their callables.)iterr   itemsr   r	   r	   r
   __iter__e   s   zServiceProxy.__iter__c                    s   t ttt | jS )z#Return the names of the operations.)r   	itertoolschaindirsuperr   r   	__class__r	   r
   __dir__i   s   zServiceProxy.__dir__)	r(   r)   r*   r   rB   rE   rH   rO   __classcell__r	   r	   rM   r
   r0   I   s    r0   c                   @   r,   )AsyncServiceProxyc                    r1   )Nc                    r2   r	   )r-   r3   r   r	   r
   r6   s   r7   z.AsyncServiceProxy.__init__.<locals>.<dictcomp>r8   r:   r	   r   r
   r   o   r>   zAsyncServiceProxy.__init__N)r(   r)   r*   r   r	   r	   r	   r
   rQ   n   r/   rQ   )
r   rI   logging	getLoggerr(   loggerr   r-   r0   rQ   r	   r	   r	   r
   <module>   s    
/%