o
    Ñó·i¡  ã                   @   s0   d Z ddlmZmZ dd„ Zdd„ Zdd„ Zd	S )
z
Python introspection helpers.
é    )ÚCodeTypeÚFunctionTypec                    sx   t tdƒrˆjdi dd„ ˆ  ¡ D ƒ¤ŽS g d¢}t tdƒr#| dd¡ t tdƒr.| dd	¡ ‡ ‡fd
d„|D ƒ}t|Ž S )NÚreplacec                 S   s   i | ]	\}}d | |“qS ©Zco_© )Ú.0ÚkÚvr   r   ú\C:\Users\psant\Downloads\PAF backend\school\venv\Lib\site-packages\automat/_introspection.pyÚ
<dictcomp>
   s    zcopycode.<locals>.<dictcomp>)ZargcountZnlocalsZ	stacksizeÚflagsÚcodeZconstsÚnamesÚvarnamesÚfilenameÚnameZfirstlinenoZlnotabZfreevarsZcellvarsÚco_kwonlyargcounté   ZkwonlyargcountÚco_posonlyargcountZposonlyargcountc              	      s"   g | ]}ˆ   |tˆd | ƒ¡‘qS r   ©ÚgetÚgetattr©r   r   ©ÚchangesÚtemplater   r
   Ú
<listcomp>    s   " zcopycode.<locals>.<listcomp>r   )Úhasattrr   r   ÚitemsÚinsert)r   r   r   Úvaluesr   r   r
   Úcopycode   s   


r!   c                    s4   g d¢}‡ ‡fdd„|D ƒ}t tˆj|ƒg|¢R Ž S )N)Úglobalsr   ÚdefaultsÚclosurec              	      s&   g | ]}ˆ   |tˆd | d  ƒ¡‘qS )Ú__r   r   ©Úfuncchangesr   r   r
   r   +   s    ÿz copyfunction.<locals>.<listcomp>)Úfunctionr!   Ú__code__)r   r'   Zcodechangesr   r    r   r&   r
   Úcopyfunction$   s
   ÿr*   c                    s   ‡ fdd„}|S )zL
    Preserve the name of the given function on the decorated function.
    c                    s   t | tˆ jd�tˆ jd�ƒS )N)r   )r*   ÚdictÚ__name__)Z	decorated©Úfr   r
   Ú	decorator6   s   zpreserveName.<locals>.decoratorNr   )r.   r/   r   r-   r
   ÚpreserveName1   s   r0   N)	Ú__doc__Útypesr   r   r   r(   r!   r*   r0   r   r   r   r
   Ú<module>   s
    