| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 | 108 |
| 109 # FIXME: Use dict comprehensions once we update the server to python 2.7. | 109 # FIXME: Use dict comprehensions once we update the server to python 2.7. |
| 110 CHAR_TO_FAILURE = dict((value, key) for key, value in FAILURE_TO_CHAR.items()) | 110 CHAR_TO_FAILURE = dict((value, key) for key, value in FAILURE_TO_CHAR.items()) |
| 111 | 111 |
| 112 def _is_directory(subtree): | 112 def _is_directory(subtree): |
| 113 return RESULTS_KEY not in subtree | 113 return RESULTS_KEY not in subtree |
| 114 | 114 |
| 115 | 115 |
| 116 class JsonResults(object): | 116 class JsonResults(object): |
| 117 @staticmethod |
| 118 def is_aggregate_file(name): |
| 119 return name in (JSON_RESULTS_FILE, JSON_RESULTS_FILE_SMALL) |
| 120 |
| 117 @classmethod | 121 @classmethod |
| 118 def _strip_prefix_suffix(cls, data): | 122 def _strip_prefix_suffix(cls, data): |
| 119 if data.startswith(JSON_RESULTS_PREFIX) and data.endswith(JSON_RESULTS_S
UFFIX): | 123 if data.startswith(JSON_RESULTS_PREFIX) and data.endswith(JSON_RESULTS_S
UFFIX): |
| 120 return data[len(JSON_RESULTS_PREFIX):len(data) - len(JSON_RESULTS_SU
FFIX)] | 124 return data[len(JSON_RESULTS_PREFIX):len(data) - len(JSON_RESULTS_SU
FFIX)] |
| 121 return data | 125 return data |
| 122 | 126 |
| 123 @classmethod | 127 @classmethod |
| 124 def _generate_file_data(cls, jsonObject, sort_keys=False): | 128 def _generate_file_data(cls, jsonObject, sort_keys=False): |
| 125 return json.dumps(jsonObject, separators=(',', ':'), sort_keys=sort_keys
) | 129 return json.dumps(jsonObject, separators=(',', ':'), sort_keys=sort_keys
) |
| 126 | 130 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 515 |
| 512 check_json_error_string = cls._check_json(builder, json) | 516 check_json_error_string = cls._check_json(builder, json) |
| 513 if check_json_error_string: | 517 if check_json_error_string: |
| 514 return None | 518 return None |
| 515 | 519 |
| 516 test_list_json = {} | 520 test_list_json = {} |
| 517 tests = json[builder][TESTS_KEY] | 521 tests = json[builder][TESTS_KEY] |
| 518 cls._delete_results_and_times(tests) | 522 cls._delete_results_and_times(tests) |
| 519 test_list_json[builder] = {TESTS_KEY: tests} | 523 test_list_json[builder] = {TESTS_KEY: tests} |
| 520 return cls._generate_file_data(test_list_json) | 524 return cls._generate_file_data(test_list_json) |
| OLD | NEW |