Skip to content

Commit

Permalink
Proper subclassing of ModelManager generic class
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Jan 22, 2025
1 parent db98387 commit 86fea60
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 12 deletions.
1 change: 0 additions & 1 deletion lib/galaxy/managers/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class DatasetManager(base.ModelManager[Dataset], secured.AccessibleManagerMixin,
Manipulate datasets: the components contained in DatasetAssociations/DatasetInstances/HDAs/LDDAs
"""

model_class = Dataset
foreign_key_name = "dataset"
app: MinimalManagerApp

Expand Down
1 change: 0 additions & 1 deletion lib/galaxy/managers/hdas.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class HDAManager(
Interface/service object for interacting with HDAs.
"""

model_class = HistoryDatasetAssociation
foreign_key_name = "history_dataset_association"

tag_assoc = model.HistoryDatasetAssociationTagAssociation
Expand Down
3 changes: 1 addition & 2 deletions lib/galaxy/managers/hdcas.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def set_collection_attributes(dataset_element, *payload):

# TODO: to DatasetCollectionInstanceManager
class HDCAManager(
base.ModelManager,
base.ModelManager[model.HistoryDatasetCollectionAssociation],
secured.AccessibleManagerMixin,
secured.OwnableManagerMixin,
deletable.PurgableManagerMixin,
Expand All @@ -69,7 +69,6 @@ class HDCAManager(
Interface/service object for interacting with HDCAs.
"""

model_class = model.HistoryDatasetCollectionAssociation
foreign_key_name = "history_dataset_collection_association"

tag_assoc = model.HistoryDatasetCollectionTagAssociation
Expand Down
2 changes: 0 additions & 2 deletions lib/galaxy/managers/lddas.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ class LDDAManager(DatasetAssociationManager[LibraryDatasetDatasetAssociation]):
A fairly sparse manager for LDDAs.
"""

model_class = LibraryDatasetDatasetAssociation

def __init__(self, app: MinimalManagerApp):
"""
Set up and initialize other managers needed by lddas.
Expand Down
2 changes: 0 additions & 2 deletions lib/galaxy/managers/library_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
class LibraryDatasetsManager(ModelManager[LibraryDataset]):
"""Interface/service object for interacting with library datasets."""

model_class = LibraryDataset

def __init__(self, app: MinimalManagerApp):
super().__init__(app)
self.ldda_manager = LDDAManager(app)
Expand Down
1 change: 0 additions & 1 deletion lib/galaxy/managers/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class RoleManager(base.ModelManager[model.Role]):
Business logic for roles.
"""

model_class = model.Role
foreign_key_name = "role"

user_assoc = model.UserRoleAssociation
Expand Down
4 changes: 1 addition & 3 deletions lib/galaxy/managers/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@
from galaxy.managers.base import OrmFilterParsersType


class DynamicToolManager(ModelManager):
class DynamicToolManager(ModelManager[model.DynamicTool]):
"""Manages dynamic tools stored in Galaxy's database."""

model_class = model.DynamicTool

def get_tool_by_uuid(self, uuid: Optional[Union[UUID, str]]):
stmt = select(DynamicTool).where(DynamicTool.uuid == uuid)
return self.session().scalars(stmt).one_or_none()
Expand Down

0 comments on commit 86fea60

Please sign in to comment.