def _do_plugin(self, args): print """Running 'python-tidy' plugin""" # Apply the changes: file_changes = {} for filename in args.source_files: if not filename.endswith('.py'): continue with open(filename) as f: old_contents = f.read() try: new_contents = self.do_text(old_contents, args, filename=filename) except: print "Error processing:", f continue if PatchManager.get_patches_for_filename(filename): raise OutstandingChangesException() if old_contents != new_contents: file_changes[filename] = (old_contents, new_contents) PatchManager.create_patchset(file_changes)
def _do_plugin(self, args): print """Running 'Python-whitespace' plugin""" # Apply the changes: file_changes = {} for filename in args.source_files: with open(filename) as f: old_contents = f.read() new_contents = self.do_text(old_contents, args) if PatchManager.get_patches_for_filename(filename): raise OutstandingChangesException() if old_contents != new_contents: file_changes[filename] = (old_contents, new_contents) PatchManager.create_patchset(file_changes)