| OLD | NEW | 
|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python | 
| 2 | 2 | 
| 3 """ | 3 """ | 
| 4 Copyright 2013 Google Inc. | 4 Copyright 2013 Google Inc. | 
| 5 | 5 | 
| 6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be | 
| 7 found in the LICENSE file. | 7 found in the LICENSE file. | 
| 8 | 8 | 
| 9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer. | 9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer. | 
| 10 """ | 10 """ | 
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 239     meta_dict = {} | 239     meta_dict = {} | 
| 240     for abs_dirpath, dirnames, filenames in os.walk(root): | 240     for abs_dirpath, dirnames, filenames in os.walk(root): | 
| 241       rel_dirpath = os.path.relpath(abs_dirpath, root) | 241       rel_dirpath = os.path.relpath(abs_dirpath, root) | 
| 242       for matching_filename in fnmatch.filter(filenames, pattern): | 242       for matching_filename in fnmatch.filter(filenames, pattern): | 
| 243         abs_path = os.path.join(abs_dirpath, matching_filename) | 243         abs_path = os.path.join(abs_dirpath, matching_filename) | 
| 244         rel_path = os.path.join(rel_dirpath, matching_filename) | 244         rel_path = os.path.join(rel_dirpath, matching_filename) | 
| 245         meta_dict[rel_path] = gm_json.LoadFromFile(abs_path) | 245         meta_dict[rel_path] = gm_json.LoadFromFile(abs_path) | 
| 246     return meta_dict | 246     return meta_dict | 
| 247 | 247 | 
| 248   @staticmethod | 248   @staticmethod | 
|  | 249   def _read_noncomment_lines(path): | 
|  | 250     """Return a list of all noncomment lines within a file. | 
|  | 251 | 
|  | 252     (A "noncomment" line is one that does not start with a '#'.) | 
|  | 253 | 
|  | 254     Args: | 
|  | 255       path: path to file | 
|  | 256     """ | 
|  | 257     lines = [] | 
|  | 258     with open(path, 'r') as fh: | 
|  | 259       for line in fh: | 
|  | 260         if not line.startswith('#'): | 
|  | 261           lines.append(line.strip()) | 
|  | 262     return lines | 
|  | 263 | 
|  | 264   @staticmethod | 
| 249   def _create_relative_url(hashtype_and_digest, test_name): | 265   def _create_relative_url(hashtype_and_digest, test_name): | 
| 250     """Returns the URL for this image, relative to GM_ACTUALS_ROOT_HTTP_URL. | 266     """Returns the URL for this image, relative to GM_ACTUALS_ROOT_HTTP_URL. | 
| 251 | 267 | 
| 252     If we don't have a record of this image, returns None. | 268     If we don't have a record of this image, returns None. | 
| 253 | 269 | 
| 254     Args: | 270     Args: | 
| 255       hashtype_and_digest: (hash_type, hash_digest) tuple, or None if we | 271       hashtype_and_digest: (hash_type, hash_digest) tuple, or None if we | 
| 256           don't have a record of this image | 272           don't have a record of this image | 
| 257       test_name: string; name of the GM test that created this image | 273       test_name: string; name of the GM test that created this image | 
| 258     """ | 274     """ | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 295 | 311 | 
| 296   @staticmethod | 312   @staticmethod | 
| 297   def get_multilevel(input_dict, *keys): | 313   def get_multilevel(input_dict, *keys): | 
| 298     """ Returns input_dict[key1][key2][...], or None if any key is not found. | 314     """ Returns input_dict[key1][key2][...], or None if any key is not found. | 
| 299     """ | 315     """ | 
| 300     for key in keys: | 316     for key in keys: | 
| 301       if input_dict == None: | 317       if input_dict == None: | 
| 302         return None | 318         return None | 
| 303       input_dict = input_dict.get(key, None) | 319       input_dict = input_dict.get(key, None) | 
| 304     return input_dict | 320     return input_dict | 
| OLD | NEW | 
|---|