diff --git a/eds_utils/core/eds.py b/eds_utils/core/eds.py index 0f77b66..b9fbf23 100644 --- a/eds_utils/core/eds.py +++ b/eds_utils/core/eds.py @@ -1,6 +1,7 @@ from datetime import datetime from dataclasses import dataclass, field from typing import Dict, List +from copy import deepcopy from . import DataType from .objects import Variable, Record @@ -301,7 +302,7 @@ def tpdos(self) -> int: def indexes(self) -> List[int]: '''The list of indexes in the OD''' - return sorted(self._data.keys()) + return list(self._data.keys()) @property def mandatory_objects(self) -> List[int]: @@ -375,9 +376,9 @@ def copy_object(self, index: int, subindex: int, new_index: int, new_subindex: i obj = self._data[index] if subindex is None else self._data[index][subindex] if new_subindex is None: - self._data[new_index] = obj + self._data[new_index] = deepcopy(obj) else: - self._data[new_index][new_subindex] = obj + self._data[new_index][new_subindex] = deepcopy(obj) if move: if subindex is None: diff --git a/eds_utils/core/objects.py b/eds_utils/core/objects.py index 7a2abc6..090e3c1 100644 --- a/eds_utils/core/objects.py +++ b/eds_utils/core/objects.py @@ -1,6 +1,7 @@ '''All the object class for the object dictionary''' from dataclasses import dataclass +from typing import List from . import DataType, AccessType, ObjectType @@ -109,10 +110,10 @@ def __delitem__(self, subindex: int): self._data[0].default_value = f'0x{len(self._data) - 1:02X}' @property - def subindexes(self) -> list: + def subindexes(self) -> List[int]: '''Get the list of subindexes''' - return self._data.keys() + return list(self._data.keys()) @property def storage_location(self) -> str: