3
,Z"                 @   s  d Z ddlZdd ZeeZedd ZeejZeejZ	eej
Zdd Zee Zd	d
 Ze ZeeZej  dd Ze ZeeZG dd dZee jZeeZeg jZeeZyeW n: ek
r   ej d ZeeZeejZ dZ[Y nX eejZ!eej"Z#[[[[[f ddfddZ$f dfddZ%dd Z&G dd dZ'ddl(Z)ddl*j+Z,G dd dZ-dd Z.dd e/ D Z0dS )zO
Define names for built-in types that aren't directly accessible as a builtin.
    Nc               C   s   d S )N r   r   r   6/var/www/html/vignarogno/venv/lib64/python3.6/types.py_f   s    r   c               C   s   d S )Nr   r   r   r   r   <lambda>   s    r   c               c   s
   dV  d S )N   r   r   r   r   r   _g   s    r   c                  s   d S )Nr   r   r   r   r   _c   s    r   c               C  s
   d V  d S )Nr   r   r   r   r   _ag   s    r	   c               @   s   e Zd Zdd ZdS )_Cc             C   s   d S )Nr   )selfr   r   r   _m!   s    z_C._mN)__name__
__module____qualname__r   r   r   r   r   r
       s   r
      c             C   s2   t | ||\}}}|dk	r"|| || ||f|S )zBCreate a class object dynamically using the appropriate metaclass.N)prepare_class)namebaseskwdsZ	exec_bodymetansr   r   r   	new_class9   s    r   c             C   s~   |dkri }nt |}d|kr*|jd}n|r<t|d }nt}t|trTt||}t|drp|j| |f|}ni }|||fS )az  Call the __prepare__ method of the appropriate metaclass.

    Returns (metaclass, namespace, kwds) as a 3-tuple

    *metaclass* is the appropriate metaclass
    *namespace* is the prepared class namespace
    *kwds* is an updated copy of the passed in kwds argument with any
    'metaclass' entry removed. If no kwds argument is passed in, this will
    be an empty dict.
    N	metaclassr   __prepare__)dictpoptype
isinstance_calculate_metahasattrr   )r   r   r   r   r   r   r   r   r   @   s    


r   c             C   sB   | }x8|D ]0}t |}t||r"q
t||r2|}q
tdq
W |S )z%Calculate the most derived metaclass.zxmetaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases)r   
issubclass	TypeError)r   r   ZwinnerbaseZ	base_metar   r   r   r   `   s    


r   c               @   sL   e Zd ZdZdddZdddZdd Zd	d
 Zdd Zdd Z	dd Z
dS )DynamicClassAttributea  Route attribute access on a class to __getattr__.

    This is a descriptor, used to define attributes that act differently when
    accessed through an instance and through a class.  Instance access remains
    normal, but access to an attribute through a class will be routed to the
    class's __getattr__ method; this is done by raising AttributeError.

    This allows one to have properties active on an instance, and have virtual
    attributes on the class with the same name (see Enum for an example).

    Nc             C   s>   || _ || _|| _|p|j| _|d k| _tt|dd| _d S )N__isabstractmethod__F)fgetfsetfdel__doc__overwrite_docboolgetattrr$   )r   r%   r&   r'   Zdocr   r   r   __init__}   s    
zDynamicClassAttribute.__init__c             C   s6   |d kr| j r| S t n| jd kr,td| j|S )Nzunreadable attribute)r$   AttributeErrorr%   )r   instanceZ
ownerclassr   r   r   __get__   s    
zDynamicClassAttribute.__get__c             C   s"   | j d krtd| j || d S )Nzcan't set attribute)r&   r-   )r   r.   valuer   r   r   __set__   s    
zDynamicClassAttribute.__set__c             C   s    | j d krtd| j | d S )Nzcan't delete attribute)r'   r-   )r   r.   r   r   r   
__delete__   s    
z DynamicClassAttribute.__delete__c             C   s8   | j r|jnd }t| || j| j|p(| j}| j |_ |S )N)r)   r(   r   r&   r'   )r   r%   Zfdocresultr   r   r   getter   s    zDynamicClassAttribute.getterc             C   s$   t | | j|| j| j}| j|_|S )N)r   r%   r'   r(   r)   )r   r&   r3   r   r   r   setter   s    zDynamicClassAttribute.setterc             C   s$   t | | j| j|| j}| j|_|S )N)r   r%   r&   r(   r)   )r   r'   r3   r   r   r   deleter   s    zDynamicClassAttribute.deleter)NNNN)N)r   r   r   r(   r,   r/   r1   r2   r4   r5   r6   r   r   r   r   r#   q   s   


	r#   c               @   s   e Zd Zdd Zdd Zdd Zdd Zed	d
 Zedd Z	edd Z
edd ZeZe	Ze
ZeZdd Zdd ZeZdS )_GeneratorWrapperc             C   s2   || _ |jtk| _t|dd | _t|dd | _d S )Nr   r   )_GeneratorWrapper__wrapped	__class__GeneratorType_GeneratorWrapper__isgenr+   r   r   )r   Zgenr   r   r   r,      s    z_GeneratorWrapper.__init__c             C   s   | j j|S )N)r8   send)r   valr   r   r   r<      s    z_GeneratorWrapper.sendc             G   s   | j j|f| S )N)r8   throw)r   Ztprestr   r   r   r>      s    z_GeneratorWrapper.throwc             C   s
   | j j S )N)r8   close)r   r   r   r   r@      s    z_GeneratorWrapper.closec             C   s   | j jS )N)r8   gi_code)r   r   r   r   rA      s    z_GeneratorWrapper.gi_codec             C   s   | j jS )N)r8   gi_frame)r   r   r   r   rB      s    z_GeneratorWrapper.gi_framec             C   s   | j jS )N)r8   
gi_running)r   r   r   r   rC      s    z_GeneratorWrapper.gi_runningc             C   s   | j jS )N)r8   gi_yieldfrom)r   r   r   r   rD      s    z_GeneratorWrapper.gi_yieldfromc             C   s
   t | jS )N)nextr8   )r   r   r   r   __next__   s    z_GeneratorWrapper.__next__c             C   s   | j r| jS | S )N)r;   r8   )r   r   r   r   __iter__   s    z_GeneratorWrapper.__iter__N)r   r   r   r,   r<   r>   r@   propertyrA   rB   rC   rD   cr_codecr_frame
cr_runningcr_awaitrF   rG   	__await__r   r   r   r   r7      s   r7   c                s   t  std jtkrt ddjtkr jj}|d@ r@ S |d@ r j}t|j|j	|j
|j|jdB |j|j|j|j|j|j|j|j|j|j _ S tj  fdd}|S )	z2Convert regular generator function to a coroutine.z$types.coroutine() expects a callable__code__Ni         c                 sT    | |}|j tks*|j tkr.|jjd@ r.|S t|tjrPt|tj rPt	|S |S )NrP   )
r9   CoroutineTyper:   rA   co_flagsr   _collections_abc	Generator	Coroutiner7   )argskwargsZcoro)funcr   r   wrapped   s    

zcoroutine.<locals>.wrapped)callabler!   r9   FunctionTyper+   CodeTyperN   rR   co_argcountco_kwonlyargcount
co_nlocalsco_stacksizeco_code	co_constsco_namesco_varnamesco_filenameco_nameco_firstlineno	co_lnotabco_freevarsco_cellvars
_functoolswraps)rX   rR   ZcorY   r   )rX   r   	coroutine   s(    

rm   c             C   s    g | ]}|d d dkr|qS )Nr   _r   ).0nr   r   r   
<listcomp>
  s    rq   )1r(   sysr   r   r[   Z
LambdaTyperN   r\   __dict__MappingProxyTypeimplementationZSimpleNamespacer   r:   r   rQ   r@   r	   ZAsyncGeneratorTyper
   r   Z
MethodTypelenZBuiltinFunctionTypeappendZBuiltinMethodType
ModuleTyper!   exc_infotbZTracebackTypetb_frameZ	FrameTypeZGetSetDescriptorType__globals__ZMemberDescriptorTyper   r   r   r#   	functoolsrk   Zcollections.abcabcrS   r7   rm   globals__all__r   r   r   r   <module>   sR   





 


 :
%7