From 51837d109d49b769b4dddcd75dae01634a64772d 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 3e8fe562fe..2cedc04f1e 100644 --- a/jwst/stpipe/core.py +++ b/jwst/stpipe/core.py @@ -101,8 +101,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) @@ -138,9 +140,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