From 71a601795ccb6c60eef534b5388f96a560f5ae81 Mon Sep 17 00:00:00 2001 From: ayushjariyal Date: Fri, 14 Feb 2025 18:12:16 +0530 Subject: [PATCH] Updating code to pass all tests --- src/aiida/orm/nodes/data/array/xy.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/aiida/orm/nodes/data/array/xy.py b/src/aiida/orm/nodes/data/array/xy.py index b8341b6c02..e13cabd0e8 100644 --- a/src/aiida/orm/nodes/data/array/xy.py +++ b/src/aiida/orm/nodes/data/array/xy.py @@ -186,10 +186,6 @@ def get_y(self) -> list[tuple[str, 'ndarray', str]]: def get_y_arraynames(self) -> list[str]: """Returns the user-provided names of the y-arrays.""" - try: - y_names = self.base.attributes.get('y_names') - if y_names is None: - raise KeyError - return y_names - except (KeyError, AttributeError): - raise NotExistent(f'No y names been set yet!') \ No newline at end of file + y_names = getattr(self.base.attributes, 'y_names', None) + if y_names is None: + raise NotExistent('No y names have been set yet!')