σ
Ύ^Yc           @` sΛ  d  d l  m Z d  d l  m Z d  d l  m Z d  d l  m Z d  d l m Z y d  d l m Z Wn! e k
 r d  d l m Z n Xy d  d l m	 Z	 Wn! e k
 rΏ d  d l
 m	 Z	 n Xd  d l m Z d  d	 l Z y d  d
 l m Z WnI e k
 r;y d  d
 l m Z Wq<e k
 r7d  d
 l m Z q<Xn Xe j d  d k Z e j d  d k Z e d  Z d   Z d d  Z d e f d     YZ y d  d l m Z Wn e k
 rΖe Z n Xd	 S(   i    (   t   absolute_import(   t   division(   t   print_function(   t   unicode_literals(   t   MutableMapping(   t   UserDict(   t   OrderedDict(   t   openN(   t	   get_identi   i   u   strc         C` s   d |  _ t |  _ |  S(   uC   raise from_none(ValueError('a')) == raise ValueError('a') from NoneN(   t   Nonet	   __cause__t   Truet   __suppress_context__(   t   exc(    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt	   from_none%   s    		u   ...c         ` s     f d   } | S(   uG   Decorator to make a repr function return fillvalue for a recursive callc         ` sm   t          f d   } t  d  | _ t  d  | _ t  d  | _ t  d i   | _ | S(   Nc         ` sW   t  |   t   f } |  k r%   S j |  z  |   } Wd   j |  X| S(   N(   t   idR   t   addt   discard(   t   selft   keyt   result(   t	   fillvaluet   repr_runningt   user_function(    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   wrapper3   s    u
   __module__u   __doc__u   __name__u   __annotations__(   t   sett   getattrt
   __module__t   __doc__t   __name__t   __annotations__(   R   R   (   R   (   R   R   sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   decorating_function0   s    	(    (   R   R   (    (   R   sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   recursive_repr-   s    t	   _ChainMapc           B` sΕ   e  Z d  Z d   Z d   Z d   Z d d  Z d   Z d   Z	 d   Z
 e   d    Z e d	    Z d
   Z e Z d   Z e d    Z d   Z d   Z d   Z d   Z d   Z RS(   u±   A ChainMap groups multiple dicts (or other mappings) together
    to create a single, updateable view.

    The underlying mappings are stored in a list.  That list is public and can
    accessed or updated using the *maps* attribute.  There is no other state.

    Lookups search the underlying mappings successively until a key is found.
    In contrast, writes, updates, and deletions only operate on the first
    mapping.

    c         G` s   t  |  p i  g |  _ d S(   u   Initialize a ChainMap by setting *maps* to the given mappings.
        If no mappings are provided, a single empty dictionary is used.

        N(   t   listt   maps(   R   R#   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   __init__U   s    c         C` s   t  |   d  S(   N(   t   KeyError(   R   R   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   __missing__\   s    c         C` sA   x1 |  j  D]& } y | | SWq
 t k
 r/ q
 Xq
 W|  j |  S(   N(   R#   R%   R&   (   R   R   t   mapping(    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   __getitem___   s    c         C` s   | |  k r |  | S| S(   N(    (   R   R   t   default(    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   getg   s    c         C` s   t  t   j |  j    S(   N(   t   lenR   t   unionR#   (   R   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   __len__j   s    c         C` s   t  t   j |  j    S(   N(   t   iterR   R,   R#   (   R   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   __iter__m   s    c         ` s   t    f d   |  j D  S(   Nc         3` s   |  ] }   | k Vq d  S(   N(    (   t   .0t   m(   R   (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pys	   <genexpr>q   s    (   t   anyR#   (   R   R   (    (   R   sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   __contains__p   s    c         C` s%   d j  |  d j t t |  j    S(   Nu   {0.__class__.__name__}({1})u   , (   t   formatt   joint   mapt   reprR#   (   R   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   __repr__s   s    c         G` s   |  t  j | |   S(   u?   Create a ChainMap with a single dict created from the iterable.(   t   dictt   fromkeys(   t   clst   iterablet   args(    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyR:   x   s    c         C` s$   |  j  |  j d j   |  j d  S(   uH   New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]i    i   (   t	   __class__R#   t   copy(   R   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyR?   }   s    c         C` s   |  j  i  |  j  S(   u;   New ChainMap with a new dict followed by all previous maps.(   R>   R#   (   R   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt	   new_child   s    c         C` s   |  j  |  j d   S(   u   New ChainMap from maps[1:].i   (   R>   R#   (   R   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   parents   s    c         C` s   | |  j  d | <d  S(   Ni    (   R#   (   R   R   t   value(    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   __setitem__   s    c         C` s?   y |  j  d | =Wn& t k
 r: t d j |    n Xd  S(   Ni    u(   Key not found in the first mapping: {!r}(   R#   R%   R4   (   R   R   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   __delitem__   s    c         C` s9   y |  j  d j   SWn t k
 r4 t d   n Xd S(   uP   Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.i    u#   No keys found in the first mapping.N(   R#   t   popitemR%   (   R   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyRE      s    c         G` sH   y |  j  d j | |  SWn& t k
 rC t d j |    n Xd S(   uW   Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].i    u(   Key not found in the first mapping: {!r}N(   R#   t   popR%   R4   (   R   R   R=   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyRF      s    c         C` s   |  j  d j   d S(   u'   Clear maps[0], leaving maps[1:] intact.i    N(   R#   t   clear(   R   (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyRG   £   s    N(   R   R   R   R$   R&   R(   R	   R*   R-   R/   R3   R    R8   t   classmethodR:   R?   t   __copy__R@   t   propertyRA   RC   RD   RE   RF   RG   (    (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyR!   H   s&   												(   t   ChainMap(   t
   __future__R    R   R   R   t   collectionsR   R   t   ImportErrorR   t   ordereddictt   ioR   t   syst   threadR   t   _threadt   _dummy_threadt   version_infot   PY2t   PY3t   typet   strR   R    R!   RK   (    (    (    sD   /tmp/pip-build-kpPAdC/configparser/backports/configparser/helpers.pyt   <module>   s>   	`