Ñò
ðgcJc           @   s,   d  Z  d d k Z d e f d „  ƒ  YZ d S(   s   
L{SSHConfig}.
iÿÿÿÿNt	   SSHConfigc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sy  
    Representation of config information as stored in the format used by
    OpenSSH. Queries can be made via L{lookup}. The format is described in
    OpenSSH's C{ssh_config} man page. This class is provided primarily as a
    convenience to posix users (since the OpenSSH format is a de-facto
    standard on posix) but should work fine on Windows too.

    @since: 1.6
    c         C   s   h d d 6g |  _  d S(   s5   
        Create a new OpenSSH config object.
        t   *t   hostN(   t   _config(   t   self(    (    sN   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\config.pyt   __init__%   s    c      	   C   sð  |  i  d g } xÙ| D]Ñ} | i d ƒ i ƒ  } | d j p | d d j o q n d | j o. | i d d ƒ \ } } | i ƒ  i ƒ  } n… d } x4 | t | ƒ j  o  | | i ƒ  o | d 7} q› W| t | ƒ j o t d | ƒ ‚ n | |  i ƒ  } | | i ƒ  } | d j oª | 2x¾ | i ƒ  D]‘ } g  } |  i  D]" }	 |	 d | j o | |	 qHqH~ }
 t |
 ƒ d j o | i	 |
 d ƒ q4h | d 6} |  i  i	 | ƒ | i	 | ƒ q4Wq x | D] } | | | <qÔWq Wd	 S(
   s«   
        Read an OpenSSH config from the given file object.

        @param file_obj: a file-like object to read the config file from
        @type file_obj: file
        i    s   
t    t   #t   =i   s   Unparsable line: %rR   N(
   R   t   rstript   lstript   splitt   stript   lowert   lent   isspacet	   Exceptiont   append(   R   t   file_objt   configst   linet   keyt   valuet   iR   t   _[1]t   ct   matchest   config(    (    sN   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\config.pyt   parse+   s<      % 9 c         C   s~   g  } |  i  D]( } t i | | d ƒ o | | q q ~ } | i d „  ƒ h  } x | D] } | i | ƒ q\ W| d =| S(   s  
        Return a dict of config options for a given hostname.

        The host-matching rules of OpenSSH's C{ssh_config} man page are used,
        which means that all configuration options from matching host
        specifications are merged, with more specific hostmasks taking
        precedence. In other words, if C{"Port"} is set under C{"Host *"}
        and also C{"Host *.example.com"}, and the lookup is for
        C{"ssh.example.com"}, then the port entry for C{"Host *.example.com"}
        will win out.

        The keys in the returned dict are all normalized to lowercase (look for
        C{"port"}, not C{"Port"}. No other processing is done to the keys or
        values.

        @param hostname: the hostname to lookup
        @type hostname: str
        R   c         S   s!   t  t |  d  ƒ t | d  ƒ ƒ S(   R   (   t   cmpR   (   t   xt   y(    (    sN   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\config.pyt   <lambda>i   s    (   R   t   fnmatcht   sortt   update(   R   t   hostnameR   R   R   t   rett   m(    (    sN   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\config.pyt   lookupT   s    ? (   t   __name__t
   __module__t   __doc__R   R   R'   (    (    (    sN   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\config.pyR       s   			)(   R*   R!   t   objectR    (    (    (    sN   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\config.pyt   <module>   s   