B
    u9ai                 @   s   d ddddgZ i Zddd Zdd Zye W n ek
r@   Y nX dd	 Zeeee d
d ZdZdd Z	dd Z
dd Zdd Zi Zi Zi Zdd Zdd Zdd ZdS )pickleconstructoradd_extensionremove_extensionclear_extension_cacheNc             C   s,   t |std|t| < |d k	r(t| d S )Nz$reduction functions must be callable)callable	TypeErrordispatch_tabler   )ob_typepickle_functionconstructor_ob r   /usr/lib/python3.7/copyreg.pyr      s
    c             C   s   t | stdd S )Nzconstructors must be callable)r   r   )objectr   r   r   r      s    c             C   s   t | j| jffS )N)complexrealimag)cr   r   r   pickle_complex"   s    r   c             C   s<   |t krt | }n$|| |}|jt jkr8||| |S )N)r   __new____init__)clsbasestateobjr   r   r   _reconstructor)   s    r   i   c             C   s   x*| j jD ]}t|dr
|jt@ s
P q
W t}|tkr:d }n || j krRtd|j || }| j ||f}y
| j}W nN t	k
r   t
| dd rtdd y
| j}W n t	k
r   d }Y nX Y nX | }|rt||fS t|fS d S )N	__flags__zcan't pickle %s objects	__slots__zNa class that defines __slots__ without defining __getstate__ cannot be pickled)	__class____mro__hasattrr   	_HEAPTYPEr   r   __name____getstate__AttributeErrorgetattr__dict__r   )selfprotor   r   argsgetstatedictr   r   r   
_reduce_ex6   s0    



r+   c             G   s   | j | f| S )N)r   )r   r(   r   r   r   
__newobj__W   s    r,   c             C   s   | j | f||S )N)r   )r   r(   kwargsr   r   r   __newobj_ex__Z   s    r.   c             C   s   | j d}|d k	r|S g }t| ds(nx| jD ]}d|j kr0|j d }t|trX|f}xf|D ]^}|dkrnq^q^|dr|ds|j	d}|r|
d||f  q|
| q^|
| q^W q0W y
|| _W n   Y nX |S )N__slotnames__r   )r%   __weakref_____z_%s%s)r%   getr   r   
isinstancestr
startswithendswithr!   lstripappendr/   )r   namesr   slotsnamestrippedr   r   r   
_slotnames`   s2    





r>   c             C   s   t |}d|  krdks&n td| |f}t||krNt||krNd S |tkrjtd|t| f |tkrtd|t| f |t|< |t|< d S )N   izcode out of rangez)key %s is already registered with code %sz$code %s is already in use for key %s)int
ValueError_extension_registryr3   _inverted_registry)moduler<   codekeyr   r   r   r      s    c             C   sR   | |f}t ||ks$t||kr4td||f t |= t|= |tkrNt|= d S )Nz%key %s is not registered with code %s)rB   r3   rC   rA   _extension_cache)rD   r<   rE   rF   r   r   r   r      s    c               C   s   t   d S )N)rG   clearr   r   r   r   r      s    )N)__all__r   r   r   r   	NameErrorr   r   r    r+   r,   r.   r>   rB   rC   rG   r   r   r   r   r   r   r   <module>   s,   


	!<