class_docstr: Wrapper that uses Cython
class_docstr_tok: ["Wrapper","that","uses","Cython"]
docstr: Write a Cython file with Python wrappers
  
  This file contains all the definitions of the routines in c code and
  refers to the header file.
  
  Arguments
  ---------
  routines
      List of Routine instances
  f
      File-like object to write the file to
  prefix
      The filename prefix, used to refer to the proper header file.
      Only the basename of the prefix is used.
docstr_tok: ["Write","a","Cython","file","with","Python","wrappers","This","file","contains","all","the","definitions","of","the","routines","in","c","code","and","refers","to","the","header","file",".","Arguments","--","--","--","--","-","routines","List","of","Routine","instances","f","File-like","object","to","write","the","file","to","prefix","The","filename","prefix",",","used","to","refer","to","the","proper","header","file",".","Only","the","basename","of","the","prefix","is","used","."]
code: def dump_pyx(self, routines, f, prefix):
      """Write a Cython file with Python wrappers
  
      This file contains all the definitions of the routines in c code and
      refers to the header file.
  
      Arguments
      ---------
      routines
          List of Routine instances
      f
          File-like object to write the file to
      prefix
          The filename prefix, used to refer to the proper header file.
          Only the basename of the prefix is used.
      """
      headers = []
      functions = []
      for routine in routines:
          prototype = self.generator.get_prototype(routine)
  
          # C Function Header Import
          headers.append(
              self.pyx_header.format(
                  header_file=prefix, prototype=prototype
              )
          )
  
          # Partition the C function arguments into categories
          py_rets, py_args, py_loc, py_inf = self._partition_args(
              routine.arguments
          )
  
          # Function prototype
          name = routine.name
          arg_string = ", ".join(
              self._prototype_arg(arg) for arg in py_args
          )
  
          # Local Declarations
          local_decs = []
          for arg, val in py_inf.items():
              proto = self._prototype_arg(arg)
              mat, ind = [self._string_var(v) for v in val]
              local_decs.append(
                  "    cdef {} = {}.shape[{}]".format(proto, mat, ind)
              )
          local_decs.extend(
              [
                  "    cdef {}".format(self._declare_arg(a))
                  for a in py_loc
              ]
          )
          declarations = "\n".join(local_decs)
          if declarations:
              declarations = declarations + "\n"
  
          # Function Body
          args_c = ", ".join(
              [self._call_arg(a) for a in routine.arguments]
          )
          rets = ", ".join([self._string_var(r.name) for r in py_rets])
          if routine.results:
              body = "    return %s(%s)" % (routine.name, args_c)
              if rets:
                  body = body + ", " + rets
          else:
              body = "    %s(%s)\n" % (routine.name, args_c)
              body = body + "    return " + rets
  
          functions.append(
              self.pyx_func.format(
                  name=name,
                  arg_string=arg_string,
                  declarations=declarations,
                  body=body,
              )
          )
  
      # Write text to file
      if self._need_numpy:
          # Only import numpy if required
          f.write(self.pyx_imports)
      f.write("\n".join(headers))
      f.write("\n".join(functions))
  
imports: import sys
  import os
  import shutil
  import tempfile
  from subprocess import STDOUT, CalledProcessError, check_output
  from string import Template
  from warnings import warn
  from sympy.core.cache import cacheit
  from sympy.core.function import Lambda
  from sympy.core.relational import Eq
  from sympy.core.symbol import Dummy, Symbol
  from sympy.tensor.indexed import Idx, IndexedBase
  from sympy.utilities.codegen import make_routine, get_code_generator, OutputArgument, InOutArgument, InputArgument, CodeGenArgumentListError, Result, ResultBase, C99CodeGen
  from sympy.utilities.iterables import iterable
  from sympy.utilities.lambdify import implemented_function
  from sympy.utilities.decorator import doctest_depends_on
label_desc: Use image node_id 5 for calling the CythonCodeWrapper obj's underlying member method code with example usage: obj.dump_pyx(routines, f, prefix) without return types