B
    Áì2ai  ã               @   s®   d Z dddddgZi Zddd„Zdd„ Zye W n ek
rD   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 )z¤Helper to provide extensibility for pickle.

This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.
Ú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   )Zob_typeZpickle_functionZconstructor_ob© r	   ú3/var/www/html/prediksi/Python-3.7.12/Lib/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ì   |dk st ‚x*| jjD ]}t|dƒr|jt@ sP qW t}|tkrFd }n || jkr^td|j ƒ‚|| ƒ}| j||f}y
| j	}W nN t
k
rÊ   t| dd ƒr¢tdƒd ‚y
| j}W n t
k
rÄ   d }Y nX Y nX |ƒ }|ràt||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)ÚAssertionErrorÚ	__class__Ú__mro__Úhasattrr   Ú	_HEAPTYPEr   r   Ú__name__Ú__getstate__ÚAttributeErrorÚgetattrÚ__dict__r   )ÚselfÚprotor   r   ÚargsÚgetstateÚdictr	   r	   r
   Ú
_reduce_ex6   s2    



r*   c             G   s   | j | f|žŽ S )N)r   )r   r'   r	   r	   r
   Ú
__newobj__W   s    r+   c             C   s   | j | f|ž|ŽS )zUsed by pickle protocol 4, instead of __newobj__ to allow classes with
    keyword-only arguments to be pickled correctly.
    )r   )r   r'   Úkwargsr	   r	   r
   Ú__newobj_ex__Z   s    r-   c             C   sà   | j  d¡}|dk	r|S g }t| dƒs(nœxš| 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 )a›  Return a list of slot names for a given class.

    This needs to find slots defined by the class and its bases, so we
    can't simply return the __slots__ attribute.  We must walk down
    the Method Resolution Order and concatenate the __slots__ of each
    class found there.  (This assumes classes don't modify their
    __slots__ attribute to misrepresent their slots after the class is
    defined.)
    Ú__slotnames__Nr   )r$   Ú__weakref__Ú__Ú_z_%s%s)r$   Úgetr   r   Ú
isinstanceÚstrÚ
startswithÚendswithr    ÚlstripÚappendr.   )r   Únamesr   ZslotsÚnameZ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r†td|t| f ƒ‚|t|< |t|< dS )zRegister an extension code.é   iÿÿÿzcode out of rangeNz)key %s is already registered with code %sz$code %s is already in use for key %s)ÚintÚ
ValueErrorÚ_extension_registryr2   Ú_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 )z0Unregister an extension code.  For testing only.z%key %s is not registered with code %sN)r?   r2   r@   r>   Ú_extension_cache)rA   r:   rB   rC   r	   r	   r
   r   ´   s    c               C   s   t  ¡  d S )N)rD   Úclearr	   r	   r	   r
   r   À   s    )N)Ú__doc__Ú__all__r   r   r   r   Ú	NameErrorr   r   r   r*   r+   r-   r;   r?   r@   rD   r   r   r   r	   r	   r	   r
   Ú<module>   s.   


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