From fcb5b7befed9dc9dec25dc19834c3f2ff9df8566 Mon Sep 17 00:00:00 2001 From: Michal Grzadkowski Date: Thu, 26 Jan 2023 15:00:06 -0500 Subject: [PATCH] fixing a specific Ubuntu version for integrity tests --- .github/workflows/test.yml | 2 +- vatic/model_data.py | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9d9eee8..98589ad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ on: jobs: ref: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 diff --git a/vatic/model_data.py b/vatic/model_data.py index 14894c8..1854d2b 100644 --- a/vatic/model_data.py +++ b/vatic/model_data.py @@ -47,7 +47,7 @@ def __copy__(self): return VaticModelData(copy(self._data)) def __deepcopy__(self, memo): - return VaticModelData(deepcopy(self._data)) + return VaticModelData(deepcopy(self._data, memo)) def clone_in_service(self) -> VModelData: """Returns a version of this grid without out-of-service elements.""" @@ -69,15 +69,14 @@ def elements(self, **element_args) -> Iterator[tuple[str, dict]]: """Retrieves grid elements that match a set of criteria. - Args - ---- - element_type Which type of element to search within, e.g. 'bus', - 'generator', 'load', 'branch', etc. - element_args A set of element property values, all of which must - be present in an element's data entry and equal to - the given value for the element's entry to be - returned. e.g. generator_type='renewable' - bus='Chifa' + Arguments + --------- + element_type Which type of element to search within, e.g. 'bus', + 'generator', 'load', 'branch', etc. + element_args A set of element property values, all of which must be + present in an element's data entry and equal to the + given value for the element's entry to be returned. + e.g. generator_type='renewable' bus='Chifa' """ if element_type not in self._data['elements']: @@ -115,10 +114,11 @@ def attributes(self, element_type: str, **element_args) -> dict: return attr_dict - def get_system_attr(self, attr: str, default: Any = None) -> Any: + def get_system_attr(self, attr: str, default: Optional[Any] = None) -> Any: if attr in self._data['system']: return self._data['system'][attr] + # throw error if the attribute is missing and no default value is given elif default is None: raise ModelError("This model does not include the system-level " "attribute `{}`!".format(attr))