(self, routines, prefix, to_files=False, header=True, empty=True)
Writes all the source code files for the given routines.

            The generate source is returned as a list of (filename, contents)
            tuples, or is written to files (see options). Each filename consists
            of the given prefix, appended with an appropriate extension.

            ``routines``
                A list of Routine instances to be written
            ``prefix``
                The prefix for the output files
            ``to_files``
                When True, the output is effectively written to files.
                [DEFAULT=False] Otherwise, a list of (filename, contents)
                tuples is returned.
            ``header``
                When True, a header comment is included on top of each source
                file. [DEFAULT=True]
            ``empty``
                When True, empty lines are included to structure the source
                files. [DEFAULT=True]
Writes all the source code files for the given routines.
Writes all the source code files for the given routines .
def write(self, routines, prefix, to_files=False, header=True, empty=True):
        """Writes all the source code files for the given routines.

            The generate source is returned as a list of (filename, contents)
            tuples, or is written to files (see options). Each filename consists
            of the given prefix, appended with an appropriate extension.

            ``routines``
                A list of Routine instances to be written
            ``prefix``
                The prefix for the output files
            ``to_files``
                When True, the output is effectively written to files.
                [DEFAULT=False] Otherwise, a list of (filename, contents)
                tuples is returned.
            ``header``
                When True, a header comment is included on top of each source
                file. [DEFAULT=True]
            ``empty``
                When True, empty lines are included to structure the source
                files. [DEFAULT=True]

        """
        if to_files:
            for dump_fn in self.dump_fns:
                filename = "%s.%s" % (prefix, dump_fn.extension)
                with open(filename, "w") as f:
                    dump_fn(self, routines, f, prefix, header, empty)
        else:
            result = []
            for dump_fn in self.dump_fns:
                filename = "%s.%s" % (prefix, dump_fn.extension)
                contents = StringIO()
                dump_fn(self, routines, contents, prefix, header, empty)
                result.append((filename, contents.getvalue()))
            return result
def write ( self , routines , prefix , to_files = False , header = True , empty = True ) : if to_files : for dump_fn in self . dump_fns : filename = "%s.%s" % ( prefix , dump_fn . extension ) with open ( filename , "w" ) as f : dump_fn ( self , routines , f , prefix , header , empty ) else : result = [ ] for dump_fn in self . dump_fns : filename = "%s.%s" % ( prefix , dump_fn . extension ) contents = StringIO ( ) dump_fn ( self , routines , contents , prefix , header , empty ) result . append ( ( filename , contents . getvalue ( ) ) ) return result