mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-22 12:58:36 +00:00
utils/types: make list_of classes serializable
This commit is contained in:
parent
7d9b6d6dd7
commit
109490ec3e
@ -107,6 +107,12 @@ def list_of(type_):
|
|||||||
def extend(self, other):
|
def extend(self, other):
|
||||||
list.extend(self, map(type_, 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):
|
def __setitem__(self, idx, value):
|
||||||
list.__setitem__(self, idx, type_(value))
|
list.__setitem__(self, idx, type_(value))
|
||||||
|
|
||||||
@ -116,6 +122,8 @@ def list_of(type_):
|
|||||||
"__setitem__": __setitem__,
|
"__setitem__": __setitem__,
|
||||||
"append": append,
|
"append": append,
|
||||||
"extend": extend,
|
"extend": extend,
|
||||||
|
"to_pod": _to_pod,
|
||||||
|
"from_pod": classmethod(from_pod),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user