Skip to content

Commit

Permalink
fixed type errors raised on pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tgalvin committed Dec 3, 2024
1 parent d957406 commit 4c47a9f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion flint/prefect/common/imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def task_convolve_image(

if remove_original_images:
logger.info(f"Removing {len(image_paths)} input images")
_ = [image_path.unlink() for image_path in image_paths]
_ = [image_path.unlink() for image_path in image_paths] # type: ignore

return convolved_images

Expand Down
2 changes: 1 addition & 1 deletion flint/prefect/flows/continuum_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def process_science_fields(

archive_wait_for: List[Any] = []

strategy: Strategy = _load_and_copy_strategy(
strategy: Optional[Strategy] = _load_and_copy_strategy(
output_split_science_path=output_split_science_path,
imaging_strategy=field_options.imaging_strategy,
)
Expand Down
20 changes: 13 additions & 7 deletions flint/prefect/flows/subtract_cube_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from pathlib import Path
from time import sleep
from typing import Tuple, Optional, Union, List
from typing import Tuple, Optional, Union

import numpy as np
from configargparse import ArgumentParser
Expand Down Expand Up @@ -59,7 +59,7 @@ def _check_and_verify_options(
), "Calibrate container path is needede for addmodel"
assert (
options.calibrate_container.exists()
and options.calibrate_container.is_file
and options.calibrate_container.is_file()
), f"Calibrate container {options.calibrate_container} is not a file"


Expand Down Expand Up @@ -94,7 +94,7 @@ def find_and_setup_mss(
science_path_or_mss: Union[Path, Tuple[MS, ...]],
expected_ms_count: int,
data_column: str,
) -> Tuple[MS]:
) -> Tuple[MS, ...]:
"""Search for MSs in a directory and, if necessary, perform checks around
their consistency. If the input data appear to be collection of MSs already
assume they have already been set and checked for consistency.
Expand All @@ -108,12 +108,12 @@ def find_and_setup_mss(
FrequencyMismatchError: Raised when frequency information is not consistent
Returns:
Tuple[MS]: Collection of MSs
Tuple[MS, ...]: Collection of MSs
"""

if isinstance(science_path_or_mss, (list, tuple)):
logger.info("Already loaded MSs")
return (sms for sms in science_path_or_mss)
return tuple(sms for sms in science_path_or_mss)

# Find the MSs
# - optionally untar?
Expand Down Expand Up @@ -148,7 +148,7 @@ def task_addmodel_to_ms(
name_path=ms.path, pol=pol
)
assert (
wsclean_source_list_path.exists
wsclean_source_list_path.exists()
), f"{wsclean_source_list_path=} was requested, but does not exist"

# This should attempt to add model of different polarisations together.
Expand All @@ -159,6 +159,9 @@ def task_addmodel_to_ms(
mode="c" if idx == 0 else "a",
datacolumn="MODEL_DATA",
)
assert (
addmodel_subtract_options.calibrate_container is not None
), f"{addmodel_subtract_options.calibrate_container=}, which should not happen"
add_model(
add_model_options=addmodel_options,
container=addmodel_subtract_options.calibrate_container,
Expand All @@ -174,7 +177,7 @@ def flow_addmodel_to_mss(
addmodel_subtract_field_options: AddModelSubtractFieldOptions,
expected_ms: int,
data_column: str,
) -> List[MS]:
) -> Tuple[MS, ...]:
"""Separate flow to perform the potentially expensive model prediction
into MSs"""
_check_and_verify_options(options=addmodel_subtract_field_options)
Expand Down Expand Up @@ -230,6 +233,9 @@ def flow_subtract_cube(
# ms=science_mss,
# addmodel_subtract_options=unmapped(addmodel_subtract_field_options),
# )
assert (
addmodel_subtract_field_options.addmodel_cluster_config is not None
), f"{addmodel_subtract_field_options.addmodel_cluster_config=}, which should not happen"
addmodel_dask_runner = get_dask_runner(
cluster=addmodel_subtract_field_options.addmodel_cluster_config
)
Expand Down

0 comments on commit 4c47a9f

Please sign in to comment.