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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 | 439 |
440 def __str__(self): | 440 def __str__(self): |
441 return repr(self) | 441 return repr(self) |
442 | 442 |
443 | 443 |
444 class _PropertyTypeInfo(_Enum): | 444 class _PropertyTypeInfo(_Enum): |
445 def __init__(self, is_fundamental, name): | 445 def __init__(self, is_fundamental, name): |
446 _Enum.__init__(self, name) | 446 _Enum.__init__(self, name) |
447 self.is_fundamental = is_fundamental | 447 self.is_fundamental = is_fundamental |
448 | 448 |
| 449 def __repr__(self): |
| 450 return self.name |
449 | 451 |
450 class PropertyType(object): | 452 class PropertyType(object): |
451 """Enum of different types of properties/parameters. | 453 """Enum of different types of properties/parameters. |
452 """ | 454 """ |
453 ANY = _PropertyTypeInfo(False, "any") | 455 ANY = _PropertyTypeInfo(False, "any") |
454 ARRAY = _PropertyTypeInfo(False, "array") | 456 ARRAY = _PropertyTypeInfo(False, "array") |
455 BINARY = _PropertyTypeInfo(False, "binary") | 457 BINARY = _PropertyTypeInfo(False, "binary") |
456 BOOLEAN = _PropertyTypeInfo(True, "boolean") | 458 BOOLEAN = _PropertyTypeInfo(True, "boolean") |
457 CHOICES = _PropertyTypeInfo(False, "choices") | 459 CHOICES = _PropertyTypeInfo(False, "choices") |
458 DOUBLE = _PropertyTypeInfo(True, "double") | 460 DOUBLE = _PropertyTypeInfo(True, "double") |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 # Sanity check: platforms should not be an empty list. | 588 # Sanity check: platforms should not be an empty list. |
587 if not json['platforms']: | 589 if not json['platforms']: |
588 raise ValueError('"platforms" cannot be an empty list') | 590 raise ValueError('"platforms" cannot be an empty list') |
589 platforms = [] | 591 platforms = [] |
590 for platform_name in json['platforms']: | 592 for platform_name in json['platforms']: |
591 for platform_enum in _Enum.GetAll(Platforms): | 593 for platform_enum in _Enum.GetAll(Platforms): |
592 if platform_name == platform_enum.name: | 594 if platform_name == platform_enum.name: |
593 platforms.append(platform_enum) | 595 platforms.append(platform_enum) |
594 break | 596 break |
595 return platforms | 597 return platforms |
OLD | NEW |