| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os.path | 5 import os.path |
| 6 | 6 |
| 7 from json_parse import OrderedDict | 7 from json_parse import OrderedDict |
| 8 from memoize import memoize | 8 from memoize import memoize |
| 9 | 9 |
| 10 | 10 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if json_type == 'array': | 180 if json_type == 'array': |
| 181 self.property_type = PropertyType.ARRAY | 181 self.property_type = PropertyType.ARRAY |
| 182 self.item_type = Type( | 182 self.item_type = Type( |
| 183 self, '%sType' % name, json['items'], namespace, origin) | 183 self, '%sType' % name, json['items'], namespace, origin) |
| 184 elif '$ref' in json: | 184 elif '$ref' in json: |
| 185 self.property_type = PropertyType.REF | 185 self.property_type = PropertyType.REF |
| 186 self.ref_type = json['$ref'] | 186 self.ref_type = json['$ref'] |
| 187 elif 'enum' in json and json_type == 'string': | 187 elif 'enum' in json and json_type == 'string': |
| 188 self.property_type = PropertyType.ENUM | 188 self.property_type = PropertyType.ENUM |
| 189 self.enum_values = [EnumValue(value) for value in json['enum']] | 189 self.enum_values = [EnumValue(value) for value in json['enum']] |
| 190 self.absolute = 'absolute' in json |
| 190 elif json_type == 'any': | 191 elif json_type == 'any': |
| 191 self.property_type = PropertyType.ANY | 192 self.property_type = PropertyType.ANY |
| 192 elif json_type == 'binary': | 193 elif json_type == 'binary': |
| 193 self.property_type = PropertyType.BINARY | 194 self.property_type = PropertyType.BINARY |
| 194 elif json_type == 'boolean': | 195 elif json_type == 'boolean': |
| 195 self.property_type = PropertyType.BOOLEAN | 196 self.property_type = PropertyType.BOOLEAN |
| 196 elif json_type == 'integer': | 197 elif json_type == 'integer': |
| 197 self.property_type = PropertyType.INTEGER | 198 self.property_type = PropertyType.INTEGER |
| 198 elif (json_type == 'double' or | 199 elif (json_type == 'double' or |
| 199 json_type == 'number'): | 200 json_type == 'number'): |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 # Sanity check: platforms should not be an empty list. | 567 # Sanity check: platforms should not be an empty list. |
| 567 if not json['platforms']: | 568 if not json['platforms']: |
| 568 raise ValueError('"platforms" cannot be an empty list') | 569 raise ValueError('"platforms" cannot be an empty list') |
| 569 platforms = [] | 570 platforms = [] |
| 570 for platform_name in json['platforms']: | 571 for platform_name in json['platforms']: |
| 571 for platform_enum in _Enum.GetAll(Platforms): | 572 for platform_enum in _Enum.GetAll(Platforms): |
| 572 if platform_name == platform_enum.name: | 573 if platform_name == platform_enum.name: |
| 573 platforms.append(platform_enum) | 574 platforms.append(platform_enum) |
| 574 break | 575 break |
| 575 return platforms | 576 return platforms |
| OLD | NEW |