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

Unified Diff: tools/traceline/traceline/scripts/split.py

Issue 8678023: Fix python scripts in src/tools/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: tools/traceline/traceline/scripts/split.py
diff --git a/tools/traceline/traceline/scripts/split.py b/tools/traceline/traceline/scripts/split.py
old mode 100755
new mode 100644
index 9e9f7ddd83168fe8d1b09ea7d1ccc4a465f2788d..610eb80255cc00ef7e0e297488084be570b0f431
--- a/tools/traceline/traceline/scripts/split.py
+++ b/tools/traceline/traceline/scripts/split.py
@@ -1,25 +1,31 @@
+#!/usr/bin/env python
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-# Splits a single json file (read from stdin) into separate files of 40k
-# records, named split.X.
+"""Splits a single json file (read from stdin) into separate files of 40k
+records, named split.X.
+"""
import sys
-filecount = 0;
-count = 0;
-f = open('split.0', 'wb');
+def main():
+ filecount = 0
+ count = 0
+ f = open('split.0', 'wb')
+ for l in sys.stdin:
+ if l == "},\r\n":
+ count += 1
+ if count == 40000:
+ f.write("}]);\r\n")
+ count = 0
+ filecount += 1
+ f = open('split.%d' % filecount, 'wb')
+ f.write("parseEvents([\r\n")
+ continue
+ f.write(l)
-for l in sys.stdin:
- if l == "},\r\n":
- count += 1
- if count == 40000:
- f.write("}]);\r\n")
- count = 0;
- filecount += 1
- f = open('split.%d' % filecount, 'wb');
- f.write("parseEvents([\r\n")
- continue
- f.write(l)
+
+if __name__ == '__main__':
+ main()

Powered by Google App Engine
This is Rietveld 408576698