Repository URL to install this package:
Version:
3.4.45 ▾
|
ó °EYc @ sx d Z d d l Z d d l Z d d l Z d d l Z d d l Z d Z d e f d YZ d e f d YZ d S( s2 Configuration file (aka ``ssh_config``) support. iÿÿÿÿNi t SSHConfigc B s\ e Z d Z e j d Z d Z d Z d Z d Z d Z d Z d Z RS( s Representation of config information as stored in the format used by OpenSSH. Queries can be made via `lookup`. The format is described in OpenSSH's ``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. .. versionadded:: 1.6 s (\w+)(?:\s*=\s*|\s+)(.+)c C s g | _ d S( s5 Create a new OpenSSH config object. N( t _config( t self( ( sD /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/config.pyt __init__. s c C s¸ i d g d 6i d 6} x| D]} | j } | s | j d rL q n t j | j | } | sz t d | n | j d j } | j d } | d k rÚ | j j | i | j | d 6i d 6} q | d k r | j d k r d | d | <q | j d r7| j d r7| d d !} n | d k r| | d k rk| d | j | q | g | d | <q | | d k r | | d | <q q W| j j | d S( s Read an OpenSSH config from the given file object. :param file_obj: a file-like object to read the config file from t *t hostt configt #s Unparsable line %si i t proxycommandt nonet "iÿÿÿÿt identityfilet localforwardt remoteforwardN( R R R ( t stript startswitht ret matcht SETTINGS_REGEXt Exceptiont groupt lowerR t appendt _get_hostst Nonet endswith( R t file_objR t lineR t keyt value( ( sD /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/config.pyt parse4 s4 c C sò g | j D]" } | j | d | r | ^ q } i } x{ | D]s } xj | d j D]X \ } } | | k r | d k r | n | | | <qV | d k rV | | j | qV qV Wq? W| j | | } d | k rî | d d k rî | d =n | S( s Return a dict of config options for a given hostname. The host-matching rules of OpenSSH's ``ssh_config`` man page are used: For each parameter, the first obtained value will be used. The configuration files contain sections separated by ``Host`` specifications, and that section is only applied for hosts that match one of the patterns given in the specification. Since the first obtained value for each parameter is used, more host- specific declarations should be given near the beginning of the file, and general defaults at the end. The keys in the returned dict are all normalized to lowercase (look for ``"port"``, not ``"Port"``. The values are processed according to the rules for substitution variable expansion in ``ssh_config``. :param str hostname: the hostname to lookup R R R R N( R t _allowedt itemsR t extendt _expand_variables( R t hostnameR t matchest retR R R ( ( sD /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/config.pyt lookupc s " c C s2 t } x" | j D] } | j | d q W| S( s Return the set of literal hostnames defined in the SSH config (both explicit hostnames and wildcard entries). R ( t setR t update( R t hostst entry( ( sD /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/config.pyt get_hostnames s c C s_ t } xR | D]J } | j d r<