o
    _{™iJ  ã                   @   sò   d Z ddlZddlZddlZdejd< dd„ ZG dd„ deƒZG d	d
„ d
ƒZ	G dd„ deƒZ
G dd„ dƒZdZdZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zed!krweƒ  eƒ  eƒ  eƒ  eƒ  eƒ  eƒ  eƒ  dS dS )"z0
test dill's ability to handle nested functions
é    NTÚrecursec                    s   dg‰‡ ‡fdd„}|S )Nr   c                    s   | ˆ  ˆd  S ©Nr   © )Úaddend©ÚaugendÚzeror   úJ/home/ubuntu/.local/lib/python3.10/site-packages/dill/tests/test_nested.pyÚinner   s   zadder.<locals>.innerr   )r   r
   r   r   r	   Úadder   s   r   c                   @   ó   e Zd Zdd„ Zdd„ ZdS )Úcadderc                 C   ó   || _ dg| _d S r   r   ©Úselfr   r   r   r	   Ú__init__   ó   zcadder.__init__c                 C   ó   || j  | jd  S r   r   ©r   r   r   r   r	   Ú__call__"   ó   zcadder.__call__N©Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r	   r      ó    r   c                   @   r   )Úc2adderc                 C   r   r   r   r   r   r   r	   r   (   r   zc2adder.__init__c                 C   r   r   r   r   r   r   r	   r   ,   r   zc2adder.__call__Nr   r   r   r   r	   r   '   r   r   c                   @   ó   e Zd ZdS )ÚbasicN©r   r   r   r   r   r   r	   r   1   ó    r   c                   @   r   )Úbasic2Nr   r   r   r   r	   r!   5   r    r!   é   é   c                  C   sl   g d¢} t  | ¡}t  t¡}t  t¡}t  |¡}t  |¡}t  |¡}tttj| ƒƒt||j|ƒƒks4J ‚d S )N)r   r#   é   )ÚpickleÚdumpsÚmathÚmapÚloadsÚlistÚsin)ÚaÚpaÚpmathÚpmapÚlaÚlmathÚlmapr   r   r	   Ú
test_basic=   s   





(r3   c                  C   s0   t  t¡} t  | ¡ƒ }t  t¡}t  |¡ƒ }d S ©N)r%   r&   r!   r)   r   )Úpbasic2Ú_pbasic2ÚpbasicÚ_pbasicr   r   r	   Útest_basic_classI   s   

r9   c                  C   ó0   t  t¡} t  | ¡tƒ}|tƒtt ksJ ‚d S r4   )r%   r&   r   r)   ÚxÚy)Úpc2adderÚpc2add5r   r   r	   Útest_c2adderP   ó   
r?   c                  C   r:   r4   )r%   r&   r   r)   r;   r<   )ÚpcadderÚpcadd5r   r   r	   Útest_pickled_cadderV   r@   rC   c                  C   s    t tƒ} | tƒtt ksJ ‚d S r4   )r   r;   r<   )Úadd5r   r   r	   Útest_raw_adder_and_inner\   s   rE   c                  C   r:   r4   )r%   r&   r   r)   r;   r<   )ÚpadderÚpadd5r   r   r	   Útest_pickled_addera   r@   rH   c                  C   s4   t tƒ} t | ¡}t |¡}|tƒtt ksJ ‚d S r4   )r   r;   r%   r&   r)   r<   )rD   ÚpinnerÚp5addr   r   r	   Útest_pickled_innerg   s   

rK   c                  C   sº   zddl m}  W n ty   dd l} Y nw d}tj |¡r-tj |d ¡r-t |d ¡ tj |¡rGt| dƒrGtj | j¡rGt t	| dƒ¡ tj d¡rYt 
d¡s[t d¡ d S d S d S )Nr#   )Útest_moduledictr   ztest_moduledict.pyÚcÚ
__cached__Ú__pycache__)Ú rL   ÚImportErrorÚosÚpathÚexistsÚremoveÚhasattrrN   ÚgetattrÚlistdirÚ
removedirs)rL   Únamer   r   r	   Útest_moduledict_where_not_mainn   s   ÿÿÿr[   Ú__main__)Ú__doc__rR   r'   Údillr%   Úsettingsr   Úobjectr   r   r   r!   r;   r<   r3   r9   r?   rC   rE   rH   rK   r[   r   r   r   r   r	   Ú<module>   s<   
	


ø