1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 03:12:34 +01:00

Adding new types and updating device parameters to use them.

- added caseless_string type. This behaves exactly like a string, except
  this ignores case in comparisons. It does, however, preserve case. E.g.

	>>> s = caseless_string('Test')
	>>> s == 'test'
	True
	>>> print s
	Test

- added list_of type generating function. This allows to dynamically
  generate type-safe list types based on an existing type. E.g.

	>>> list_of_bool = list_of(bool)
	>>> list_of_bool(['foo', 0, 1, '', True])
	[True, False, True, False, True]

- Update core_names Device Parameter to be of type caseless_string
This commit is contained in:
Sergei Trofimov
2015-04-09 11:32:06 +01:00
parent 070b2230c9
commit 3112eb0a9b
2 changed files with 56 additions and 2 deletions

View File

@@ -36,7 +36,7 @@ from contextlib import contextmanager
from wlauto.core.extension import Extension, ExtensionMeta, AttributeCollection, Parameter
from wlauto.exceptions import DeviceError, ConfigError
from wlauto.utils.types import list_of_strings, list_of_integers
from wlauto.utils.types import list_of_integers, list_of, caseless_string
__all__ = ['RuntimeParameter', 'CoreParameter', 'Device', 'DeviceMeta']
@@ -137,7 +137,7 @@ class Device(Extension):
__metaclass__ = DeviceMeta
parameters = [
Parameter('core_names', kind=list_of_strings, mandatory=True, default=None,
Parameter('core_names', kind=list_of(caseless_string), mandatory=True, default=None,
description="""
This is a list of all cpu cores on the device with each
element being the core type, e.g. ``['a7', 'a7', 'a15']``. The