B
    1H[€  ã               @   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 W n  ek
rl   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 d dlmZ d d	lZyd d
lmZ W nJ ek
�r   yd d
lmZ W n" ek
�r   d d
lmZ Y nX Y nX ejd  dkZejd  dkZ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 d	S )é    )Úabsolute_import)Údivision)Úprint_function)Úunicode_literals)ÚMutableMapping)ÚUserDict)ÚOrderedDict)ÚopenN)Ú	get_identé   é   Ústrc             C   s   d| _ d| _| S )zCraise from_none(ValueError('a')) == raise ValueError('a') from NoneNT)Ú	__cause__Ú__suppress_context__)Úexc© r   úhC:\Users\HIRONO~1\AppData\Local\Temp\pip-install-oj6o2mt1\configparser\backports\configparser\helpers.pyÚ	from_none%   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 ˆ |¡ zˆ| ƒ}W d ˆ |¡ X |S )N)Úidr
   ÚaddÚdiscard)ÚselfÚkeyÚresult)Ú	fillvalueÚrepr_runningÚuser_functionr   r   Úwrapper3   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_function0   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 )z�Initialize 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__U   s    z_ChainMap.__init__c             C   s   t |ƒ‚d S )N)ÚKeyError)r   r   r   r   r   Ú__missing__\   s    z_ChainMap.__missing__c          	   C   s8   x,| j D ]"}y|| S  tk
r(   Y qX qW |  |¡S )N)r)   r+   r,   )r   r   Úmappingr   r   r   Ú__getitem___   s    
z_ChainMap.__getitem__Nc             C   s   || kr| | S |S )Nr   )r   r   Údefaultr   r   r   Úgetg   s    z_ChainMap.getc             C   s   t tƒ j| jŽ ƒS )N)Úlenr#   Úunionr)   )r   r   r   r   Ú__len__j   s    z_ChainMap.__len__c             C   s   t tƒ j| jŽ ƒS )N)Úiterr#   r2   r)   )r   r   r   r   Ú__iter__m   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>q   s    z)_ChainMap.__contains__.<locals>.<genexpr>)Úanyr)   )r   r   r   )r   r   Ú__contains__p   s    z_ChainMap.__contains__c             C   s   d  | d tt| jƒ¡¡S )Nz{0.__class__.__name__}({1})z, )ÚformatÚjoinÚmapÚreprr)   )r   r   r   r   Ú__repr__s   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   x   s    z_ChainMap.fromkeysc             C   s$   | j | jd  ¡ f| jdd… žŽ S )zHNew 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 |¡ƒ‚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  ¡ S  tk
r*   tdƒ‚Y nX dS )zPRemove 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 |¡ƒ‚Y nX dS )zWRemove *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  ¡  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'   H   s&   
r'   )ÚChainMap)r   )Ú
__future__r   r   r   r   Úcollectionsr   r   ÚImportErrorr   ZordereddictÚior	   ÚsysÚthreadr
   Ú_threadÚ_dummy_threadÚversion_infoÚPY2ÚPY3Útyper   r   r&   r'   rT   r   r   r   r   Ú<module>   s>   
`