3
(h              ?   @   sN  d dl mZ d dl mZ d dl mZ d dl mZ d dlZd dlZyd dlmZ W n  e	k
rp   d dl
mZ Y nX yd dl
mZ W n  e	k
r   d dlmZ Y nX yd dl
mZ W n  e	k
r   d dlmZ Y nX yd dlZW n e	k
r   dZY nX d d	lmZ d dlZyd d
lmZ W nJ e	k
rj   yd d
lmZ W n" e	k
rd   d d
lmZ Y nX Y nX dddgZejd  dkZejd  dkZeZerenedZdd Zd"ddZG dd deZyd dl
m Z  W n e	k
r   eZ Y nX e!edej"ede#fe$ej"dZ%G dd de%Z&e!ede&Z'dd  Z(e!ed!e(Z)dS )#    )absolute_import)division)print_function)unicode_literalsN)MutableMapping)UserDict)OrderedDict)open)	get_identr   r   r	         unicodec             C   s   d| _ d| _| S )zCraise from_none(ValueError('a')) == raise ValueError('a') from NoneNT)	__cause____suppress_context__)exc r   H/tmp/pip-install-q3hcpn_q/configparser/backports/configparser/helpers.py	from_none6   s    r   ...c                s    fdd}|S )zGDecorator to make a repr function return fillvalue for a recursive callc                sL   t    fdd}td|_td|_td|_tdi |_|S )Nc                sB   t | t f}|kr S j| z| }W d j| X |S )N)idr
   adddiscard)selfkeyresult)	fillvaluerepr_runninguser_functionr   r   wrapperD   s    
z<recursive_repr.<locals>.decorating_function.<locals>.wrapper
__module____doc____name____annotations__)setgetattrr   r    r!   r"   )r   r   )r   )r   r   r   decorating_functionA   s    z+recursive_repr.<locals>.decorating_functionr   )r   r%   r   )r   r   recursive_repr>   s    r&   c               @   s   e Zd ZdZdd Zdd Zdd Zd%d	d
Zdd Zdd Z	dd Z
e dd Zedd Zdd ZeZdd Zedd Zdd Zdd Zdd  Zd!d" Zd#d$ ZdS )&	_ChainMapa  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 )zInitialize a ChainMap by setting *maps* to the given mappings.
        If no mappings are provided, a single empty dictionary is used.

        N)listmaps)r   r)   r   r   r   __init__g   s    z_ChainMap.__init__c             C   s   t |d S )N)KeyError)r   r   r   r   r   __missing__n   s    z_ChainMap.__missing__c             C   s8   x,| j D ]"}y|| S  tk
r(   Y qX qW | j|S )N)r)   r+   r,   )r   r   mappingr   r   r   __getitem__q   s    
z_ChainMap.__getitem__Nc             C   s   || kr| | S |S )Nr   )r   r   defaultr   r   r   get{   s    z_ChainMap.getc             C   s   t t j| j S )N)lenr#   unionr)   )r   r   r   r   __len__~   s    z_ChainMap.__len__c             C   s   t t j| j S )N)iterr#   r2   r)   )r   r   r   r   __iter__   s    z_ChainMap.__iter__c                s   t  fdd| jD S )Nc             3   s   | ]} |kV  qd S )Nr   ).0m)r   r   r   	<genexpr>   s    z)_ChainMap.__contains__.<locals>.<genexpr>)anyr)   )r   r   r   )r   r   __contains__   s    z_ChainMap.__contains__c             C   s   dj | djtt| jS )Nz{0.__class__.__name__}({1})z, )formatjoinmapreprr)   )r   r   r   r   __repr__   s    z_ChainMap.__repr__c             G   s   | t j|f| S )z?Create a ChainMap with a single dict created from the iterable.)dictfromkeys)clsiterableargsr   r   r   rA      s    z_ChainMap.fromkeysc             C   s$   | j | jd j f| jdd  S )zb
        New ChainMap or subclass with a new copy of
        maps[0] and refs to maps[1:]
        r      N)	__class__r)   copy)r   r   r   r   rG      s    z_ChainMap.copyc             C   s   | j i f| j S )z;New ChainMap with a new dict followed by all previous maps.)rF   r)   )r   r   r   r   	new_child   s    z_ChainMap.new_childc             C   s   | j | jdd  S )zNew ChainMap from maps[1:].rE   N)rF   r)   )r   r   r   r   parents   s    z_ChainMap.parentsc             C   s   || j d |< d S )Nr   )r)   )r   r   valuer   r   r   __setitem__   s    z_ChainMap.__setitem__c             C   s8   y| j d |= W n" tk
r2   tdj|Y nX d S )Nr   z(Key not found in the first mapping: {!r})r)   r+   r;   )r   r   r   r   r   __delitem__   s    z_ChainMap.__delitem__c             C   s0   y| j d j S  tk
r*   tdY nX dS )zj
        Remove and return an item pair from maps[0].
        Raise KeyError is maps[0] is empty.
        r   z#No keys found in the first mapping.N)r)   popitemr+   )r   r   r   r   rM      s    z_ChainMap.popitemc             G   s>   y| j d j|f| S  tk
r8   tdj|Y nX dS )zq
        Remove *key* from maps[0] and return its value.
        Raise KeyError if *key* not in maps[0].
        r   z(Key not found in the first mapping: {!r}N)r)   popr+   r;   )r   r   rD   r   r   r   rN      s    z_ChainMap.popc             C   s   | j d j  dS )z'Clear maps[0], leaving maps[1:] intact.r   N)r)   clear)r   r   r   r   rO      s    z_ChainMap.clear)N)r!   r   __qualname__r    r*   r,   r.   r0   r3   r5   r:   r&   r?   classmethodrA   rG   __copy__rH   propertyrI   rK   rL   rM   rN   rO   r   r   r   r   r'   Z   s&   


r'   )ChainMapABCZ__ABC)__metaclass__c               @   s*   e Zd ZdZejdd Zedd ZdS )	_PathLikezCAbstract base class for implementing the file system path protocol.c             C   s   t dS )z9Return the file system path representation of the object.N)NotImplementedError)r   r   r   r   
__fspath__   s    z_PathLike.__fspath__c             C   s   t t|dptot|tjS )NrY   )boolhasattrpathlib
issubclassPath)rB   subclassr   r   r   __subclasshook__   s    
z_PathLike.__subclasshook__N)	r!   r   rP   r    abcabstractmethodrY   rQ   r`   r   r   r   r   rW      s   rW   PathLikec             C   s   t | ttfr| S t| d r2t | tjr2t| S t| }y|j| }W n0 tk
rx   t|drf nt	d|j
 Y nX t |ttfr|S t	dj|j
t|j
dS )aa  Return the path representation of a path-like object.

    If str or bytes is passed in, it is returned unchanged. Otherwise the
    os.PathLike interface is used to get the path representation. If the
    path representation is not str or bytes, TypeError is raised. If the
    provided path is not str, bytes, or os.PathLike, TypeError is raised.
    rY   z/expected str, bytes or os.PathLike object, not z7expected {}.__fspath__() to return str or bytes, not {}N)
isinstancestrbytesr[   r\   r^   typerY   AttributeError	TypeErrorr!   r;   )path	path_type	path_reprr   r   r   _fspath   s$    
rm   fspath)r   )*
__future__r   r   r   r   ra   oscollections.abcr   ImportErrorcollectionsr   r   Zordereddictr\   ior	   systhreadr
   _thread_dummy_thread__all__version_infoPY2PY3re   
native_strevalr   r&   r'   rT   r$   ABCMetaobjectr@   Z_ABCrW   rc   rm   rn   r   r   r   r   <module>   sd   


n
&