| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 449 |
| 450 def __str__(self): | 450 def __str__(self): |
| 451 return repr(self) | 451 return repr(self) |
| 452 | 452 |
| 453 | 453 |
| 454 class _PropertyTypeInfo(_Enum): | 454 class _PropertyTypeInfo(_Enum): |
| 455 def __init__(self, is_fundamental, name): | 455 def __init__(self, is_fundamental, name): |
| 456 _Enum.__init__(self, name) | 456 _Enum.__init__(self, name) |
| 457 self.is_fundamental = is_fundamental | 457 self.is_fundamental = is_fundamental |
| 458 | 458 |
| 459 def __repr__(self): |
| 460 return self.name |
| 459 | 461 |
| 460 class PropertyType(object): | 462 class PropertyType(object): |
| 461 """Enum of different types of properties/parameters. | 463 """Enum of different types of properties/parameters. |
| 462 """ | 464 """ |
| 463 ANY = _PropertyTypeInfo(False, "any") | 465 ANY = _PropertyTypeInfo(False, "any") |
| 464 ARRAY = _PropertyTypeInfo(False, "array") | 466 ARRAY = _PropertyTypeInfo(False, "array") |
| 465 BINARY = _PropertyTypeInfo(False, "binary") | 467 BINARY = _PropertyTypeInfo(False, "binary") |
| 466 BOOLEAN = _PropertyTypeInfo(True, "boolean") | 468 BOOLEAN = _PropertyTypeInfo(True, "boolean") |
| 467 CHOICES = _PropertyTypeInfo(False, "choices") | 469 CHOICES = _PropertyTypeInfo(False, "choices") |
| 468 DOUBLE = _PropertyTypeInfo(True, "double") | 470 DOUBLE = _PropertyTypeInfo(True, "double") |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 # Sanity check: platforms should not be an empty list. | 598 # Sanity check: platforms should not be an empty list. |
| 597 if not json['platforms']: | 599 if not json['platforms']: |
| 598 raise ValueError('"platforms" cannot be an empty list') | 600 raise ValueError('"platforms" cannot be an empty list') |
| 599 platforms = [] | 601 platforms = [] |
| 600 for platform_name in json['platforms']: | 602 for platform_name in json['platforms']: |
| 601 for platform_enum in _Enum.GetAll(Platforms): | 603 for platform_enum in _Enum.GetAll(Platforms): |
| 602 if platform_name == platform_enum.name: | 604 if platform_name == platform_enum.name: |
| 603 platforms.append(platform_enum) | 605 platforms.append(platform_enum) |
| 604 break | 606 break |
| 605 return platforms | 607 return platforms |
| OLD | NEW |