B
    ˜‘[Ò  ã               @   s0   d dl mZ d dlmZ d dlmZ dd„ ZdS )é    )Úchain)ÚDummy)ÚPythonCodePrinterc             C   sX   t ƒ }| | ¡}|jd r2d dd„ |jD ƒ¡}nd dd„ |j ¡ D ƒ¡}|d | S )z= Renders python code as a module (with the required imports) Zfully_qualified_modulesÚ
c             s   s   | ]}d | V  qdS )z	import %sN© )Ú.0Úkr   r   ú4lib/python3.7/site-packages/sympy/codegen/pyutils.pyú	<genexpr>   s    z#render_as_module.<locals>.<genexpr>c             S   s"   g | ]\}}d |d  |¡f ‘qS )zfrom %s import %sz, )Újoin)r   r   Úvr   r   r	   ú
<listcomp>   s   z$render_as_module.<locals>.<listcomp>z

)r   ZdoprintZ	_settingsr   Zmodule_importsÚitems)ZcontentZprinterZpystrZmodule_imports_strr   r   r	   Úrender_as_module   s    


r   N)Ú	itertoolsr   Zsympy.core.symbolr   Zsympy.printing.pycoder   r   r   r   r   r	   Ú<module>   s   