Ejemplo n.º 1
0
    def do_text(self, text, args, filename=None):
        if filename:
            print 'Checking file:', filename
        in_file = StringIO(text)
        out_file = StringIO()

        pythontidy.tidy_up(file_in=in_file, file_out = out_file)

        return out_file.getvalue()
Ejemplo n.º 2
0
 def formater(self, pythonshit):
     #- receive text in string format
     #- convert it to file-like object
     inf = StringIO.StringIO()
     ouf = StringIO.StringIO()
     inf.write(pythonshit)
     inf.seek(0)
     #- pass it through the tidyer
     pt.tidy_up(inf, ouf)
     pythonshit = ouf.getvalue()
     #- return the output as string
     return pythonshit
Ejemplo n.º 3
0
 def formater(self, pythonshit):
     #- receive text in string format
     #- convert it to file-like object
     inf = StringIO.StringIO()
     ouf = StringIO.StringIO()
     inf.write(pythonshit)
     inf.seek(0)
     #- pass it through the tidyer
     pt.tidy_up(inf, ouf)
     pythonshit = ouf.getvalue()
     #- return the output as string
     return pythonshit