Skip to content

Commit

Permalink
Fix SA2.0 error: list arg to select; mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Mar 4, 2024
1 parent 72f7697 commit 6fb6d95
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7611,16 +7611,17 @@ def copy_tags_from(self, target_user, source_workflow):

def invocation_counts(self) -> InvocationsStateCounts:
sa_session = object_session(self)
assert sa_session
stmt = (
select([WorkflowInvocation.state, func.count(WorkflowInvocation.state)])
select(WorkflowInvocation.state, func.count(WorkflowInvocation.state))
.select_from(StoredWorkflow)
.join(Workflow, Workflow.stored_workflow_id == StoredWorkflow.id)
.join(WorkflowInvocation, WorkflowInvocation.workflow_id == Workflow.id)
.group_by(WorkflowInvocation.state)
.where(StoredWorkflow.id == self.id)
)
rows = sa_session.execute(stmt).all()
rows_as_dict = dict(r for r in rows if r[0] is not None)
rows_as_dict = dict(r for r in rows if r[0] is not None) # type:ignore[arg-type, var-annotated]
return InvocationsStateCounts(rows_as_dict)

def to_dict(self, view="collection", value_mapper=None):
Expand Down

0 comments on commit 6fb6d95

Please sign in to comment.