code_formatter.py (13663:9b64aeabf9a5) | code_formatter.py (13670:8a98db5a481f) |
---|---|
1# Copyright (c) 2006-2009 Nathan Binkert <nate@binkert.org> 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 140 unchanged lines hidden (view full) --- 149 previous = self._fix_newlines 150 self._fix_newlines = False 151 return previous 152 153 def clear(): 154 self._data = [] 155 156 def write(self, *args): | 1# Copyright (c) 2006-2009 Nathan Binkert <nate@binkert.org> 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 140 unchanged lines hidden (view full) --- 149 previous = self._fix_newlines 150 self._fix_newlines = False 151 return previous 152 153 def clear(): 154 self._data = [] 155 156 def write(self, *args): |
157 f = file(os.path.join(*args), "w") | 157 f = open(os.path.join(*args), "w") |
158 for data in self._data: 159 f.write(data) 160 f.close() 161 162 def __str__(self): 163 data = string.join(self._data, '') 164 self._data = [ data ] 165 return data --- 152 unchanged lines hidden --- | 158 for data in self._data: 159 f.write(data) 160 f.close() 161 162 def __str__(self): 163 data = string.join(self._data, '') 164 self._data = [ data ] 165 return data --- 152 unchanged lines hidden --- |