Skip to content

Commit

Permalink
Address review comments and mypy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
natelust committed Jun 30, 2023
1 parent 11053de commit 89015ec
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion doc/changes/DM-39582.api.md

This file was deleted.

1 change: 1 addition & 0 deletions doc/changes/DM-39582.removal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecated reconstituteDimensions argument from `QuantumNode.from_simple`
3 changes: 1 addition & 2 deletions python/lsst/pipe/base/graph/_loadHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from lsst.daf.butler import DimensionUniverse, PersistenceContextVars
from lsst.resources import ResourceHandleProtocol, ResourcePath


if TYPE_CHECKING:
from ._versionDeserializers import DeserializerBase
from .graph import QuantumGraph
Expand Down Expand Up @@ -224,7 +223,7 @@ def load(
# object instantiation.
runner = PersistenceContextVars()
graph = runner.run(self.deserializer.constructGraph, nodeSet, _readBytes, universe)
return graph # type: ignore
return graph

def _readBytes(self, start: int, stop: int) -> bytes:
"""Load the specified byte range from the ResourcePath object
Expand Down
6 changes: 4 additions & 2 deletions python/lsst/pipe/base/graph/quantumNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
__all__ = ("QuantumNode", "NodeId", "BuildId")

import uuid
import warnings
from dataclasses import dataclass
from typing import Any, NewType
import warnings

from lsst.daf.butler import (
DatasetRef,
Expand All @@ -35,6 +35,7 @@
Quantum,
SerializedQuantum,
)
from lsst.utils.introspection import find_outside_stacklevel
from pydantic import BaseModel

from ..pipeline import TaskDef
Expand Down Expand Up @@ -141,7 +142,8 @@ def from_simple(
if recontitutedDimensions is not None:
warnings.warn(
"The recontitutedDimensions argument is now ignored and may be removed after v 27",
category=DeprecationWarning,
category=FutureWarning,
stacklevel=find_outside_stacklevel("lsst.pipe.base"),
)
return QuantumNode(
quantum=Quantum.from_simple(simple.quantum, universe),
Expand Down
8 changes: 4 additions & 4 deletions python/lsst/pipe/base/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def logOutputDatasetName(self) -> str | None:
"""Name of a dataset type for log output from this task, `None` if
logs are not to be saved (`str`)
"""
if cast(PipelineTaskConfig, self.config).saveLogOutput:
if self.config.saveLogOutput:
return acc.LOG_OUTPUT_TEMPLATE.format(label=self.label)
else:
return None
Expand Down Expand Up @@ -623,7 +623,7 @@ def get_data_id(self, universe: DimensionUniverse) -> DataCoordinate:
"""
instrument_class_name = self._pipelineIR.instrument
if instrument_class_name is not None:
instrument_class = doImportType(instrument_class_name)
instrument_class = cast(PipeBaseInstrument, doImportType(instrument_class_name))
if instrument_class is not None:
return DataCoordinate.standardize(instrument=instrument_class.getName(), universe=universe)
return DataCoordinate.makeEmpty(universe)
Expand Down Expand Up @@ -654,8 +654,8 @@ def addTask(self, task: type[PipelineTask] | str, label: str) -> None:
# be defined without label which is not acceptable, use task
# _DefaultName in that case
if isinstance(task, str):
task_class = doImportType(task)
label = task_class._DefaultName
task_class = cast(PipelineTask, doImportType(task))
label = task_class._DefaultName
self._pipelineIR.tasks[label] = pipelineIR.TaskIR(label, taskName)

def removeTask(self, label: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/pipe/base/tests/simpleQGraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def populateButler(
instrument = pipeline.getInstrument()
if instrument is not None:
instrument_class = doImportType(instrument)
instrumentName = instrument_class.getName()
instrumentName = cast(Instrument, instrument_class).getName()
instrumentClass = get_full_type_name(instrument_class)
else:
instrumentName = "INSTR"
Expand Down

0 comments on commit 89015ec

Please sign in to comment.