B
    *U\                 @   s  d dl mZmZmZ d dlZd dlZd dlZd dlZejd  dkZ	e
 dkZesdejdd dkrjeZnd dlmZ eZe	rd dlmZ d dlmZmZ d	d
 ZdZdd ZG dd deZdd Zdd Zn4d dlmZmZ dd Zdd
 ZdZdd Zdd Zdd Zdd Ze ZdS )    )absolute_importdivisionprint_functionN   ZPyPy)      )OrderedDict)IterableUserDict)MappingSequencec             C   s   t | ttjfS )N)
isinstancetypetypesZ	ClassType)klass r   +lib/python3.7/site-packages/attr/_compat.pyisclass   s    r   r   c             C   s   |   S )N)	iteritems)dr   r   r   r   !   s    r   c               @   sT   e Zd ZdZdd Zdd Zdd Zdd	 ZdddZdd Z	dddZ
dd Zd
S )ReadOnlyDictz5
        Best-effort read-only dict wrapper.
        c             C   s   t dd S )Nz6'mappingproxy' object does not support item assignment)	TypeError)selfkeyvalr   r   r   __setitem__*   s    zReadOnlyDict.__setitem__c             C   s   t dd S )Nz/'mappingproxy' object has no attribute 'update')AttributeError)r   _r   r   r   update0   s    zReadOnlyDict.updatec             C   s   t dd S )Nz4'mappingproxy' object does not support item deletion)r   )r   r   r   r   r   __delitem__6   s    zReadOnlyDict.__delitem__c             C   s   t dd S )Nz.'mappingproxy' object has no attribute 'clear')r   )r   r   r   r   clear<   s    zReadOnlyDict.clearNc             C   s   t dd S )Nz,'mappingproxy' object has no attribute 'pop')r   )r   r   defaultr   r   r   popB   s    zReadOnlyDict.popc             C   s   t dd S )Nz0'mappingproxy' object has no attribute 'popitem')r   )r   r   r   r   popitemH   s    zReadOnlyDict.popitemc             C   s   t dd S )Nz3'mappingproxy' object has no attribute 'setdefault')r   )r   r   r    r   r   r   
setdefaultN   s    zReadOnlyDict.setdefaultc             C   s   dt | j d S )Nzmappingproxy())reprdata)r   r   r   r   __repr__T   s    zReadOnlyDict.__repr__)N)N)__name__
__module____qualname____doc__r   r   r   r   r!   r"   r#   r'   r   r   r   r   r   %   s   

r   c             C   s   t  }|j|  |S )N)r   r&   r   )r   Zresr   r   r   metadata_proxyX   s    r,   c              O   s   dS )z
        We only warn on Python 3 because we are not aware of any concrete
        consequences of not setting the cell on Python 2.
        Nr   )argskwr   r   r   	just_warn]   s    r/   c              O   s   t jdtdd dS )z
        We only warn on Python 3 because we are not aware of any concrete
        consequences of not setting the cell on Python 2.
        zkMissing ctypes.  Some features like bare super() or accessing __class__ will not work with slotted classes.r   )
stacklevelN)warningswarnRuntimeWarning)r-   r.   r   r   r   r/   g   s    c             C   s
   t | tS )N)r   r   )r   r   r   r   r   s   s    classc             C   s   |   S )N)items)r   r   r   r   r   x   s    c             C   s   t t| S )N)r   MappingProxyTypedict)r   r   r   r   r,   {   s    c              C   s   ddl } | S )z0
    Moved into a function for testability.
    r   N)ctypes)r8   r   r   r   import_ctypes   s    r9   c              C   sT   t rdd } nBy(t }|jj} |j|jf| _|j| _W n tk
rN   t	} Y nX | S )z0
    Moved into a function for testability.
    c             S   s   |  |f d S )N)__setstate__)Zcellvaluer   r   r   set_closure_cell   s    z/make_set_closure_cell.<locals>.set_closure_cell)
PYPYr9   Z	pythonapiZ
PyCell_SetZ	py_objectZargtypesZc_intZrestype	Exceptionr/   )r<   r8   r   r   r   make_set_closure_cell   s    

r?   )Z
__future__r   r   r   platformsysr   r1   version_infoZPY2Zpython_implementationr=   r7   Zordered_dictcollectionsr   UserDictr	   r
   r   r   ZTYPEr   r   r,   r/   Zcollections.abcr9   r?   r<   r   r   r   r   <module>   s8   3
	