o
    `                     @   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s2ejdd dkr5eZnd dlmZ eZe	rld 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types	ClassTypeklass r   ./usr/lib/python3/dist-packages/attr/_compat.pyisclass      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 r   )	iteritemsdr   r   r   r   +      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      t d)Nz6'mappingproxy' object does not support item assignment	TypeError)selfkeyvalr   r   r   __setitem__4      zReadOnlyDict.__setitem__c                 C   r$   )Nz/'mappingproxy' object has no attribute 'update'AttributeErrorr'   _r   r   r   update:   r+   zReadOnlyDict.updatec                 C   r$   )Nz4'mappingproxy' object does not support item deletionr%   r.   r   r   r   __delitem__@   r+   zReadOnlyDict.__delitem__c                 C   r$   )Nz.'mappingproxy' object has no attribute 'clear'r,   r'   r   r   r   clearF   r+   zReadOnlyDict.clearNc                 C   r$   )Nz,'mappingproxy' object has no attribute 'pop'r,   r'   r(   defaultr   r   r   popL   r+   zReadOnlyDict.popc                 C   r$   )Nz0'mappingproxy' object has no attribute 'popitem'r,   r2   r   r   r   popitemR   r+   zReadOnlyDict.popitemc                 C   r$   )Nz3'mappingproxy' object has no attribute 'setdefault'r,   r4   r   r   r   
setdefaultX   r+   zReadOnlyDict.setdefaultc                 C   s   dt | j d S )Nzmappingproxy())reprdatar2   r   r   r   __repr__^   s   zReadOnlyDict.__repr__r   )__name__
__module____qualname____doc__r*   r0   r1   r3   r6   r7   r8   r<   r   r   r   r   r#   /   s    

r#   c                 C   s   t  }|j|  |S r   )r#   r;   r0   )r!   resr   r   r   metadata_proxyb   s   rB   c                  O   s   dS )
        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    rG   c                  O   s   t jdtdd dS )rC   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RuntimeWarningrD   r   r   r   rG   q   s
   
c                 C   s
   t | tS r   )r   r   r   r   r   r   r   ~   s   
classc                 C   r   r   )itemsr    r   r   r   r      r"   c                 C   s   t t| S r   )r   MappingProxyTypedictr    r   r   r   rB      s   c                     s(  t rdd } | S dd }z|tr|j}n|j}|jdks |jdkr"ttjdkr1|j	|j|jd n0|j
g}ts=||j ||j|j|j|j|j|j|j|j|j|j|j|j|jg tj|   fd	d} d
d }trt| jd }n| jd }| |d |jdkrtW | S  ty   t Y S w )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 r   )__setstate__)cellvaluer   r   r   set_closure_cell   r   z/make_set_closure_cell.<locals>.set_closure_cellc                    s   |  d S r   r   )rR   force_x_to_be_a_cellr   xr   set_first_cellvar_to   s   z3make_set_closure_cell.<locals>.set_first_cellvar_torU   r   )r      )co_cellvarsco_freevarsc                    s    t  i dd| f}|| d S )Nsetterr   )r   FunctionType)rQ   rR   r[   set_first_freevar_coder   r   rS      s   c                     s   d   fdd} | S )Nc                      s    S r   r   r   rU   r   r   func   s   z@make_set_closure_cell.<locals>.make_func_with_cell.<locals>.funcr   )r_   r   rU   r   make_func_with_cell   s   z2make_set_closure_cell.<locals>.make_func_with_cellr   d   ) PYPYPY2	func_code__code__rY   rZ   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   CodeTypefunc_closure__closure__cell_contents	ExceptionrG   )rS   rW   corE   r`   rQ   r   r]   r   make_set_closure_cell   s^   




r   )
__future__r   r   r   platformrg   r   rI   rh   rc   python_implementationrb   rO   ordered_dictcollectionsr	   r
   r   UserDictr   r   r   TYPEr   r#   rB   rG   collections.abcr   rS   r   r   r   r   <module>   s<    
3

f