1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-20 20:09:11 +00:00

utils/types: make list_of classes serializable

This commit is contained in:
Sergei Trofimov 2017-10-06 12:55:01 +01:00
parent 7d9b6d6dd7
commit 109490ec3e

View File

@ -107,6 +107,12 @@ def list_of(type_):
def extend(self, other):
list.extend(self, map(type_, other))
def from_pod(cls, pod):
return cls(map(type_, pod))
def _to_pod(self):
return self
def __setitem__(self, idx, value):
list.__setitem__(self, idx, type_(value))
@ -116,6 +122,8 @@ def list_of(type_):
"__setitem__": __setitem__,
"append": append,
"extend": extend,
"to_pod": _to_pod,
"from_pod": classmethod(from_pod),
})