B
    `                 @   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mZ d dlmZ d	d
 Zdd ZdZdd ZG dd deZdd Zdd Zn:d dlmZmZ dd Zdd
 ZdZdd ZejZdd Zdd Ze ZdS )    )absolute_importdivisionprint_functionN   PyPy)      )OrderedDict)MappingSequence)IterableUserDictc             C   s   t | ttjfS )N)
isinstancetypetypesZ	ClassType)klass r   T/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/attr/_compat.pyisclass   s    r   c             C   s   i }|| t | ||S )zP
        A minimal stub of types.new_class that we need for make_class.
        )r   )namebaseskwds	exec_bodynsr   r   r   	new_class   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__4   s    zReadOnlyDict.__setitem__c             C   s   t dd S )Nz/'mappingproxy' object has no attribute 'update')AttributeError)r   _r   r   r   update:   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__@   s    zReadOnlyDict.__delitem__c             C   s   t dd S )Nz.'mappingproxy' object has no attribute 'clear')r"   )r   r   r   r   clearF   s    zReadOnlyDict.clearNc             C   s   t dd S )Nz,'mappingproxy' object has no attribute 'pop')r"   )r   r   defaultr   r   r   popL   s    zReadOnlyDict.popc             C   s   t dd S )Nz0'mappingproxy' object has no attribute 'popitem')r"   )r   r   r   r   popitemR   s    zReadOnlyDict.popitemc             C   s   t dd S )Nz3'mappingproxy' object has no attribute 'setdefault')r"   )r   r   r'   r   r   r   
setdefaultX   s    zReadOnlyDict.setdefaultc             C   s   dt | j d S )Nzmappingproxy())reprdata)r   r   r   r   __repr__^   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   resr   r   r   metadata_proxyb   s    r4   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_warng   s    r7   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.
        zRunning interpreter doesn't sufficiently support code object introspection.  Some features like bare super() or accessing __class__ will not work with slotted classes.r   )
stacklevelN)warningswarnRuntimeWarning)r5   r6   r   r   r   r7   q   s    c             C   s
   t | tS )N)r   r   )r   r   r   r   r   ~   s    classc             C   s   |   S )N)items)r   r   r   r   r      s    c             C   s   t t| S )N)r   MappingProxyTypedict)r   r   r   r   r4      s    c                 s0  t rdd } | S dd }ytr&|j}n|j}|jdks@|jdkrDttjdkrb|j	|j|jd n`|j
g}tsz||j ||j|j|j|j|j|j|j|j|j|j|j|j|jg tj|   fd	d} d
d }tr| jd }n| jd }| |d |jdkrtW n tk
r&   tS X | S dS )z|Return a function of two arguments (cell, value) which sets
    the value stored in the closure cell `cell` to `value`.
    c             S   s   |  |f d S )N)__setstate__)cellvaluer   r   r   set_closure_cell   s    z/make_set_closure_cell.<locals>.set_closure_cellc                s   |  d S )Nc                  s    S )Nr   r   )xr   r   force_x_to_be_a_cell   s    zQmake_set_closure_cell.<locals>.set_first_cellvar_to.<locals>.force_x_to_be_a_cellr   )rB   rE   r   )rD   r   set_first_cellvar_to   s    z3make_set_closure_cell.<locals>.set_first_cellvar_to)rD   r   )r      )co_cellvarsco_freevarsc                s    t  i dd| f}|| d S )Nsetterr   )r   FunctionType)rA   rB   rJ   )set_first_freevar_coder   r   rC      s    c                 s   d   fdd} | S )Nc                  s    S )Nr   r   )rD   r   r   func   s    z@make_set_closure_cell.<locals>.make_func_with_cell.<locals>.funcr   )rM   r   )rD   r   make_func_with_cell   s    z2make_set_closure_cell.<locals>.make_func_with_cellr   d   N) PYPYPY2	func_code__code__rH   rI   AssertionErrorsysversion_inforeplaceco_argcountappendco_kwonlyargcountextend
co_nlocalsco_stacksizeco_flagsco_code	co_constsco_namesco_varnamesco_filenameco_nameco_firstlineno	co_lnotabr   CodeTypeZfunc_closure__closure__cell_contents	Exceptionr7   )rC   rF   cor5   rN   rA   r   )rL   r   make_set_closure_cell   sT    




rl   )
__future__r   r   r   platformrU   r   r9   rV   rQ   python_implementationrP   r?   Zordered_dictcollectionsr	   r
   r   UserDictr   r   r   ZTYPEr   r   r4   r7   collections.abcrl   rC   r   r   r   r   <module>   s:   
3
f