| 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 class ParseException(Exception): | 10 class ParseException(Exception): |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 return type(other) == type(self) and other.name == self.name | 348 return type(other) == type(self) and other.name == self.name |
| 349 | 349 |
| 350 def __ne__(self, other): | 350 def __ne__(self, other): |
| 351 return not (self == other) | 351 return not (self == other) |
| 352 | 352 |
| 353 class _PropertyTypeInfo(_Enum): | 353 class _PropertyTypeInfo(_Enum): |
| 354 def __init__(self, is_fundamental, name): | 354 def __init__(self, is_fundamental, name): |
| 355 _Enum.__init__(self, name) | 355 _Enum.__init__(self, name) |
| 356 self.is_fundamental = is_fundamental | 356 self.is_fundamental = is_fundamental |
| 357 | 357 |
| 358 def __repr__(self): |
| 359 return self.name |
| 360 |
| 358 class PropertyType(object): | 361 class PropertyType(object): |
| 359 """Enum of different types of properties/parameters. | 362 """Enum of different types of properties/parameters. |
| 360 """ | 363 """ |
| 361 INTEGER = _PropertyTypeInfo(True, "integer") | 364 INTEGER = _PropertyTypeInfo(True, "integer") |
| 362 INT64 = _PropertyTypeInfo(True, "int64") | 365 INT64 = _PropertyTypeInfo(True, "int64") |
| 363 DOUBLE = _PropertyTypeInfo(True, "double") | 366 DOUBLE = _PropertyTypeInfo(True, "double") |
| 364 BOOLEAN = _PropertyTypeInfo(True, "boolean") | 367 BOOLEAN = _PropertyTypeInfo(True, "boolean") |
| 365 STRING = _PropertyTypeInfo(True, "string") | 368 STRING = _PropertyTypeInfo(True, "string") |
| 366 ENUM = _PropertyTypeInfo(False, "enum") | 369 ENUM = _PropertyTypeInfo(False, "enum") |
| 367 ARRAY = _PropertyTypeInfo(False, "array") | 370 ARRAY = _PropertyTypeInfo(False, "array") |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 def _GetPlatforms(json): | 471 def _GetPlatforms(json): |
| 469 if 'platforms' not in json: | 472 if 'platforms' not in json: |
| 470 return None | 473 return None |
| 471 platforms = [] | 474 platforms = [] |
| 472 for platform_name in json['platforms']: | 475 for platform_name in json['platforms']: |
| 473 for platform_enum in _Enum.GetAll(Platforms): | 476 for platform_enum in _Enum.GetAll(Platforms): |
| 474 if platform_name == platform_enum.name: | 477 if platform_name == platform_enum.name: |
| 475 platforms.append(platform_enum) | 478 platforms.append(platform_enum) |
| 476 break | 479 break |
| 477 return platforms | 480 return platforms |
| OLD | NEW |