
    h_                     &    d dl mZ  G d de      Zy)   )format_environmentc                   r    e Zd ZdZed        Zed        Zed        Zed        Ze	d        Z
d Zd Zd	 Zy
)ProxyConfigz/
    Hold the client's proxy configuration
    c                 $    | j                  d      S )Nhttpgetselfs    4/usr/lib/python3/dist-packages/docker/utils/proxy.pyr   zProxyConfig.http   s    xx    c                 $    | j                  d      S )Nhttpsr   r
   s    r   r   zProxyConfig.https   s    xx  r   c                 $    | j                  d      S )Nftpr   r
   s    r   r   zProxyConfig.ftp   s    xxr   c                 $    | j                  d      S )Nno_proxyr   r
   s    r   r   zProxyConfig.no_proxy   s    xx
##r   c                     t        | j                  d      | j                  d      | j                  d      | j                  d            S )a  
        Instantiate a new ProxyConfig from a dictionary that represents a
        client configuration, as described in `the documentation`_.

        .. _the documentation:
            https://docs.docker.com/network/proxy/#configure-the-docker-client
        	httpProxy
httpsProxyftpProxynoProxyr   r   r   r   )r   r	   )configs    r   	from_dictzProxyConfig.from_dict   sA     K(**\*

:&ZZ	*	
 	
r   c                 
   i }| j                   r| j                   x|d<   |d<   | j                  r| j                  x|d<   |d<   | j                  r| j                  x|d<   |d<   | j                  r| j                  x|d<   |d<   |S )	zt
        Return a dictionary representing the environment variables used to
        set the proxy settings.
        
http_proxy
HTTP_PROXYhttps_proxyHTTPS_PROXY	ftp_proxy	FTP_PROXYr   NO_PROXYr   )r   envs     r   get_environmentzProxyConfig.get_environment(   s    
 9948II=CL 1::6:jj@C]!38826((:Cs;/==04=C
Oc*o
r   c                 N    | s|S t        | j                               }|s|S ||z   S )z
        Given a list of strings representing environment variables, prepend the
        environment variables corresponding to the proxy settings.
        )r   r%   )r   environment	proxy_envs      r   inject_proxy_environmentz$ProxyConfig.inject_proxy_environment8   s6    
 &t';';'=>	 ;&&r   c                 z    dj                  | j                  | j                  | j                  | j                        S )Nz3ProxyConfig(http={}, https={}, ftp={}, no_proxy={}))formatr   r   r   r   r
   s    r   __str__zProxyConfig.__str__G   s.    DKKIItzz488T]]< 	<r   N)__name__
__module____qualname____doc__propertyr   r   r   r   staticmethodr   r%   r)   r,    r   r   r   r      sz         ! !   $ $ 
 
 '<r   r   N)utilsr   dictr   r3   r   r   <module>r6      s    %E<$ E<r   