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

Unified Diff: tools/telemetry/json_format

Issue 1647513002: Delete tools/telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/telemetry/examples/run_benchmark ('k') | tools/telemetry/list_telemetry_unittests » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/json_format
diff --git a/tools/telemetry/json_format b/tools/telemetry/json_format
deleted file mode 100755
index 401594d85cd4f7b6e8534888c2dac78039409b93..0000000000000000000000000000000000000000
--- a/tools/telemetry/json_format
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2015 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.
-import argparse
-import json
-import os
-import sys
-
-
-def GetFormattedJSONString(file_path):
- with open(file_path, 'r') as f:
- json_obj = json.load(f)
- file_content = f.read()
- return json.dumps(
- json_obj, indent=2, sort_keys=True, separators=(',', ': '))
-
-
-def ValidateJSONFormat(file_path):
- with open(file_path, 'r') as f:
- file_content = f.read()
- if file_content != GetFormattedJSONString(file_path):
- raise Exception(
- 'Reformat your JSON file by running: %s --format %s' %
- (__file__, file_path))
- print >> sys.stdout, ('%s passes the JSON format validation' % file_path)
-
-
-def Format(file_path):
- formatted_JSON_string = GetFormattedJSONString(file_path)
- with open(file_path, 'w') as f:
- f.write(formatted_JSON_string)
-
-
-def Main(args):
- description = """A JSON formatting tool.
-
- This is a tool that validate and reformats JSON file so that it complies with
- a certain style. The JSON style imposed by this tool is:
- * JSON array elements and object members are indented with 2 spaces.
- * Dictionaries objects are sorted by key.
- * Items are sperated by ', ' and ': '.
- """
- parser = argparse.ArgumentParser(
- description=description, formatter_class=argparse.RawTextHelpFormatter)
- parser.add_argument('file_path', type=str, help='The path to JSON file.')
- parser.add_argument('--format', action='store_true', default=False,
- help='Format the JSON file.')
- options = parser.parse_args(args)
- if options.format:
- Format(options.file_path)
- return 0
- ValidateJSONFormat(options.file_path)
- return 0
-
-
-if __name__ == '__main__':
- sys.exit(Main(sys.argv[1:]))
« no previous file with comments | « tools/telemetry/examples/run_benchmark ('k') | tools/telemetry/list_telemetry_unittests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698