From af7834dcf26fbd5428ad687d5920386dcf1d31b2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:04:26 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- romancal/datamodels/filetype.py | 6 ++++-- romancal/pipeline/exposure_pipeline.py | 8 ++++---- romancal/regtest/test_wfi_pipeline.py | 11 +++++------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/romancal/datamodels/filetype.py b/romancal/datamodels/filetype.py index 405cca9f0..42d578ec3 100644 --- a/romancal/datamodels/filetype.py +++ b/romancal/datamodels/filetype.py @@ -2,7 +2,9 @@ import os from pathlib import Path from typing import Union + import roman_datamodels as rdm + from romancal.datamodels import ModelContainer @@ -45,10 +47,10 @@ def check(init: Union[os.PathLike, Path, io.FileIO]) -> str: return ext elif isinstance(init, rdm.DataModel): return "DataModel" - + elif isinstance(init, ModelContainer): return "ModelContainer" - + elif hasattr(init, "read") and hasattr(init, "seek"): magic = init.read(5) init.seek(0, 0) diff --git a/romancal/pipeline/exposure_pipeline.py b/romancal/pipeline/exposure_pipeline.py index 7b9b23a4d..56b510a9a 100644 --- a/romancal/pipeline/exposure_pipeline.py +++ b/romancal/pipeline/exposure_pipeline.py @@ -93,14 +93,14 @@ def process(self, input): # extract the members from the asn to run the files through the steps results = ModelContainer() tweakreg_input = ModelContainer() - if file_type == 'asn': + if file_type == "asn": for product in asn["products"]: n_members = len(product["members"]) for member in product["members"]: expos_file.append(member["expname"]) - #results = ModelContainer() - #tweakreg_input = ModelContainer() + # results = ModelContainer() + # tweakreg_input = ModelContainer() for in_file in expos_file: if isinstance(in_file, str): input_filename = basename(in_file) @@ -112,7 +112,7 @@ def process(self, input): # check to see if in_file is defined, if not assume we have a datamodel if in_file is not None: - # Open the file + # Open the file input = rdm.open(in_file) log.info(f"Processing a WFI exposure {in_file}") diff --git a/romancal/regtest/test_wfi_pipeline.py b/romancal/regtest/test_wfi_pipeline.py index ea0b107d2..73911cab7 100644 --- a/romancal/regtest/test_wfi_pipeline.py +++ b/romancal/regtest/test_wfi_pipeline.py @@ -489,19 +489,18 @@ def test_elp_input_dm(rtdata, ignore_asdf_paths): rtdata.get_data(f"WFI/image/{input_data}") dm_input = rdm.open(rtdata.input) - # Test Pipeline with input datamodel + # Test Pipeline with input datamodel output = "r0000101001001001001_01101_0001_WFI01_cal.asdf" rtdata.output = output - ExposurePipeline.call(dm_input, save_results = True) + ExposurePipeline.call(dm_input, save_results=True) rtdata.get_truth(f"truth/WFI/image/{output}") # check that the file exists ( don't duplicate checking contents done above) pipeline = ExposurePipeline() pipeline.log.info( - "Check that the output file exists " - + passfail(os.path.isfile(rtdata.output)) - ) - + "Check that the output file exists " + passfail(os.path.isfile(rtdata.output)) + ) + # Ensure step completion is as expected model = rdm.open(rtdata.output)