From ca383a8189c07e6dcfb49c6e9929d1c1506c2bd7 Mon Sep 17 00:00:00 2001 From: John Davis Date: Mon, 12 Feb 2024 19:31:19 -0500 Subject: [PATCH] Move declaration of injected attrs into constructor This fixes integration test failures and mypy errors. For context: https://github.com/galaxyproject/galaxy/pull/14717/files#r1486979280 --- lib/galaxy/model/__init__.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 0ec36d39a4e9..e16b8982c699 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -227,9 +227,8 @@ class DeclarativeMeta(_DeclarativeMeta, type): pass from galaxy.datatypes.data import Data - - # from galaxy.tools import DefaultToolState - # from galaxy.workflow.modules import WorkflowModule + from galaxy.tools import DefaultToolState + from galaxy.workflow.modules import WorkflowModule class _HasTable: table: Table @@ -7841,12 +7840,6 @@ class WorkflowStep(Base, RepresentById): cascade_backrefs=False, ) - # Injected attributes - # TODO: code using these should be refactored to not depend on these non-persistent fields - module = None - state = None - upgrade_messages = None - STEP_TYPE_TO_INPUT_TYPE = { "data_input": "dataset", "data_collection_input": "dataset_collection", @@ -7858,6 +7851,11 @@ def __init__(self): self.uuid = uuid4() self._input_connections_by_name = None self._inputs_by_name = None + # Injected attributes + # TODO: code using these should be refactored to not depend on these non-persistent fields + self.module: Optional["WorkflowModule"] + self.state: Optional["DefaultToolState"] + self.upgrade_messages: Optional[Dict] @reconstructor def init_on_load(self):