
    wg                      >    d dl mZ d dlmZ d dlmZ d dlmZ 	 ddZy)    )chain)Module)Dummy)FCodePrinterNc                 f   |xs ddd}t        |      }t               }t        | t              rt	        d      t        |t        ||g      |       }|j                  |      }ddj                  |j                  j                         D 	cg c]  \  }}	d|dd	j                  |	       c}	}      z  }
|
d
z  }
|
dz  }
|
dd	j                  | D cg c]%  }t        |dd      st        |j                        ' c}      z  z  }
|j                  |j                  |      |
      S c c}	}w c c}w )a   Creates a ``Module`` instance and renders it as a string.

    This generates Fortran source code for a module with the correct ``use`` statements.

    Parameters
    ==========

    definitions : iterable
        Passed to :class:`sympy.codegen.fnodes.Module`.
    name : str
        Passed to :class:`sympy.codegen.fnodes.Module`.
    declarations : iterable
        Passed to :class:`sympy.codegen.fnodes.Module`. It will be extended with
        use statements, 'implicit none' and public list generated from ``definitions``.
    printer_settings : dict
        Passed to ``FCodePrinter`` (default: ``{'standard': 2003, 'source_format': 'free'}``).

    i  free)standardsource_formatz7This function expects to construct a module on its own.z   %s
z   
zuse z, only: z, z   implicit none
z   private
z   public %s
nameN)r   r   
isinstancer   
ValueErrorr   doprintjoinmodule_usesitemsgetattrstrr   replace)definitionsr   declarationsprinter_settingsprinterdummymodfstrkvmodule_use_strnodes               Y/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/sympy/codegen/futils.pyrender_as_moduler!   	   s)   & (Vv+V+,GGE+v&RSS
u\E73[
AC??3D8?8K8K8Q8Q8S/U041 FG		RS/U /U "V VN**Nn$N&{3zt^efjlrtx^yC		N3z){{{N<<.??/U 4{s   !D(D.%D.) N)		itertoolsr   sympy.codegen.fnodesr   sympy.core.symbolr   sympy.printing.fortranr   r!   r"       r    <module>r(      s     ' # / B@r'   