Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: tools/telemetry/refactor

Issue 1054113003: Fix bug in v0 refactor script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #! /usr/bin/env python 1 #! /usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import cStringIO 6 import cStringIO
7 import imp 7 import imp
8 import inspect 8 import inspect
9 import os 9 import os
10 import re 10 import re
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 import_group.append(list(import_match.groups())) 100 import_group.append(list(import_match.groups()))
101 continue 101 continue
102 102
103 if not import_group: 103 if not import_group:
104 updated_file.write(line) 104 updated_file.write(line)
105 continue 105 continue
106 106
107 _WriteImports(updated_file, import_group) 107 _WriteImports(updated_file, import_group)
108 import_group = [] 108 import_group = []
109 109
110 Updated_file.write(line) 110 updated_file.write(line)
111 111
112 if import_group: 112 if import_group:
113 _WriteImports(updated_file, import_group) 113 _WriteImports(updated_file, import_group)
114 import_group = [] 114 import_group = []
115 115
116 if original_file == updated_file.getvalue(): 116 if original_file == updated_file.getvalue():
117 return False 117 return False
118 118
119 with open(module_path, 'w') as module_file: 119 with open(module_path, 'w') as module_file:
120 module_file.write(updated_file.getvalue()) 120 module_file.write(updated_file.getvalue())
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 _, ext = os.path.splitext(file_name) 280 _, ext = os.path.splitext(file_name)
281 return ext == '.py' 281 return ext == '.py'
282 282
283 283
284 class RefactorCommand(command_line.SubcommandCommand): 284 class RefactorCommand(command_line.SubcommandCommand):
285 commands = (Count, Mv,) 285 commands = (Count, Mv,)
286 286
287 287
288 if __name__ == '__main__': 288 if __name__ == '__main__':
289 sys.exit(RefactorCommand.main()) 289 sys.exit(RefactorCommand.main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698