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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py

Issue 546133003: Reformat webkitpy.layout_tests w/ format-webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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
Index: Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py b/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
index c4faef51e5ff6d73ee708adf0173d9cea2da508a..d23e60a61f7fe0d2d1294a7d46ce2b1fb2b85a0d 100644
--- a/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
+++ b/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
@@ -31,8 +31,8 @@ import logging
_log = logging.getLogger(__name__)
-_JSON_PREFIX = "ADD_RESULTS("
-_JSON_SUFFIX = ");"
+_JSON_PREFIX = 'ADD_RESULTS('
+_JSON_SUFFIX = ');'
def has_json_wrapper(string):
@@ -56,7 +56,7 @@ def write_json(filesystem, json_object, file_path, callback=None):
# Specify separators in order to get compact encoding.
json_string = json.dumps(json_object, separators=(',', ':'))
if callback:
- json_string = callback + "(" + json_string + ");"
+ json_string = callback + '(' + json_string + ');'
filesystem.write_text_file(file_path, json_string)
@@ -65,9 +65,9 @@ def convert_trie_to_flat_paths(trie, prefix=None):
result = {}
for name, data in trie.iteritems():
if prefix:
- name = prefix + "/" + name
+ name = prefix + '/' + name
- if len(data) and not "results" in data:
+ if len(data) and not 'results' in data:
result.update(convert_trie_to_flat_paths(data, name))
else:
result[name] = data
@@ -77,11 +77,11 @@ def convert_trie_to_flat_paths(trie, prefix=None):
def add_path_to_trie(path, value, trie):
"""Inserts a single flat directory path and associated value into a directory trie structure."""
- if not "/" in path:
+ if not '/' in path:
trie[path] = value
return
- directory, slash, rest = path.partition("/")
+ directory, slash, rest = path.partition('/')
if not directory in trie:
trie[directory] = {}
add_path_to_trie(rest, value, trie[directory])
@@ -111,6 +111,7 @@ def test_timings_trie(individual_test_timings):
# FIXME: We already have a TestResult class in test_results.py
class TestResult(object):
+
"""A simple class that represents a single test result."""
# Test modifier constants.
@@ -125,7 +126,7 @@ class TestResult(object):
try:
test_name = test.split('.')[1]
except IndexError:
- _log.warn("Invalid test name: %s.", test)
+ _log.warn('Invalid test name: %s.', test)
pass
if test_name.startswith('FAILS_'):

Powered by Google App Engine
This is Rietveld 408576698