
    .Ph                     N    d Z ddlZddlZ G d d          Z G d d          ZdS )a  Paramiko SSH support for Dulwich.

To use this implementation as the SSH implementation in Dulwich, override
the dulwich.client.get_ssh_vendor attribute:

  >>> from dulwich import client as _mod_client
  >>> from dulwich.contrib.paramiko_vendor import ParamikoSSHVendor
  >>> _mod_client.get_ssh_vendor = ParamikoSSHVendor

This implementation is experimental and does not have any tests.
    Nc                   H    e Zd Zd	dZed             Zd Zd Zd
dZd	dZ	dS )_ParamikoWrapperreturnNc                 V    || _         || _        | j                            d           d S )NT)clientchannelsetblocking)selfr   r   s      _/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/dulwich/contrib/paramiko_vendor.py__init__z_ParamikoWrapper.__init__'   s.     	  &&&&&    c                 6    | j                             d          S )Nrb)r   makefile_stderrr
   s    r   stderrz_ParamikoWrapper.stderr.   s    |++D111r   c                 4    | j                                         S N)r   
recv_readyr   s    r   can_readz_ParamikoWrapper.can_read2   s    |&&(((r   c                 6    | j                             |          S r   )r   sendall)r
   datas     r   writez_ParamikoWrapper.write5   s    |##D)))r   c                     | j                             |          }t          |          }|sdS |r#||k     r||z
  }||                     |          z   S |S )Nr   )r   recvlenread)r
   nr   data_lendiff_lens        r   r   z_ParamikoWrapper.read8   sh    |  ##t99  	3  	.A8|H$))H----r   c                 8    | j                                          d S r   )r   closer   s    r   r#   z_ParamikoWrapper.closeF   s    r   r   Nr   )
__name__
__module____qualname__r   propertyr   r   r   r   r#    r   r   r   r   &   s        ' ' ' ' 2 2 X2) ) )* * *        r   r   c                   *    e Zd ZddZ	 	 	 	 	 	 ddZdS )ParamikoSSHVendorr   Nc                     || _         d S r   )kwargs)r
   r-   s     r   r   zParamikoSSHVendor.__init__M   s    r   c	                 (   t          j                    }
d|i}|                    | j                   |r||d<   |r||d<   |r||d<   |r||d<   |r||d<   |                    |	           t           j                                        }|
                    |            |
j        di | |
                                	                                }||dk    r|
                    dd	
           |                    |           t          |
|          S )Nhostnameusernameportpasswordpkeykey_filename   GIT_PROTOCOLz	version=2)namevaluer)   )paramiko	SSHClientupdater-   r   MissingHostKeyPolicyset_missing_host_key_policyconnectget_transportopen_sessionset_environment_variableexec_commandr   )r
   hostcommandr0   r1   r2   r3   r4   protocol_versionr-   r   connection_kwargspolicyr   s                 r   run_commandzParamikoSSHVendor.run_commandP   sU    #%%'.  --- 	5,4j) 	-(,f% 	5,4j) 	-(,f% 	=0<n-  (((5577**6222++*+++ &&((5577#'71'<'<,,.,TTT 	W%%%000r   r$   )NNNNNN)r%   r&   r'   r   rH   r)   r   r   r+   r+   J   sP            )1 )1 )1 )1 )1 )1r   r+   )__doc__r9   paramiko.clientr   r+   r)   r   r   <module>rK      s   ,
 
     ! ! ! ! ! ! ! !H/1 /1 /1 /1 /1 /1 /1 /1 /1 /1r   