diff --git a/lib/galaxy/managers/history_contents.py b/lib/galaxy/managers/history_contents.py index cbb0f9fa3051..5c8795270e02 100644 --- a/lib/galaxy/managers/history_contents.py +++ b/lib/galaxy/managers/history_contents.py @@ -437,7 +437,7 @@ def _contained_id_map(self, id_list): query = ( self._session() .query(component_class) - .filter(component_class.id.in_(id_list)) + .filter(component_class.id.in_(id_list)) # type: ignore[attr-defined] .options(undefer(component_class._metadata)) .options(joinedload(component_class.dataset).joinedload(model.Dataset.actions)) .options(joinedload(component_class.tags)) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 7ae306105b4b..2b931668a18d 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -4277,7 +4277,7 @@ def datatype_for_extension(extension, datatypes_registry=None) -> "Data": return ret -class DatasetInstance(UsesCreateAndUpdateTime, _HasTable): +class DatasetInstance(RepresentById, UsesCreateAndUpdateTime, _HasTable): """A base class for all 'dataset instances', HDAs, LDAs, etc""" states = Dataset.states diff --git a/lib/galaxy/model/store/__init__.py b/lib/galaxy/model/store/__init__.py index b70b6740bba8..ea10a0bca4d7 100644 --- a/lib/galaxy/model/store/__init__.py +++ b/lib/galaxy/model/store/__init__.py @@ -205,10 +205,10 @@ def commit(self) -> None: def flush(self) -> None: pass - def add(self, obj: Union[model.DatasetInstance, model.RepresentById]) -> None: + def add(self, obj: model.RepresentById) -> None: self.objects[obj.__class__][obj.id] = obj - def query(self, model_class: Type) -> Bunch: + def query(self, model_class: model.RepresentById) -> Bunch: def find(obj_id): return self.objects.get(model_class, {}).get(obj_id) or None @@ -218,7 +218,7 @@ def filter_by(*args, **kwargs): return Bunch(find=find, get=find, filter_by=filter_by) - def get(self, model_class: Type, primary_key: Any): # patch for SQLAlchemy 2.0 compatibility + def get(self, model_class: model.RepresentById, primary_key: Any): # patch for SQLAlchemy 2.0 compatibility return self.query(model_class).get(primary_key) @@ -894,7 +894,7 @@ def materialize_elements(dc): def _attach_raw_id_if_editing( self, - obj: Union[model.DatasetInstance, model.RepresentById], + obj: model.RepresentById, attrs: Dict[str, Any], ) -> None: if self.sessionless and "id" in attrs and self.import_options.allow_edit: @@ -1272,7 +1272,7 @@ def _import_implicit_collection_jobs(self, object_import_tracker: "ObjectImportT self._session_add(icj) - def _session_add(self, obj: Union[model.DatasetInstance, model.RepresentById]) -> None: + def _session_add(self, obj: model.RepresentById) -> None: self.sa_session.add(obj) def _flush(self) -> None: @@ -1961,7 +1961,7 @@ def add(src, dest): def exported_key( self, - obj: Union[model.DatasetInstance, model.RepresentById], + obj: model.RepresentById, ) -> Union[str, int]: return self.serialization_options.get_identifier(self.security, obj)