a
    /§»aŠ  ã                   @   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	rØd 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   úF/home/yuhw/wc/pochoir/venv/lib/python3.9/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 r   )Ú	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 deletionr    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   Ú
setdefaultX   s    ÿzReadOnlyDict.setdefaultc                 C   s   dt | jƒ d S )Nzmappingproxy(ú))ÚreprÚdatar,   r   r   r   Ú__repr__^   s    zReadOnlyDict.__repr__)N)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r%   r*   r+   r-   r0   r1   r2   r6   r   r   r   r   r   /   s   

r   c                 C   s   t ƒ }|j | ¡ |S r   )r   r5   r*   )r   Úresr   r   r   Úmetadata_proxyb   s    r<   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    rA   c                  O   s   t jdtdd� dS )r=   z§Running 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ÚRuntimeWarningr>   r   r   r   rA   q   s
    ûc                 C   s
   t | tƒS r   )r   r   r   r   r   r   r   ~   s    Úclassc                 C   s   |   ¡ S r   )Úitemsr   r   r   r   r   ƒ   s    c                 C   s   t  t| ƒ¡S r   )r   ÚMappingProxyTypeÚdictr   r   r   r   r<   ˆ   s    c                     s2  t rdd„ } | S dd„ }zøt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�y(   t Y S 0 | 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 r   )Ú__setstate__)ÚcellÚvaluer   r   r   Úset_closure_cell”   s    z/make_set_closure_cell.<locals>.set_closure_cellc                    s   | ‰ d S )Nc                      s   ˆ S r   r   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   )rL   rP   r   rN   r   Úset_first_cellvar_toœ   s    z3make_set_closure_cell.<locals>.set_first_cellvar_torN   r   )r   é   )Úco_cellvarsÚco_freevarsc                    s    t  ˆ i dd| f¡}||ƒ d S )NÚsetterr   )r   ÚFunctionType)rK   rL   rU   ©Zset_first_freevar_coder   r   rM   Ñ   s    ÿc                     s   d ‰ ‡ fdd„} | S )Nc                      s   ˆ S r   r   r   rN   r   r   Úfuncß   s    z@make_set_closure_cell.<locals>.make_func_with_cell.<locals>.funcr   )rX   r   rN   r   Úmake_func_with_cellÜ   s    z2make_set_closure_cell.<locals>.make_func_with_cellr   éd   N) ÚPYPYÚPY2Ú	func_codeÚ__code__rS   rT   Ú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Ú	ExceptionrA   )rM   rQ   Úcor?   rY   rK   r   rW   r   Úmake_set_closure_cellŒ   sZ    

ÿòÿ


rw   )Ú
__future__r   r   r   Úplatformr`   r   rC   ra   r\   Úpython_implementationr[   rI   Zordered_dictÚcollectionsr	   r
   r   ÚUserDictr   r   r   ZTYPEr   r   r<   rA   Úcollections.abcrw   rM   r   r   r   r   Ú<module>   s:   
3
f