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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 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
11 # in the documentation and/or other materials provided with the 11 # in the documentation and/or other materials provided with the
12 # distribution. 12 # distribution.
13 # * Neither the Google name nor the names of its 13 # * Neither the Google name nor the names of its
14 # contributors may be used to endorse or promote products derived from 14 # contributors may be used to endorse or promote products derived from
15 # this software without specific prior written permission. 15 # this software without specific prior written permission.
16 # 16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 import copy 29 import copy
30 from functools import reduce
30 31
31 32
32 class TestConfiguration(object): 33 class TestConfiguration(object):
33 34
34 def __init__(self, version, architecture, build_type): 35 def __init__(self, version, architecture, build_type):
35 self.version = version 36 self.version = version
36 self.architecture = architecture 37 self.architecture = architecture
37 self.build_type = build_type 38 self.build_type = build_type
38 39
39 @classmethod 40 @classmethod
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 # FIXME: This seems extra-awful. 130 # FIXME: This seems extra-awful.
130 for cat2, spec2 in configuration.items(): 131 for cat2, spec2 in configuration.items():
131 if category == cat2: 132 if category == cat2:
132 continue 133 continue
133 matching_sets_by_category.setdefault(specifier, {}).setdefau lt(cat2, set()).add(spec2) 134 matching_sets_by_category.setdefault(specifier, {}).setdefau lt(cat2, set()).add(spec2)
134 for collapsing_set in self._collapsing_sets_by_category.values(): 135 for collapsing_set in self._collapsing_sets_by_category.values():
135 self._collapsing_sets_by_size.setdefault(len(collapsing_set), set()) .add(frozenset(collapsing_set)) 136 self._collapsing_sets_by_size.setdefault(len(collapsing_set), set()) .add(frozenset(collapsing_set))
136 137
137 for specifier, sets_by_category in matching_sets_by_category.items(): 138 for specifier, sets_by_category in matching_sets_by_category.items():
138 for category, set_by_category in sets_by_category.items(): 139 for category, set_by_category in sets_by_category.items():
139 if len(set_by_category) == 1 and self._specifier_sorter.category _priority(category) > self._specifier_sorter.specifier_priority(specifier): 140 if len(set_by_category) == 1 and self._specifier_sorter.category _priority(
141 category) > self._specifier_sorter.specifier_priority(sp ecifier):
140 self._junk_specifier_combinations[specifier] = set_by_catego ry 142 self._junk_specifier_combinations[specifier] = set_by_catego ry
141 143
142 self._specifier_sorter.add_macros(configuration_macros) 144 self._specifier_sorter.add_macros(configuration_macros)
143 145
144 def specifier_sorter(self): 146 def specifier_sorter(self):
145 return self._specifier_sorter 147 return self._specifier_sorter
146 148
147 def _expand_macros(self, specifier): 149 def _expand_macros(self, specifier):
148 expanded_specifiers = self._configuration_macros.get(specifier) 150 expanded_specifiers = self._configuration_macros.get(specifier)
149 return expanded_specifiers or [specifier] 151 return expanded_specifiers or [specifier]
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 specifiers_to_remove = [] 303 specifiers_to_remove = []
302 for specifier_set in specifiers_list: 304 for specifier_set in specifiers_list:
303 if macro_keys <= specifier_set: 305 if macro_keys <= specifier_set:
304 specifiers_to_remove.append(specifier_set) 306 specifiers_to_remove.append(specifier_set)
305 307
306 for specifier_set in specifiers_to_remove: 308 for specifier_set in specifiers_to_remove:
307 specifiers_list.remove(specifier_set) 309 specifiers_list.remove(specifier_set)
308 specifiers_list.append(frozenset(specifier_set - macro_keys)) 310 specifiers_list.append(frozenset(specifier_set - macro_keys))
309 311
310 return specifiers_list 312 return specifiers_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698