From d00d79499f4db7439b6036f3dd8e16666c217ac1 Mon Sep 17 00:00:00 2001 From: John Davis Date: Fri, 12 Apr 2024 14:50:15 -0400 Subject: [PATCH] Start removing type:ingore comments from SA2.0 PR --- lib/galaxy/managers/notification.py | 8 +++----- lib/galaxy/managers/sharable.py | 2 +- lib/galaxy/model/store/__init__.py | 2 +- lib/galaxy/workflow/modules.py | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/galaxy/managers/notification.py b/lib/galaxy/managers/notification.py index cbb1265f26ce..f480325d8818 100644 --- a/lib/galaxy/managers/notification.py +++ b/lib/galaxy/managers/notification.py @@ -275,8 +275,8 @@ def update_broadcasted_notification(self, notification_id: int, request: Notific def get_user_notification_preferences(self, user: User) -> UserNotificationPreferences: """Gets the user's current notification preferences or the default ones if no preferences are set.""" current_notification_preferences = ( - user.preferences[NOTIFICATION_PREFERENCES_SECTION_NAME] # type:ignore[index] - if NOTIFICATION_PREFERENCES_SECTION_NAME in user.preferences # type:ignore[operator] + user.preferences[NOTIFICATION_PREFERENCES_SECTION_NAME] + if NOTIFICATION_PREFERENCES_SECTION_NAME in user.preferences else None ) try: @@ -291,9 +291,7 @@ def update_user_notification_preferences( """Updates the user's notification preferences with the requested changes.""" notification_preferences = self.get_user_notification_preferences(user) notification_preferences.update(request.preferences) - user.preferences[NOTIFICATION_PREFERENCES_SECTION_NAME] = ( - notification_preferences.model_dump_json() - ) # type:ignore[index] + user.preferences[NOTIFICATION_PREFERENCES_SECTION_NAME] = notification_preferences.model_dump_json() with transaction(self.sa_session): self.sa_session.commit() return notification_preferences diff --git a/lib/galaxy/managers/sharable.py b/lib/galaxy/managers/sharable.py index 35e1afec570d..1f607f5d2589 100644 --- a/lib/galaxy/managers/sharable.py +++ b/lib/galaxy/managers/sharable.py @@ -179,7 +179,7 @@ def share_with(self, item, user: User, flush: bool = True): """ # precondition: user has been validated # get or create - existing = self.get_share_assocs(item, user=user) # type:ignore[dict-item] + existing = self.get_share_assocs(item, user=user) if existing: return existing.pop(0) return self._create_user_share_assoc(item, user, flush=flush) diff --git a/lib/galaxy/model/store/__init__.py b/lib/galaxy/model/store/__init__.py index 012a7d0cc53d..806a3beca05f 100644 --- a/lib/galaxy/model/store/__init__.py +++ b/lib/galaxy/model/store/__init__.py @@ -2175,7 +2175,7 @@ def export_history( # Write collections' attributes (including datasets list) to file. stmt_hdca = ( select(model.HistoryDatasetCollectionAssociation) - .where(model.HistoryDatasetCollectionAssociation.history == history) # type:ignore[arg-type] + .where(model.HistoryDatasetCollectionAssociation.history == history) .where(model.HistoryDatasetCollectionAssociation.deleted == expression.false()) ) collections = sa_session.scalars(stmt_hdca) diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index d64bfdfca942..68d9d9e9e5e3 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -2516,13 +2516,13 @@ def inject(self, step: WorkflowStep, step_args=None, steps=None, **kwargs): If step_args is provided from a web form this is applied to generate 'state' else it is just obtained from the database. """ - step.upgrade_messages = {} # type: ignore[assignment] + step.upgrade_messages = {} # Make connection information available on each step by input name. step.setup_input_connections_by_name() # Populate module. - module = step.module = module_factory.from_workflow_step(self.trans, step, **kwargs) # type: ignore[assignment] + module = step.module = module_factory.from_workflow_step(self.trans, step, **kwargs) # Any connected input needs to have value DummyDataset (these # are not persisted so we need to do it every time)