Skip to content

Commit

Permalink
TEST: remove duck-typing in save
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Jun 28, 2024
1 parent bf3a877 commit c21b3fb
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/stpipe/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,22 +516,10 @@ def run(self, *args):
idx = None
if isinstance(result, AbstractDataModel):
self.save_model(result, idx=idx)
elif hasattr(result, "save"):
try:
output_path = self.make_output_path(idx=idx)
except AttributeError:
self.log.warning(
"`save_results` has been requested, but cannot"
" determine filename."
)
self.log.warning(
"Specify an output file with `--output_file` or set"
" `--save_results=false`"
)
else:
self.log.info("Saving file %s", output_path)
result.save(output_path, overwrite=True)

else:
if hasattr(result, "save"):
raise Exception(f"non-datamodel result with a save: {result}")
# what has "save"? Does anything ever reach this code
if not self.skip:
self.log.info("Step %s done", self.name)
finally:
Expand Down

0 comments on commit c21b3fb

Please sign in to comment.