def convert(self, path, version, target):
        """Converts the specified source file to a new version number."""
        source = self.comparer.get_representation(path)
        lines = [ '# <fortpy version="{}"></fortpy>\n'.format(version) ]

        for line in self.comparer.template.contents[version].preamble:
            lines.append(line.write(source.preamble, source.version, source.stored) + "\n")

        for line in self.comparer.template.contents[version].body:
            for valueset in source.body:
                lines.append(line.write(valueset, source.version, source.stored) + "\n")

        with open(os.path.expanduser(target), 'w') as f:
            f.writelines(lines)
def convert ( self , path , version , target ) : source = self . comparer . get_representation ( path ) lines = [ '# <fortpy version="{}"></fortpy>\n' . format ( version ) ] for line in self . comparer . template . contents [ version ] . preamble : lines . append ( line . write ( source . preamble , source . version , source . stored ) + "\n" ) for line in self . comparer . template . contents [ version ] . body : for valueset in source . body : lines . append ( line . write ( valueset , source . version , source . stored ) + "\n" ) with open ( os . path . expanduser ( target ) , 'w' ) as f : f . writelines ( lines )
Converts the specified source file to a new version number.