From c7cf01acb1d0178d508274eea98e8fdfb393a863 Mon Sep 17 00:00:00 2001 From: Tyler Pauly Date: Fri, 4 Oct 2024 14:29:56 -0400 Subject: [PATCH] no init attr with no datamodels pr --- jwst/stpipe/core.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/jwst/stpipe/core.py b/jwst/stpipe/core.py index a450411cbb..c3e17326de 100644 --- a/jwst/stpipe/core.py +++ b/jwst/stpipe/core.py @@ -102,8 +102,10 @@ def finalize_result(self, result, reference_files_used): if hasattr(result, 'cal_logs'): tmpdict = result.cal_logs.instance - tmpdict[self.class_alias] = '\n'.join(self._log_records) - result.cal_logs = tmpdict + else: + tmpdict = dict() + tmpdict[self.class_alias] = '\n'.join(self._log_records) + result.cal_logs = tmpdict def remove_suffix(self, name): return remove_suffix(name) @@ -126,9 +128,11 @@ def finalize_result(self, result, reference_files_used): if hasattr(result, 'cal_logs'): tmpdict = result.cal_logs.instance - tmpdict[self.class_alias] = '\n'.join(self._log_records) + else: + tmpdict = dict() + tmpdict[self.class_alias] = '\n'.join(self._log_records) - for _, step in self.step_defs.items(): - if step.class_alias in tmpdict.keys(): - del tmpdict[step.class_alias] - result.cal_logs = tmpdict + for _, step in self.step_defs.items(): + if step.class_alias in tmpdict.keys(): + del tmpdict[step.class_alias] + result.cal_logs = tmpdict