Skip to content

Commit

Permalink
Mypy fixes: add anno for Lists; type-ignore for HDAs
Browse files Browse the repository at this point in the history
Note: type-ignore is due to imperative mapping of HDAs (and LDDAs). This
will be removed once we map those models declaratively
  • Loading branch information
jdavcs committed Jan 27, 2024
1 parent af53e10 commit 6b87c52
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/galaxy/managers/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
date,
datetime,
)
from typing import List

import sqlalchemy
from boltons.iterutils import remap
Expand Down Expand Up @@ -359,15 +360,15 @@ def replace_dataset_ids(path, key, value):

stmt = select(Job.id).select_from(Job.table.join(stmt_sq, stmt_sq.c.id == Job.id))

data_conditions = []
data_conditions: List = []

# We now build the stmt filters that relate to the input datasets
# that this job uses. We keep track of the requested dataset id in `requested_ids`,
# the type (hda, hdca or lda) in `data_types`
# and the ids that have been used in the job that has already been run in `used_ids`.
requested_ids = []
data_types = []
used_ids = []
used_ids: List = []
for k, input_list in input_data.items():
# k will be matched against the JobParameter.name column. This can be prefixed depending on whethter
# the input is in a repeat, or not (section and conditional)
Expand Down Expand Up @@ -524,7 +525,7 @@ def _build_stmt_for_hda(self, stmt, data_conditions, used_ids, k, v, identifier)
model.HistoryDatasetAssociation.id == e.history_dataset_association_id
)
# b is the HDA used for the job
stmt = stmt.join(b, a.dataset_id == b.id).join(c, c.dataset_id == b.dataset_id)
stmt = stmt.join(b, a.dataset_id == b.id).join(c, c.dataset_id == b.dataset_id) # type:ignore[attr-defined]
name_condition = []
if identifier:
stmt = stmt.join(d)
Expand Down Expand Up @@ -622,7 +623,7 @@ def _build_stmt_for_dce(self, stmt, data_conditions, used_ids, k, v):
),
)
.outerjoin(d, d.id == c.hda_id)
.outerjoin(e, e.dataset_id == d.dataset_id)
.outerjoin(e, e.dataset_id == d.dataset_id) # type:ignore[attr-defined]
)
data_conditions.append(
and_(
Expand All @@ -632,7 +633,7 @@ def _build_stmt_for_dce(self, stmt, data_conditions, used_ids, k, v):
and_(
c.hda_id == b.hda_id,
d.id == c.hda_id,
e.dataset_id == d.dataset_id,
e.dataset_id == d.dataset_id, # type:ignore[attr-defined]
),
),
c.id == v,
Expand Down

0 comments on commit 6b87c52

Please sign in to comment.