From 053ca5198eae326a2431710561a455e7464d647e Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 10 Apr 2024 18:25:11 +0100 Subject: [PATCH] Enable ``warn_unused_ignores`` mypy option --- lib/galaxy/__init__.py | 2 +- lib/galaxy/app.py | 2 +- .../app_unittest_utils/toolbox_support.py | 2 +- lib/galaxy/authnz/custos_authnz.py | 2 +- .../datatypes/constructive_solid_geometry.py | 8 +- lib/galaxy/jobs/runners/aws.py | 6 +- lib/galaxy/jobs/runners/util/kill.py | 2 +- lib/galaxy/managers/history_contents.py | 2 +- lib/galaxy/managers/users.py | 2 +- lib/galaxy/managers/workflows.py | 2 +- lib/galaxy/model/__init__.py | 98 +++++++++---------- lib/galaxy/model/migrations/alembic/env.py | 2 +- lib/galaxy/model/store/__init__.py | 4 +- lib/galaxy/objectstore/rucio.py | 28 +++--- lib/galaxy/objectstore/rucio_extra_clients.py | 5 +- lib/galaxy/schema/fetch_data.py | 2 +- .../tool_shed/metadata/metadata_generator.py | 2 +- lib/galaxy/tool_util/parser/output_actions.py | 4 +- lib/galaxy/tool_util/toolbox/watcher.py | 9 +- lib/galaxy/tool_util/verify/__init__.py | 4 +- lib/galaxy/tools/parameters/basic.py | 2 +- lib/galaxy/util/__init__.py | 13 +-- lib/galaxy/util/bool_expressions.py | 2 +- lib/galaxy/util/image_util.py | 2 +- lib/galaxy/util/watcher.py | 6 +- lib/galaxy/util/yaml_util.py | 2 +- lib/galaxy/visualization/genomes.py | 4 +- lib/galaxy/webapps/__init__.py | 2 +- lib/galaxy/webapps/base/webapp.py | 2 +- lib/galaxy/webapps/openapi/utils.py | 2 +- lib/galaxy/workflow/modules.py | 6 +- lib/galaxy_test/api/_framework.py | 2 +- lib/galaxy_test/selenium/framework.py | 6 +- lib/tool_shed/test/base/playwrightbrowser.py | 6 +- lib/tool_shed/test/base/twillbrowser.py | 6 +- lib/tool_shed/webapp/model/__init__.py | 14 +-- mypy.ini | 1 + packages/app/galaxy/__init__.py | 2 +- packages/auth/galaxy/__init__.py | 2 +- packages/config/galaxy/__init__.py | 2 +- packages/data/galaxy/__init__.py | 2 +- packages/files/galaxy/__init__.py | 2 +- packages/job_execution/galaxy/__init__.py | 2 +- packages/job_metrics/galaxy/__init__.py | 2 +- packages/navigation/galaxy/__init__.py | 2 +- packages/objectstore/galaxy/__init__.py | 2 +- packages/package.__init__.py | 3 + packages/schema/galaxy/__init__.py | 2 +- packages/selenium/galaxy/__init__.py | 2 +- packages/test_api/galaxy_test/__init__.py | 2 +- packages/test_base/galaxy_test/__init__.py | 2 +- packages/test_driver/galaxy_test/__init__.py | 2 +- .../test_selenium/galaxy_test/__init__.py | 2 +- packages/tool_util/galaxy/__init__.py | 2 +- packages/tours/galaxy/__init__.py | 2 +- packages/util/galaxy/__init__.py | 2 +- packages/web_apps/galaxy/__init__.py | 2 +- packages/web_framework/galaxy/__init__.py | 2 +- packages/web_stack/galaxy/__init__.py | 2 +- .../test_celery_user_rate_limit.py | 2 +- test/unit/app/jobs/test_job_wrapper.py | 2 +- test/unit/app/managers/test_HistoryManager.py | 2 +- .../unit/app/managers/test_markdown_export.py | 20 ++-- test/unit/app/queue_worker/conftest.py | 2 +- test/unit/data/security/test_vault.py | 16 +-- test/unit/job_execution/test_job_io.py | 2 +- test/unit/tool_util/toolbox/test_watcher.py | 5 +- tools/filters/gff/gff_filter_by_attribute.py | 2 +- 68 files changed, 177 insertions(+), 187 deletions(-) mode change 100644 => 120000 packages/app/galaxy/__init__.py mode change 100644 => 120000 packages/auth/galaxy/__init__.py mode change 100644 => 120000 packages/config/galaxy/__init__.py mode change 100644 => 120000 packages/data/galaxy/__init__.py mode change 100644 => 120000 packages/files/galaxy/__init__.py mode change 100644 => 120000 packages/job_execution/galaxy/__init__.py mode change 100644 => 120000 packages/job_metrics/galaxy/__init__.py mode change 100644 => 120000 packages/navigation/galaxy/__init__.py mode change 100644 => 120000 packages/objectstore/galaxy/__init__.py create mode 100644 packages/package.__init__.py mode change 100644 => 120000 packages/schema/galaxy/__init__.py mode change 100644 => 120000 packages/selenium/galaxy/__init__.py mode change 100644 => 120000 packages/test_api/galaxy_test/__init__.py mode change 100644 => 120000 packages/test_base/galaxy_test/__init__.py mode change 100644 => 120000 packages/test_driver/galaxy_test/__init__.py mode change 100644 => 120000 packages/test_selenium/galaxy_test/__init__.py mode change 100644 => 120000 packages/tool_util/galaxy/__init__.py mode change 100644 => 120000 packages/tours/galaxy/__init__.py mode change 100644 => 120000 packages/util/galaxy/__init__.py mode change 100644 => 120000 packages/web_apps/galaxy/__init__.py mode change 100644 => 120000 packages/web_framework/galaxy/__init__.py mode change 100644 => 120000 packages/web_stack/galaxy/__init__.py diff --git a/lib/galaxy/__init__.py b/lib/galaxy/__init__.py index 70b3b112b715..20a19480162c 100644 --- a/lib/galaxy/__init__.py +++ b/lib/galaxy/__init__.py @@ -4,4 +4,4 @@ from pkgutil import extend_path -__path__ = extend_path(__path__, __name__) # type: ignore[has-type] +__path__ = extend_path(__path__, __name__) diff --git a/lib/galaxy/app.py b/lib/galaxy/app.py index f45c9aa83abc..c659097036e0 100644 --- a/lib/galaxy/app.py +++ b/lib/galaxy/app.py @@ -687,7 +687,7 @@ def __init__(self, **kwargs) -> None: self.watchers = self._register_singleton(ConfigWatchers) self._configure_toolbox() # Load Data Manager - self.data_managers = self._register_singleton(DataManagers) # type: ignore[type-abstract] + self.data_managers = self._register_singleton(DataManagers) # Load the update repository manager. self.update_repository_manager = self._register_singleton( UpdateRepositoryManager, UpdateRepositoryManager(self) diff --git a/lib/galaxy/app_unittest_utils/toolbox_support.py b/lib/galaxy/app_unittest_utils/toolbox_support.py index 6308fb14244f..1189e4580b84 100644 --- a/lib/galaxy/app_unittest_utils/toolbox_support.py +++ b/lib/galaxy/app_unittest_utils/toolbox_support.py @@ -81,7 +81,7 @@ def setUp(self): install_model = mapping.init("sqlite:///:memory:", create_tables=True) self.app.tool_cache = ToolCache() self.app.install_model = install_model - self.app.reindex_tool_search = self.__reindex # type: ignore[assignment] + self.app.reindex_tool_search = self.__reindex # type: ignore[method-assign] itp_config = os.path.join(self.test_directory, "integrated_tool_panel.xml") self.app.config.integrated_tool_panel_config = itp_config self.app.watchers = ConfigWatchers(self.app) diff --git a/lib/galaxy/authnz/custos_authnz.py b/lib/galaxy/authnz/custos_authnz.py index 1c75f278e438..a216b3239c14 100644 --- a/lib/galaxy/authnz/custos_authnz.py +++ b/lib/galaxy/authnz/custos_authnz.py @@ -35,7 +35,7 @@ try: import pkce except ImportError: - pkce = None # type: ignore[assignment] + pkce = None # type: ignore[assignment, unused-ignore] log = logging.getLogger(__name__) STATE_COOKIE_NAME = "galaxy-oidc-state" diff --git a/lib/galaxy/datatypes/constructive_solid_geometry.py b/lib/galaxy/datatypes/constructive_solid_geometry.py index da87ae493802..73973abb65a5 100644 --- a/lib/galaxy/datatypes/constructive_solid_geometry.py +++ b/lib/galaxy/datatypes/constructive_solid_geometry.py @@ -142,7 +142,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str: return f"Ply file ({nice_size(dataset.get_size())})" -class PlyAscii(Ply, data.Text): # type: ignore[misc] +class PlyAscii(Ply, data.Text): """ >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('test.plyascii') @@ -160,7 +160,7 @@ def __init__(self, **kwd): data.Text.__init__(self, **kwd) -class PlyBinary(Ply, Binary): # type: ignore[misc] +class PlyBinary(Ply, Binary): file_ext = "plybinary" subtype = "binary" @@ -477,7 +477,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str: return f"Vtk file ({nice_size(dataset.get_size())})" -class VtkAscii(Vtk, data.Text): # type: ignore[misc] +class VtkAscii(Vtk, data.Text): """ >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('test.vtkascii') @@ -495,7 +495,7 @@ def __init__(self, **kwd): data.Text.__init__(self, **kwd) -class VtkBinary(Vtk, Binary): # type: ignore[misc] +class VtkBinary(Vtk, Binary): """ >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('test.vtkbinary') diff --git a/lib/galaxy/jobs/runners/aws.py b/lib/galaxy/jobs/runners/aws.py index ab42b38da0e8..ee0284fe0f23 100644 --- a/lib/galaxy/jobs/runners/aws.py +++ b/lib/galaxy/jobs/runners/aws.py @@ -521,10 +521,10 @@ def parse_destination_params(self, params): check_required = [] parsed_params = {} for k, spec in self.DESTINATION_PARAMS_SPEC.items(): - value = params.get(k, spec.get("default")) # type: ignore[attr-defined] - if spec.get("required") and not value: # type: ignore[attr-defined] + value = params.get(k, spec.get("default")) + if spec.get("required") and not value: check_required.append(k) - mapper = spec.get("map") # type: ignore[attr-defined] + mapper = spec.get("map") parsed_params[k] = mapper(value) # type: ignore[operator] if check_required: raise AWSBatchRunnerException( diff --git a/lib/galaxy/jobs/runners/util/kill.py b/lib/galaxy/jobs/runners/util/kill.py index 14a641ef16a1..7a26aa099e38 100644 --- a/lib/galaxy/jobs/runners/util/kill.py +++ b/lib/galaxy/jobs/runners/util/kill.py @@ -11,7 +11,7 @@ ) except ImportError: """Don't make psutil a strict requirement, but use if available.""" - Process = None # type: ignore + Process = None def kill_pid(pid: int, use_psutil: bool = True): diff --git a/lib/galaxy/managers/history_contents.py b/lib/galaxy/managers/history_contents.py index 4496f6dc9be2..c7b57233f09c 100644 --- a/lib/galaxy/managers/history_contents.py +++ b/lib/galaxy/managers/history_contents.py @@ -413,7 +413,7 @@ def _contained_id_map(self, id_list): component_class = self.contained_class stmt = ( select(component_class) - .where(component_class.id.in_(id_list)) # type: ignore[attr-defined] + .where(component_class.id.in_(id_list)) .options(undefer(component_class._metadata)) .options(joinedload(component_class.dataset).joinedload(model.Dataset.actions)) .options(joinedload(component_class.tags)) # type: ignore[attr-defined] diff --git a/lib/galaxy/managers/users.py b/lib/galaxy/managers/users.py index 0429e37007a0..eea8ca6d4d0e 100644 --- a/lib/galaxy/managers/users.py +++ b/lib/galaxy/managers/users.py @@ -313,7 +313,7 @@ def by_api_key(self, api_key: str, sa_session=None): def by_oidc_access_token(self, access_token: str): if hasattr(self.app, "authnz_manager") and self.app.authnz_manager: - user = self.app.authnz_manager.match_access_token_to_user(self.app.model.session, access_token) # type: ignore[attr-defined] + user = self.app.authnz_manager.match_access_token_to_user(self.app.model.session, access_token) return user else: return None diff --git a/lib/galaxy/managers/workflows.py b/lib/galaxy/managers/workflows.py index fb01a39d4e1e..95b2eaab2a9b 100644 --- a/lib/galaxy/managers/workflows.py +++ b/lib/galaxy/managers/workflows.py @@ -538,7 +538,7 @@ def build_invocations_query( for inv in trans.sa_session.scalars(stmt) if self.check_security(trans, inv, check_ownership=True, check_accessible=False) ] - return invocations, total_matches # type:ignore[return-value] + return invocations, total_matches MissingToolsT = List[Tuple[str, str, Optional[str], str]] diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index ae15250f485e..ae7da2d3a062 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -759,12 +759,12 @@ class User(Base, Dictifiable, RepresentById): back_populates="user", order_by=lambda: desc(History.update_time), cascade_backrefs=False # type: ignore[has-type] ) active_histories: Mapped[List["History"]] = relationship( - primaryjoin=(lambda: (History.user_id == User.id) & (not_(History.deleted)) & (not_(History.archived))), # type: ignore[has-type] + primaryjoin=(lambda: (History.user_id == User.id) & (not_(History.deleted)) & (not_(History.archived))), viewonly=True, order_by=lambda: desc(History.update_time), # type: ignore[has-type] ) galaxy_sessions: Mapped[List["GalaxySession"]] = relationship( - back_populates="user", order_by=lambda: desc(GalaxySession.update_time), cascade_backrefs=False # type: ignore[has-type] + back_populates="user", order_by=lambda: desc(GalaxySession.update_time), cascade_backrefs=False ) quotas: Mapped[List["UserQuotaAssociation"]] = relationship(back_populates="user") quota_source_usages: Mapped[List["UserQuotaSourceUsage"]] = relationship(back_populates="user") @@ -772,25 +772,23 @@ class User(Base, Dictifiable, RepresentById): stored_workflow_menu_entries: Mapped[List["StoredWorkflowMenuEntry"]] = relationship( primaryjoin=( lambda: (StoredWorkflowMenuEntry.user_id == User.id) - & (StoredWorkflowMenuEntry.stored_workflow_id == StoredWorkflow.id) # type: ignore[has-type] - & not_(StoredWorkflow.deleted) # type: ignore[has-type] + & (StoredWorkflowMenuEntry.stored_workflow_id == StoredWorkflow.id) + & not_(StoredWorkflow.deleted) ), back_populates="user", cascade="all, delete-orphan", collection_class=ordering_list("order_index"), ) _preferences: Mapped[Dict[str, "UserPreference"]] = relationship(collection_class=attribute_keyed_dict("name")) - values: Mapped[List["FormValues"]] = relationship( - primaryjoin=(lambda: User.form_values_id == FormValues.id) # type: ignore[has-type] - ) + values: Mapped[List["FormValues"]] = relationship(primaryjoin=(lambda: User.form_values_id == FormValues.id)) # Add type hint (will this work w/SA?) api_keys: Mapped[List["APIKeys"]] = relationship( back_populates="user", order_by=lambda: desc(APIKeys.create_time), primaryjoin=( lambda: and_( - User.id == APIKeys.user_id, # type: ignore[attr-defined] - not_(APIKeys.deleted == true()), # type: ignore[has-type] + User.id == APIKeys.user_id, + not_(APIKeys.deleted == true()), ) ), ) @@ -798,7 +796,7 @@ class User(Base, Dictifiable, RepresentById): roles: Mapped[List["UserRoleAssociation"]] = relationship(back_populates="user") stored_workflows: Mapped[List["StoredWorkflow"]] = relationship( back_populates="user", - primaryjoin=(lambda: User.id == StoredWorkflow.user_id), # type: ignore[has-type] + primaryjoin=(lambda: User.id == StoredWorkflow.user_id), cascade_backrefs=False, ) all_notifications: Mapped[List["UserNotificationAssociation"]] = relationship( @@ -807,9 +805,9 @@ class User(Base, Dictifiable, RepresentById): non_private_roles: Mapped[List["UserRoleAssociation"]] = relationship( viewonly=True, primaryjoin=( - lambda: (User.id == UserRoleAssociation.user_id) # type: ignore[has-type] - & (UserRoleAssociation.role_id == Role.id) # type: ignore[has-type] - & not_(Role.name == User.email) # type: ignore[has-type] + lambda: (User.id == UserRoleAssociation.user_id) + & (UserRoleAssociation.role_id == Role.id) + & not_(Role.name == User.email) ), ) @@ -2512,9 +2510,9 @@ class ImplicitlyCreatedDatasetCollectionInput(Base, RepresentById): input_dataset_collection: Mapped[Optional["HistoryDatasetCollectionAssociation"]] = relationship( primaryjoin=( - lambda: HistoryDatasetCollectionAssociation.id # type: ignore[has-type] + lambda: HistoryDatasetCollectionAssociation.id == ImplicitlyCreatedDatasetCollectionInput.input_dataset_collection_id - ), # type: ignore[has-type] + ), ) def __init__(self, name, input_dataset_collection): @@ -2578,7 +2576,7 @@ class PostJobAction(Base, RepresentById): action_arguments: Mapped[Optional[bytes]] = mapped_column(MutableJSONType) workflow_step: Mapped[Optional["WorkflowStep"]] = relationship( back_populates="post_job_actions", - primaryjoin=(lambda: WorkflowStep.id == PostJobAction.workflow_step_id), # type: ignore[has-type] + primaryjoin=(lambda: WorkflowStep.id == PostJobAction.workflow_step_id), ) def __init__(self, action_type, workflow_step=None, output_name=None, action_arguments=None): @@ -3073,12 +3071,12 @@ class History(Base, HasTags, Dictifiable, UsesAnnotations, HasName, Serializable primaryjoin=( lambda: ( and_( - HistoryDatasetCollectionAssociation.history_id == History.id, # type: ignore[has-type] - not_(HistoryDatasetCollectionAssociation.deleted), # type: ignore[has-type, arg-type] + HistoryDatasetCollectionAssociation.history_id == History.id, + not_(HistoryDatasetCollectionAssociation.deleted), # type: ignore[arg-type] ) ) ), - order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid), # type: ignore[has-type] + order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid), viewonly=True, ) visible_datasets: Mapped[List["HistoryDatasetAssociation"]] = relationship( @@ -3095,12 +3093,12 @@ class History(Base, HasTags, Dictifiable, UsesAnnotations, HasName, Serializable visible_dataset_collections: Mapped[List["HistoryDatasetCollectionAssociation"]] = relationship( primaryjoin=( lambda: and_( - HistoryDatasetCollectionAssociation.history_id == History.id, # type: ignore[has-type] - not_(HistoryDatasetCollectionAssociation.deleted), # type: ignore[has-type, arg-type] - HistoryDatasetCollectionAssociation.visible, # type: ignore[has-type, arg-type] + HistoryDatasetCollectionAssociation.history_id == History.id, + not_(HistoryDatasetCollectionAssociation.deleted), # type: ignore[arg-type] + HistoryDatasetCollectionAssociation.visible, # type: ignore[arg-type] ) ), - order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid), # type: ignore[has-type] + order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid), viewonly=True, ) tags: Mapped[List["HistoryTagAssociation"]] = relationship( @@ -3110,7 +3108,7 @@ class History(Base, HasTags, Dictifiable, UsesAnnotations, HasName, Serializable order_by=lambda: HistoryAnnotationAssociation.id, back_populates="history" ) ratings: Mapped[List["HistoryRatingAssociation"]] = relationship( - order_by=lambda: HistoryRatingAssociation.id, # type: ignore[has-type] + order_by=lambda: HistoryRatingAssociation.id, back_populates="history", ) default_permissions: Mapped[List["DefaultHistoryPermissions"]] = relationship(back_populates="history") @@ -4005,7 +4003,7 @@ class Dataset(Base, StorableObject, Serializable): lambda: and_( Dataset.id == HistoryDatasetAssociation.dataset_id, # type: ignore[attr-defined] HistoryDatasetAssociation.deleted == false(), # type: ignore[has-type] - HistoryDatasetAssociation.purged == false(), # type: ignore[attr-defined, arg-type] + HistoryDatasetAssociation.purged == false(), # type: ignore[arg-type] ) ), viewonly=True, @@ -4014,7 +4012,7 @@ class Dataset(Base, StorableObject, Serializable): primaryjoin=( lambda: and_( Dataset.id == HistoryDatasetAssociation.dataset_id, # type: ignore[attr-defined] - HistoryDatasetAssociation.purged == true(), # type: ignore[attr-defined, arg-type] + HistoryDatasetAssociation.purged == true(), # type: ignore[arg-type] ) ), viewonly=True, @@ -6113,7 +6111,7 @@ class LibraryInfoAssociation(Base, RepresentById): primaryjoin=lambda: LibraryInfoAssociation.form_definition_id == FormDefinition.id ) info: Mapped[Optional["FormValues"]] = relationship( - primaryjoin=lambda: LibraryInfoAssociation.form_values_id == FormValues.id # type: ignore[has-type] + primaryjoin=lambda: LibraryInfoAssociation.form_values_id == FormValues.id ) def __init__(self, library, form_definition, info, inheritable=False): @@ -6143,7 +6141,7 @@ class LibraryFolderInfoAssociation(Base, RepresentById): primaryjoin=(lambda: LibraryFolderInfoAssociation.form_definition_id == FormDefinition.id) ) info: Mapped[Optional["FormValues"]] = relationship( - primaryjoin=(lambda: LibraryFolderInfoAssociation.form_values_id == FormValues.id) # type: ignore[has-type] + primaryjoin=(lambda: LibraryFolderInfoAssociation.form_values_id == FormValues.id) ) def __init__(self, folder, form_definition, info, inheritable=False): @@ -6177,7 +6175,7 @@ class LibraryDatasetDatasetInfoAssociation(Base, RepresentById): primaryjoin=(lambda: LibraryDatasetDatasetInfoAssociation.form_definition_id == FormDefinition.id), ) info: Mapped[Optional["FormValues"]] = relationship( - primaryjoin=(lambda: LibraryDatasetDatasetInfoAssociation.form_values_id == FormValues.id) # type: ignore[has-type] + primaryjoin=(lambda: LibraryDatasetDatasetInfoAssociation.form_values_id == FormValues.id) ) def __init__(self, library_dataset_dataset_association, form_definition, info): @@ -6311,9 +6309,9 @@ class DatasetCollection(Base, Dictifiable, UsesAnnotations, Serializable): update_time: Mapped[datetime] = mapped_column(default=now, onupdate=now, nullable=True) elements: Mapped[List["DatasetCollectionElement"]] = relationship( - primaryjoin=(lambda: DatasetCollection.id == DatasetCollectionElement.dataset_collection_id), # type: ignore[has-type] + primaryjoin=(lambda: DatasetCollection.id == DatasetCollectionElement.dataset_collection_id), back_populates="collection", - order_by=lambda: DatasetCollectionElement.element_index, # type: ignore[has-type] + order_by=lambda: DatasetCollectionElement.element_index, ) dict_collection_visible_keys = ["id", "collection_type"] @@ -6811,7 +6809,7 @@ class HistoryDatasetCollectionAssociation( back_populates="history_dataset_collection", ) ratings: Mapped[List["HistoryDatasetCollectionRatingAssociation"]] = relationship( - order_by=lambda: HistoryDatasetCollectionRatingAssociation.id, # type: ignore[has-type] + order_by=lambda: HistoryDatasetCollectionRatingAssociation.id, back_populates="dataset_collection", ) creating_job_associations: Mapped[List["JobToOutputDatasetCollectionAssociation"]] = relationship(viewonly=True) @@ -7166,7 +7164,7 @@ class LibraryDatasetCollectionAssociation(Base, DatasetCollectionInstance, Repre back_populates="dataset_collection", ) ratings: Mapped[List["LibraryDatasetCollectionRatingAssociation"]] = relationship( - order_by=lambda: LibraryDatasetCollectionRatingAssociation.id, # type: ignore[has-type] + order_by=lambda: LibraryDatasetCollectionRatingAssociation.id, back_populates="dataset_collection", ) @@ -7489,14 +7487,14 @@ class StoredWorkflow(Base, HasTags, Dictifiable, RepresentById): workflows: Mapped[List["Workflow"]] = relationship( back_populates="stored_workflow", cascade="all, delete-orphan", - primaryjoin=(lambda: StoredWorkflow.id == Workflow.stored_workflow_id), # type: ignore[has-type] - order_by=lambda: -Workflow.id, # type: ignore[has-type] + primaryjoin=(lambda: StoredWorkflow.id == Workflow.stored_workflow_id), + order_by=lambda: -Workflow.id, cascade_backrefs=False, ) latest_workflow = relationship( "Workflow", post_update=True, - primaryjoin=(lambda: StoredWorkflow.latest_workflow_id == Workflow.id), # type: ignore[has-type] + primaryjoin=(lambda: StoredWorkflow.latest_workflow_id == Workflow.id), lazy=False, ) tags: Mapped[List["StoredWorkflowTagAssociation"]] = relationship( @@ -7518,7 +7516,7 @@ class StoredWorkflow(Base, HasTags, Dictifiable, RepresentById): back_populates="stored_workflow", ) ratings: Mapped[List["StoredWorkflowRatingAssociation"]] = relationship( - order_by=lambda: StoredWorkflowRatingAssociation.id, # type: ignore[has-type] + order_by=lambda: StoredWorkflowRatingAssociation.id, back_populates="stored_workflow", ) users_shared_with: Mapped[List["StoredWorkflowUserShareAssociation"]] = relationship( @@ -7657,20 +7655,20 @@ class Workflow(Base, Dictifiable, RepresentById): steps = relationship( "WorkflowStep", back_populates="workflow", - primaryjoin=(lambda: Workflow.id == WorkflowStep.workflow_id), # type: ignore[has-type] - order_by=lambda: asc(WorkflowStep.order_index), # type: ignore[has-type] + primaryjoin=(lambda: Workflow.id == WorkflowStep.workflow_id), + order_by=lambda: asc(WorkflowStep.order_index), cascade="all, delete-orphan", lazy=False, ) comments: Mapped[List["WorkflowComment"]] = relationship( back_populates="workflow", - primaryjoin=(lambda: Workflow.id == WorkflowComment.workflow_id), # type: ignore[has-type] + primaryjoin=(lambda: Workflow.id == WorkflowComment.workflow_id), cascade="all, delete-orphan", lazy=False, ) parent_workflow_steps = relationship( "WorkflowStep", - primaryjoin=(lambda: Workflow.id == WorkflowStep.subworkflow_id), # type: ignore[has-type] + primaryjoin=(lambda: Workflow.id == WorkflowStep.subworkflow_id), back_populates="subworkflow", cascade_backrefs=False, ) @@ -9064,8 +9062,6 @@ class WorkflowInvocationStep(Base, Dictifiable, Serializable): select(WorkflowStep.order_index).where(WorkflowStep.id == workflow_step_id).scalar_subquery() ) - subworkflow_invocation_id = None - dict_collection_visible_keys = [ "id", "update_time", @@ -9607,7 +9603,7 @@ class FormDefinition(Base, Dictifiable, RepresentById): layout: Mapped[Optional[bytes]] = mapped_column(MutableJSONType) form_definition_current: Mapped["FormDefinitionCurrent"] = relationship( back_populates="forms", - primaryjoin=(lambda: FormDefinitionCurrent.id == FormDefinition.form_definition_current_id), # type: ignore[has-type] + primaryjoin=(lambda: FormDefinitionCurrent.id == FormDefinition.form_definition_current_id), ) # The following form_builder classes are supported by the FormDefinition class. @@ -10145,12 +10141,12 @@ class Page(Base, HasTags, Dictifiable, RepresentById): user: Mapped["User"] = relationship() revisions: Mapped[List["PageRevision"]] = relationship( cascade="all, delete-orphan", - primaryjoin=(lambda: Page.id == PageRevision.page_id), # type: ignore[has-type] + primaryjoin=(lambda: Page.id == PageRevision.page_id), back_populates="page", ) latest_revision: Mapped[Optional["PageRevision"]] = relationship( post_update=True, - primaryjoin=(lambda: Page.latest_revision_id == PageRevision.id), # type: ignore[has-type] + primaryjoin=(lambda: Page.latest_revision_id == PageRevision.id), lazy=False, ) tags: Mapped[List["PageTagAssociation"]] = relationship( @@ -10160,13 +10156,11 @@ class Page(Base, HasTags, Dictifiable, RepresentById): order_by=lambda: PageAnnotationAssociation.id, back_populates="page" ) ratings: Mapped[List["PageRatingAssociation"]] = relationship( - order_by=lambda: PageRatingAssociation.id, # type: ignore[has-type] + order_by=lambda: PageRatingAssociation.id, back_populates="page", ) users_shared_with: Mapped[List["PageUserShareAssociation"]] = relationship(back_populates="page") - average_rating = None - # Set up proxy so that # Page.users_shared_with # returns a list of users that page is shared with. @@ -10282,7 +10276,7 @@ class Visualization(Base, HasTags, Dictifiable, RepresentById): back_populates="visualization", ) ratings: Mapped[List["VisualizationRatingAssociation"]] = relationship( - order_by=lambda: VisualizationRatingAssociation.id, # type: ignore[has-type] + order_by=lambda: VisualizationRatingAssociation.id, back_populates="visualization", ) users_shared_with: Mapped[List["VisualizationUserShareAssociation"]] = relationship(back_populates="visualization") @@ -11317,7 +11311,7 @@ def __repr__(self): deferred=True, ) -Page.average_rating = column_property( # type:ignore[assignment] +Page.average_rating = column_property( select(func.avg(PageRatingAssociation.rating)).where(PageRatingAssociation.page_id == Page.id).scalar_subquery(), deferred=True, ) @@ -11340,7 +11334,7 @@ def __repr__(self): select(func.count(WorkflowStep.id)).where(Workflow.id == WorkflowStep.workflow_id).scalar_subquery(), deferred=True ) -WorkflowInvocationStep.subworkflow_invocation_id = column_property( # type:ignore[assignment] +WorkflowInvocationStep.subworkflow_invocation_id = column_property( select(WorkflowInvocationToSubworkflowInvocationAssociation.subworkflow_invocation_id) .where( and_( diff --git a/lib/galaxy/model/migrations/alembic/env.py b/lib/galaxy/model/migrations/alembic/env.py index 5c3ec11f8298..8ec793787d54 100644 --- a/lib/galaxy/model/migrations/alembic/env.py +++ b/lib/galaxy/model/migrations/alembic/env.py @@ -58,7 +58,7 @@ def _run_migrations_invoked_via_script(run_migrations: Callable[[str], None]) -> if revision_str: if len(revision_str) > 1: log.error("Please run the commmand for one revision at a time") - revision_str = revision_str[0] # type: ignore[union-attr] + revision_str = revision_str[0] if revision_str.startswith(f"{GXY}@"): url = urls[GXY] diff --git a/lib/galaxy/model/store/__init__.py b/lib/galaxy/model/store/__init__.py index 967295d1202f..dbca1f250f33 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) @@ -2190,7 +2190,7 @@ def export_history( self.export_collection(collection, include_deleted=include_deleted) # Write datasets' attributes to file. - actions_backref = model.Dataset.actions # type: ignore[attr-defined] + actions_backref = model.Dataset.actions stmt_hda = ( select(model.HistoryDatasetAssociation) diff --git a/lib/galaxy/objectstore/rucio.py b/lib/galaxy/objectstore/rucio.py index c89957efc4fa..ebc596903752 100644 --- a/lib/galaxy/objectstore/rucio.py +++ b/lib/galaxy/objectstore/rucio.py @@ -1,21 +1,8 @@ import hashlib -from typing import Optional - -from .caching import ( - CacheTarget, - enable_cache_monitor, - InProcessCacheMonitor, - parse_caching_config_dict_from_xml, -) - -try: - from ..authnz.util import provider_name_to_backend -except ImportError: - provider_name_to_backend = None # type: ignore[misc,assignment] - import logging import os import shutil +from typing import Optional try: import rucio.common @@ -30,6 +17,11 @@ except ImportError: Client = None +try: + from galaxy.authnz.util import provider_name_to_backend +except ImportError: + provider_name_to_backend = None # type: ignore[assignment, unused-ignore] + from galaxy.exceptions import ( ObjectInvalid, ObjectNotFound, @@ -41,7 +33,13 @@ unlink, ) from galaxy.util.path import safe_relpath -from ..objectstore import ConcreteObjectStore +from . import ConcreteObjectStore +from .caching import ( + CacheTarget, + enable_cache_monitor, + InProcessCacheMonitor, + parse_caching_config_dict_from_xml, +) log = logging.getLogger(__name__) diff --git a/lib/galaxy/objectstore/rucio_extra_clients.py b/lib/galaxy/objectstore/rucio_extra_clients.py index 38f6309f5d59..36ff04981b3f 100644 --- a/lib/galaxy/objectstore/rucio_extra_clients.py +++ b/lib/galaxy/objectstore/rucio_extra_clients.py @@ -1,11 +1,10 @@ import copy import logging import time -from abc import ABC try: from rucio.client.uploadclient import UploadClient - from rucio.common.exception import ( # type: ignore + from rucio.common.exception import ( InputValidationError, NoFilesUploaded, NotAllFilesUploaded, @@ -14,7 +13,7 @@ from rucio.common.utils import generate_uuid from rucio.rse import rsemanager as rsemgr except ImportError: - UploadClient = ABC + UploadClient = object class DeleteClient(UploadClient): diff --git a/lib/galaxy/schema/fetch_data.py b/lib/galaxy/schema/fetch_data.py index f37d9bfb23f7..2603b1471ea5 100644 --- a/lib/galaxy/schema/fetch_data.py +++ b/lib/galaxy/schema/fetch_data.py @@ -269,4 +269,4 @@ class FetchDataPayload(BaseDataPayload): class FetchDataFormPayload(BaseDataPayload): - targets: Union[Json[Targets], Targets] # type: ignore[type-arg] # https://github.com/samuelcolvin/pydantic/issues/2990 + targets: Union[Json[Targets], Targets] diff --git a/lib/galaxy/tool_shed/metadata/metadata_generator.py b/lib/galaxy/tool_shed/metadata/metadata_generator.py index b0827bdbf8b0..4c439ada7a99 100644 --- a/lib/galaxy/tool_shed/metadata/metadata_generator.py +++ b/lib/galaxy/tool_shed/metadata/metadata_generator.py @@ -101,7 +101,7 @@ def _generate_data_manager_metadata( repo_path = self.repository.repo_path(self.app) if hasattr(self.repository, "repo_files_directory"): # Galaxy Side. - repo_files_directory = self.repository.repo_files_directory(self.app) # type: ignore[attr-defined] + repo_files_directory = self.repository.repo_files_directory(self.app) repo_dir = repo_files_directory else: # Tool Shed side. diff --git a/lib/galaxy/tool_util/parser/output_actions.py b/lib/galaxy/tool_util/parser/output_actions.py index 13ae26266296..f4d8e3fe1825 100644 --- a/lib/galaxy/tool_util/parser/output_actions.py +++ b/lib/galaxy/tool_util/parser/output_actions.py @@ -11,7 +11,7 @@ try: from galaxy.util.template import fill_template except ImportError: - fill_template = None # type: ignore[assignment] + fill_template = None # type: ignore[assignment, unused-ignore] log = logging.getLogger(__name__) @@ -324,7 +324,7 @@ def apply_action(self, output_dataset, other_values) -> None: else: # fallback when Cheetah not available, equivalent to how this was handled prior 23.0 # definitely not needed for CWL tool parsing - log.warning("Cheetah not installed, falling back to legacy 'apply_action' behavior.") # type: ignore[unreachable] + log.warning("Cheetah not installed, falling back to legacy 'apply_action' behavior.") # type: ignore[unreachable, unused-ignore] value = self.default if value is not None: setattr(output_dataset.metadata, self.name, value) diff --git a/lib/galaxy/tool_util/toolbox/watcher.py b/lib/galaxy/tool_util/toolbox/watcher.py index b885ea964e27..05db57fd3040 100644 --- a/lib/galaxy/tool_util/toolbox/watcher.py +++ b/lib/galaxy/tool_util/toolbox/watcher.py @@ -4,15 +4,8 @@ try: from watchdog.events import FileSystemEventHandler - from watchdog.observers import Observer - from watchdog.observers.polling import PollingObserver - - can_watch = True except ImportError: - Observer = None # type:ignore[assignment, misc] - FileSystemEventHandler = object # type:ignore[assignment, misc] - PollingObserver = None # type:ignore[assignment, misc] - can_watch = False + FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore] from galaxy.util.hash_util import md5_hash_file from galaxy.util.watcher import ( diff --git a/lib/galaxy/tool_util/verify/__init__.py b/lib/galaxy/tool_util/verify/__init__.py index 8bed1f449fc5..ec84f23ae345 100644 --- a/lib/galaxy/tool_util/verify/__init__.py +++ b/lib/galaxy/tool_util/verify/__init__.py @@ -31,11 +31,11 @@ try: from PIL import Image except ImportError: - Image = None # type: ignore[assignment] + Image = None # type: ignore[assignment, unused-ignore] try: import tifffile except ImportError: - tifffile = None # type: ignore[assignment] + tifffile = None # type: ignore[assignment, unused-ignore] from galaxy.tool_util.parser.util import ( diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 4c53ffa4fcec..6db073aa3887 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -2178,7 +2178,7 @@ def from_json(self, value, trans, other_values=None): elif isinstance(value, HistoryDatasetCollectionAssociation) or isinstance(value, DatasetCollectionElement): rval.append(value) else: - rval.append(session.get(HistoryDatasetAssociation, int(value))) # type:ignore[arg-type] + rval.append(session.get(HistoryDatasetAssociation, int(value))) dataset_matcher_factory = get_dataset_matcher_factory(trans) dataset_matcher = dataset_matcher_factory.dataset_matcher(self, other_values) for v in rval: diff --git a/lib/galaxy/util/__init__.py b/lib/galaxy/util/__init__.py index f687e84dd45a..814e9fdd9c6b 100644 --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -62,7 +62,7 @@ remap, ) from requests.adapters import HTTPAdapter -from requests.packages.urllib3.util.retry import Retry # type: ignore[import-untyped] +from requests.packages.urllib3.util.retry import Retry # type: ignore[import-untyped, unused-ignore] from typing_extensions import ( Literal, Self, @@ -117,7 +117,7 @@ def XML(text: Union[str, bytes]) -> Element: except ImportError: LXML_AVAILABLE = False - import xml.etree.ElementTree as etree # type: ignore[assignment,no-redef] + import xml.etree.ElementTree as etree # type: ignore[no-redef] from xml.etree.ElementTree import ( # type: ignore[assignment] # noqa: F401 Element, ElementTree, @@ -135,7 +135,7 @@ def XML(text: Union[str, bytes]) -> Element: from .rst_to_html import rst_to_html # noqa: F401 try: - shlex_join = shlex.join # type: ignore[attr-defined] + shlex_join = shlex.join # type: ignore[attr-defined, unused-ignore] except AttributeError: # Python < 3.8 def shlex_join(split_command): @@ -179,9 +179,10 @@ def str_removeprefix(s: str, prefix: str): """ if sys.version_info >= (3, 9): return s.removeprefix(prefix) - if s.startswith(prefix): # type: ignore[unreachable] + elif s.startswith(prefix): return s[len(prefix) :] - return s + else: + return s def remove_protocol_from_url(url): @@ -1133,7 +1134,7 @@ def commaify(amount): @overload -def unicodify( # type: ignore[misc] +def unicodify( # type: ignore[overload-overlap] value: Literal[None], encoding: str = DEFAULT_ENCODING, error: str = "replace", diff --git a/lib/galaxy/util/bool_expressions.py b/lib/galaxy/util/bool_expressions.py index 2b721158fc0c..aa529a10d970 100644 --- a/lib/galaxy/util/bool_expressions.py +++ b/lib/galaxy/util/bool_expressions.py @@ -81,7 +81,7 @@ def __str__(self): return f"({sep.join(map(str, self.args))})" def __bool__(self): - return self.evalop(bool(a) for a in self.args) # type: ignore[misc,call-arg] + return self.evalop(bool(a) for a in self.args) __nonzero__ = __bool__ diff --git a/lib/galaxy/util/image_util.py b/lib/galaxy/util/image_util.py index 2cf405ae6390..3b11a50d2fda 100644 --- a/lib/galaxy/util/image_util.py +++ b/lib/galaxy/util/image_util.py @@ -10,7 +10,7 @@ try: from PIL import Image except ImportError: - Image = None # type: ignore[assignment] + Image = None # type: ignore[assignment, unused-ignore] log = logging.getLogger(__name__) diff --git a/lib/galaxy/util/watcher.py b/lib/galaxy/util/watcher.py index 5fefcfb9c499..d57188280c72 100644 --- a/lib/galaxy/util/watcher.py +++ b/lib/galaxy/util/watcher.py @@ -13,9 +13,9 @@ can_watch = True except ImportError: - Observer = None # type:ignore[assignment] - FileSystemEventHandler = object # type:ignore[assignment, misc] - PollingObserver = None # type:ignore[assignment, misc] + Observer = None # type:ignore[assignment, unused-ignore] + FileSystemEventHandler = object # type:ignore[assignment,misc, unused-ignore] + PollingObserver = None # type:ignore[assignment, misc, unused-ignore] can_watch = False from galaxy.util.hash_util import md5_hash_file diff --git a/lib/galaxy/util/yaml_util.py b/lib/galaxy/util/yaml_util.py index 0ad96de335a3..c1a2fc410792 100644 --- a/lib/galaxy/util/yaml_util.py +++ b/lib/galaxy/util/yaml_util.py @@ -8,7 +8,7 @@ try: from yaml import CSafeLoader as SafeLoader except ImportError: - from yaml import SafeLoader # type: ignore[misc, assignment] + from yaml import SafeLoader # type: ignore[assignment] log = logging.getLogger(__name__) diff --git a/lib/galaxy/visualization/genomes.py b/lib/galaxy/visualization/genomes.py index 50672c8227b4..066785feae7a 100644 --- a/lib/galaxy/visualization/genomes.py +++ b/lib/galaxy/visualization/genomes.py @@ -269,8 +269,8 @@ def get_dbkeys(self, user: Optional[User], chrom_info=False): dbkeys = [] # Add user's custom keys to dbkeys. - if user and user.preferences and "dbkeys" in user.preferences: # type:ignore[unreachable] - user_keys_dict = loads(user.preferences["dbkeys"]) # type:ignore[unreachable] + if user and user.preferences and "dbkeys" in user.preferences: + user_keys_dict = loads(user.preferences["dbkeys"]) dbkeys.extend([(attributes["name"], key) for key, attributes in user_keys_dict.items()]) # Add app keys to dbkeys. diff --git a/lib/galaxy/webapps/__init__.py b/lib/galaxy/webapps/__init__.py index 265603ef3dea..7d9ae84e5cf5 100644 --- a/lib/galaxy/webapps/__init__.py +++ b/lib/galaxy/webapps/__init__.py @@ -2,4 +2,4 @@ from pkgutil import extend_path -__path__ = extend_path(__path__, __name__) # type: ignore[has-type] +__path__ = extend_path(__path__, __name__) diff --git a/lib/galaxy/webapps/base/webapp.py b/lib/galaxy/webapps/base/webapp.py index a65bc2fa99ed..0029bb70a7e6 100644 --- a/lib/galaxy/webapps/base/webapp.py +++ b/lib/galaxy/webapps/base/webapp.py @@ -345,7 +345,7 @@ def __init__( self._ensure_valid_session(session_cookie) if hasattr(self.app, "authnz_manager") and self.app.authnz_manager: - self.app.authnz_manager.refresh_expiring_oidc_tokens(self) # type: ignore[attr-defined] + self.app.authnz_manager.refresh_expiring_oidc_tokens(self) if self.galaxy_session: # When we've authenticated by session, we have to check the diff --git a/lib/galaxy/webapps/openapi/utils.py b/lib/galaxy/webapps/openapi/utils.py index 369da1d4039d..88ae97e43c0b 100644 --- a/lib/galaxy/webapps/openapi/utils.py +++ b/lib/galaxy/webapps/openapi/utils.py @@ -117,4 +117,4 @@ def get_openapi( output["webhooks"] = webhook_paths if tags: output["tags"] = tags - return jsonable_encoder(OpenAPI(**output), by_alias=True, exclude_none=True) # type: ignore + return jsonable_encoder(OpenAPI(**output), by_alias=True, exclude_none=True) diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index 68d9d9e9e5e3..e1fcaceeefba 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -1385,14 +1385,14 @@ def get_inputs(self): def restrict_options(self, step, connections: Iterable[WorkflowStepConnection], default_value): try: - static_options = [] # type:ignore[var-annotated] + static_options = [] # Retrieve possible runtime options for 'select' type inputs for connection in connections: # Well this isn't a great assumption... assert connection.input_step module = connection.input_step.module assert isinstance(module, (ToolModule, SubWorkflowModule)) - if isinstance(module, ToolModule): # type:ignore[unreachable] + if isinstance(module, ToolModule): assert module.tool tool_inputs = module.tool.inputs # may not be set, but we're catching the Exception below. @@ -2551,7 +2551,7 @@ def inject_all(self, workflow: Workflow, param_map=None, ignore_tool_missing_exc def compute_runtime_state(self, step: WorkflowStep, step_args=None): assert step.module, "module must be injected before computing runtime state" - state, step_errors = step.module.compute_runtime_state(self.trans, step, step_args) # type:ignore[unreachable] + state, step_errors = step.module.compute_runtime_state(self.trans, step, step_args) step.state = state # Fix any missing parameters diff --git a/lib/galaxy_test/api/_framework.py b/lib/galaxy_test/api/_framework.py index d467860d7232..642f56412bd8 100644 --- a/lib/galaxy_test/api/_framework.py +++ b/lib/galaxy_test/api/_framework.py @@ -17,7 +17,7 @@ except ImportError: # Galaxy libraries and galaxy test driver not available, just assume we're # targetting a remote Galaxy. - GalaxyTestDriver = None # type: ignore[misc,assignment] + GalaxyTestDriver = None # type: ignore[assignment, misc, unused-ignore] class ApiTestCase(FunctionalTestCase, UsesApiTestCaseMixin, UsesCeleryTasks): diff --git a/lib/galaxy_test/selenium/framework.py b/lib/galaxy_test/selenium/framework.py index a75f5567115f..310c88c88053 100644 --- a/lib/galaxy_test/selenium/framework.py +++ b/lib/galaxy_test/selenium/framework.py @@ -536,7 +536,7 @@ def setup_shared_state(self): NavigatesGalaxyMixin = object -class UsesLibraryAssertions(NavigatesGalaxyMixin): # type:ignore[valid-type, misc] +class UsesLibraryAssertions(NavigatesGalaxyMixin): @retry_assertion_during_transitions def assert_num_displayed_items_is(self, n): num_displayed = self.num_displayed_items() @@ -546,7 +546,7 @@ def num_displayed_items(self) -> int: return len(self.libraries_table_elements()) -class UsesHistoryItemAssertions(NavigatesGalaxyMixin): # type:ignore[valid-type, misc] +class UsesHistoryItemAssertions(NavigatesGalaxyMixin): def assert_item_peek_includes(self, hid, expected): item_body = self.history_panel_item_component(hid=hid) peek_text = item_body.peek.wait_for_text() @@ -584,7 +584,7 @@ def assert_item_hid_text(self, hid): ) -class UsesWorkflowAssertions(NavigatesGalaxyMixin): # type:ignore[valid-type, misc] +class UsesWorkflowAssertions(NavigatesGalaxyMixin): @retry_assertion_during_transitions def _assert_showing_n_workflows(self, n): if (actual_count := len(self.workflow_card_elements())) != n: diff --git a/lib/tool_shed/test/base/playwrightbrowser.py b/lib/tool_shed/test/base/playwrightbrowser.py index 4c82a0d7183c..01949ff1eb96 100644 --- a/lib/tool_shed/test/base/playwrightbrowser.py +++ b/lib/tool_shed/test/base/playwrightbrowser.py @@ -132,7 +132,7 @@ def _fill_form_value(self, form: Locator, control_name: str, value: FormValueTyp input_s = form.locator(f"select[name='{control_name}']") if input_i.count(): if control_name in ["redirect"]: - input_i.input_value = value # type:ignore[method-assign, assignment] + input_i.input_value = value # type:ignore[assignment, unused-ignore] else: if isinstance(value, bool): if value and not input_i.is_checked(): @@ -142,9 +142,9 @@ def _fill_form_value(self, form: Locator, control_name: str, value: FormValueTyp else: input_i.fill(value) if input_t.count(): - input_t.fill(value) # type:ignore[arg-type] + input_t.fill(value) # type:ignore[arg-type, unused-ignore] if input_s.count(): - input_s.select_option(value) # type:ignore[arg-type] + input_s.select_option(value) # type:ignore[arg-type, unused-ignore] def edit_repository_categories(self, categories_to_add: List[str], categories_to_remove: List[str]) -> None: multi_select = "form[name='categories'] select[name='category_id']" diff --git a/lib/tool_shed/test/base/twillbrowser.py b/lib/tool_shed/test/base/twillbrowser.py index a73cdf85b299..b023bec47dc4 100644 --- a/lib/tool_shed/test/base/twillbrowser.py +++ b/lib/tool_shed/test/base/twillbrowser.py @@ -5,7 +5,7 @@ ) import twill.commands as tc -from twill.browser import FormElement # type:ignore[attr-defined] +from twill.browser import FormElement # type:ignore[attr-defined, unused-ignore] from galaxy.util import smart_str from .browser import ( @@ -19,13 +19,13 @@ def visit_url(url: str, allowed_codes: List[int]) -> str: - new_url = tc.go(url) # type:ignore[func-returns-value] + tc.go(url) return_code = tc.browser.code assert return_code in allowed_codes, "Invalid HTTP return code {}, allowed codes: {}".format( return_code, ", ".join(str(code) for code in allowed_codes), ) - return new_url + return url def page_content() -> str: diff --git a/lib/tool_shed/webapp/model/__init__.py b/lib/tool_shed/webapp/model/__init__.py index e6fe9da4d4b8..a0b1a178cdd5 100644 --- a/lib/tool_shed/webapp/model/__init__.py +++ b/lib/tool_shed/webapp/model/__init__.py @@ -115,12 +115,12 @@ class User(Base, Dictifiable): purged: Mapped[Optional[bool]] = mapped_column(Boolean, index=True, default=False) active_repositories = relationship( "Repository", - primaryjoin=(lambda: (Repository.user_id == User.id) & (not_(Repository.deleted))), # type: ignore[has-type] + primaryjoin=(lambda: (Repository.user_id == User.id) & (not_(Repository.deleted))), back_populates="user", - order_by=lambda: desc(Repository.name), # type: ignore[has-type] + order_by=lambda: desc(Repository.name), ) galaxy_sessions = relationship( - "GalaxySession", back_populates="user", order_by=lambda: desc(GalaxySession.update_time) # type: ignore[has-type] + "GalaxySession", back_populates="user", order_by=lambda: desc(GalaxySession.update_time) ) api_keys = relationship("APIKeys", back_populates="user", order_by=lambda: desc(APIKeys.create_time)) reset_tokens = relationship("PasswordResetToken", back_populates="user") @@ -134,9 +134,9 @@ class User(Base, Dictifiable): "UserRoleAssociation", viewonly=True, primaryjoin=( - lambda: (User.id == UserRoleAssociation.user_id) # type: ignore[has-type] - & (UserRoleAssociation.role_id == Role.id) # type: ignore[has-type] - & not_(Role.name == User.email) # type: ignore[has-type] + lambda: (User.id == UserRoleAssociation.user_id) + & (UserRoleAssociation.role_id == Role.id) + & not_(Role.name == User.email) ), ) @@ -379,7 +379,7 @@ class Repository(Base, Dictifiable): user = relationship("User", back_populates="active_repositories") downloadable_revisions = relationship( "RepositoryMetadata", - primaryjoin=lambda: (Repository.id == RepositoryMetadata.repository_id) & (RepositoryMetadata.downloadable == true()), # type: ignore[attr-defined,has-type] + primaryjoin=lambda: (Repository.id == RepositoryMetadata.repository_id) & (RepositoryMetadata.downloadable == true()), # type: ignore[has-type] viewonly=True, order_by=lambda: desc(RepositoryMetadata.update_time), # type: ignore[attr-defined] ) diff --git a/mypy.ini b/mypy.ini index 78361531713a..0ec6ae269986 100644 --- a/mypy.ini +++ b/mypy.ini @@ -14,6 +14,7 @@ no_implicit_reexport = True no_implicit_optional = True strict_equality = True warn_unreachable = True +warn_unused_ignores = True platform = linux # green list - work on growing these please! diff --git a/packages/app/galaxy/__init__.py b/packages/app/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/app/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/app/galaxy/__init__.py b/packages/app/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/app/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/auth/galaxy/__init__.py b/packages/auth/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/auth/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/auth/galaxy/__init__.py b/packages/auth/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/auth/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/config/galaxy/__init__.py b/packages/config/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/config/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/config/galaxy/__init__.py b/packages/config/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/config/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/data/galaxy/__init__.py b/packages/data/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/data/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/data/galaxy/__init__.py b/packages/data/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/data/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/files/galaxy/__init__.py b/packages/files/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/files/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/files/galaxy/__init__.py b/packages/files/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/files/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/job_execution/galaxy/__init__.py b/packages/job_execution/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/job_execution/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/job_execution/galaxy/__init__.py b/packages/job_execution/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/job_execution/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/job_metrics/galaxy/__init__.py b/packages/job_metrics/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/job_metrics/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/job_metrics/galaxy/__init__.py b/packages/job_metrics/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/job_metrics/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/navigation/galaxy/__init__.py b/packages/navigation/galaxy/__init__.py deleted file mode 100644 index 8db66d3d0f0f..000000000000 --- a/packages/navigation/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/packages/navigation/galaxy/__init__.py b/packages/navigation/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/navigation/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/objectstore/galaxy/__init__.py b/packages/objectstore/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/objectstore/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/objectstore/galaxy/__init__.py b/packages/objectstore/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/objectstore/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/package.__init__.py b/packages/package.__init__.py new file mode 100644 index 000000000000..b948ee6512da --- /dev/null +++ b/packages/package.__init__.py @@ -0,0 +1,3 @@ +from pkgutil import extend_path + +__path__ = extend_path(__path__, __name__) # noqa: F821 diff --git a/packages/schema/galaxy/__init__.py b/packages/schema/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/schema/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/schema/galaxy/__init__.py b/packages/schema/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/schema/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/selenium/galaxy/__init__.py b/packages/selenium/galaxy/__init__.py deleted file mode 100644 index 8db66d3d0f0f..000000000000 --- a/packages/selenium/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/packages/selenium/galaxy/__init__.py b/packages/selenium/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/selenium/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/test_api/galaxy_test/__init__.py b/packages/test_api/galaxy_test/__init__.py deleted file mode 100644 index 8db66d3d0f0f..000000000000 --- a/packages/test_api/galaxy_test/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/packages/test_api/galaxy_test/__init__.py b/packages/test_api/galaxy_test/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/test_api/galaxy_test/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/test_base/galaxy_test/__init__.py b/packages/test_base/galaxy_test/__init__.py deleted file mode 100644 index 8db66d3d0f0f..000000000000 --- a/packages/test_base/galaxy_test/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/packages/test_base/galaxy_test/__init__.py b/packages/test_base/galaxy_test/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/test_base/galaxy_test/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/test_driver/galaxy_test/__init__.py b/packages/test_driver/galaxy_test/__init__.py deleted file mode 100644 index 8db66d3d0f0f..000000000000 --- a/packages/test_driver/galaxy_test/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/packages/test_driver/galaxy_test/__init__.py b/packages/test_driver/galaxy_test/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/test_driver/galaxy_test/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/test_selenium/galaxy_test/__init__.py b/packages/test_selenium/galaxy_test/__init__.py deleted file mode 100644 index 8db66d3d0f0f..000000000000 --- a/packages/test_selenium/galaxy_test/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/packages/test_selenium/galaxy_test/__init__.py b/packages/test_selenium/galaxy_test/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/test_selenium/galaxy_test/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/tool_util/galaxy/__init__.py b/packages/tool_util/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/tool_util/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/tool_util/galaxy/__init__.py b/packages/tool_util/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/tool_util/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/tours/galaxy/__init__.py b/packages/tours/galaxy/__init__.py deleted file mode 100644 index 8db66d3d0f0f..000000000000 --- a/packages/tours/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/packages/tours/galaxy/__init__.py b/packages/tours/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/tours/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/util/galaxy/__init__.py b/packages/util/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/util/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/util/galaxy/__init__.py b/packages/util/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/util/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/web_apps/galaxy/__init__.py b/packages/web_apps/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/web_apps/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/web_apps/galaxy/__init__.py b/packages/web_apps/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/web_apps/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/web_framework/galaxy/__init__.py b/packages/web_framework/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/web_framework/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/web_framework/galaxy/__init__.py b/packages/web_framework/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/web_framework/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/packages/web_stack/galaxy/__init__.py b/packages/web_stack/galaxy/__init__.py deleted file mode 100644 index 2e50d9cce896..000000000000 --- a/packages/web_stack/galaxy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/web_stack/galaxy/__init__.py b/packages/web_stack/galaxy/__init__.py new file mode 120000 index 000000000000..6b4f2177e02a --- /dev/null +++ b/packages/web_stack/galaxy/__init__.py @@ -0,0 +1 @@ +../../package.__init__.py \ No newline at end of file diff --git a/test/integration/test_celery_user_rate_limit.py b/test/integration/test_celery_user_rate_limit.py index 3267a2dd5f53..61f2f207735d 100644 --- a/test/integration/test_celery_user_rate_limit.py +++ b/test/integration/test_celery_user_rate_limit.py @@ -89,7 +89,7 @@ def _test_mock_pass_user_id_task(self, num_users: int, num_calls: int, tasks_per results: Dict[int, List[AsyncResult]] = {} for user in users: user_results: List[AsyncResult] = [] - for _ in range(num_calls): # type: ignore + for _ in range(num_calls): user_results.append(mock_user_id_task.delay(task_user_id=user)) results[user] = user_results # Collect results of each call diff --git a/test/unit/app/jobs/test_job_wrapper.py b/test/unit/app/jobs/test_job_wrapper.py index 6c914c3efafa..0a2976c0d2d5 100644 --- a/test/unit/app/jobs/test_job_wrapper.py +++ b/test/unit/app/jobs/test_job_wrapper.py @@ -66,7 +66,7 @@ def tearDown(self): @contextmanager def _prepared_wrapper(self): wrapper = self._wrapper() - wrapper._get_tool_evaluator = lambda *args, **kwargs: MockEvaluator(wrapper.app, wrapper.tool, wrapper.get_job(), wrapper.working_directory) # type: ignore[assignment] + wrapper._get_tool_evaluator = lambda *args, **kwargs: MockEvaluator(wrapper.app, wrapper.tool, wrapper.get_job(), wrapper.working_directory) # type: ignore[method-assign] wrapper.prepare() yield wrapper diff --git a/test/unit/app/managers/test_HistoryManager.py b/test/unit/app/managers/test_HistoryManager.py index c3627c87d166..021e348fc019 100644 --- a/test/unit/app/managers/test_HistoryManager.py +++ b/test/unit/app/managers/test_HistoryManager.py @@ -88,7 +88,7 @@ def test_base(self): name_first_then_time = ( model.History.name, sqlalchemy.desc(model.History.create_time), - ) # type:ignore[var-annotated] + ) assert self.history_manager.list(order_by=name_first_then_time) == [history2, history1, history3] def test_copy(self): diff --git a/test/unit/app/managers/test_markdown_export.py b/test/unit/app/managers/test_markdown_export.py index 72f5b900a5d7..3470061b359f 100644 --- a/test/unit/app/managers/test_markdown_export.py +++ b/test/unit/app/managers/test_markdown_export.py @@ -46,15 +46,15 @@ def _new_invocation(self): @contextmanager def _expect_get_history(self, history): - self.app.history_manager.get_accessible.return_value = history # type: ignore[attr-defined,union-attr] + self.app.history_manager.get_accessible.return_value = history yield - self.app.history_manager.get_accessible.assert_called_once_with(history.id, self.trans.user) # type: ignore[attr-defined,union-attr] + self.app.history_manager.get_accessible.assert_called_once_with(history.id, self.trans.user) @contextmanager def _expect_get_hda(self, hda, hda_id=1): - self.app.hda_manager.get_accessible.return_value = hda # type: ignore[attr-defined,union-attr] + self.app.hda_manager.get_accessible.return_value = hda yield - self.app.hda_manager.get_accessible.assert_called_once_with(hda.id, self.trans.user) # type: ignore[attr-defined,union-attr] + self.app.hda_manager.get_accessible.assert_called_once_with(hda.id, self.trans.user) def _new_pair_collection(self): hda_forward = self._new_hda(contents="Forward dataset.") @@ -222,7 +222,7 @@ def test_history_collection_paired(self): hdca.collection = self._new_pair_collection() hdca.id = 1 - self.trans.app.dataset_collection_manager.get_dataset_collection_instance.return_value = hdca # type: ignore[attr-defined,union-attr] + self.trans.app.dataset_collection_manager.get_dataset_collection_instance.return_value = hdca example = """# Example ```galaxy history_dataset_collection_display(history_dataset_collection_id=1) @@ -243,7 +243,7 @@ def test_workflow_export(self): stored_workflow.latest_workflow = workflow workflow_step_0 = model.WorkflowStep() workflow.steps = [workflow_step_0] - self.trans.app.workflow_manager.get_stored_accessible_workflow.return_value = stored_workflow # type: ignore[attr-defined,union-attr] + self.trans.app.workflow_manager.get_stored_accessible_workflow.return_value = stored_workflow example = """# Example ```galaxy workflow_display(workflow_id=1) @@ -278,7 +278,7 @@ def test_generate_invocation_time(self): ``` """ invocation = self._new_invocation() - self.app.workflow_manager.get_invocation.side_effect = [invocation] # type: ignore[attr-defined,union-attr] + self.app.workflow_manager.get_invocation.side_effect = [invocation] result = self._to_basic(example) expectedtime = invocation.create_time.strftime("%Y-%m-%d, %H:%M:%S") assert f"\n {expectedtime}" in result @@ -356,7 +356,7 @@ def test_ready_export_two_datasets(self): history_dataset_display(history_dataset_id=2) ``` """ - self.app.hda_manager.get_accessible.side_effect = [hda, hda2] # type: ignore[attr-defined,union-attr] + self.app.hda_manager.get_accessible.side_effect = [hda, hda2] export_markdown, extra_data = self._ready_export(example) assert "history_datasets" in extra_data assert len(extra_data["history_datasets"]) == 2 @@ -369,7 +369,7 @@ def test_export_dataset_collection_paired(self): hdca.history_id = 1 hdca.collection_id = hdca.collection.id - self.trans.app.dataset_collection_manager.get_dataset_collection_instance.return_value = hdca # type: ignore[attr-defined,union-attr] + self.trans.app.dataset_collection_manager.get_dataset_collection_instance.return_value = hdca example = """# Example ```galaxy history_dataset_collection_display(history_dataset_collection_id=1) @@ -404,7 +404,7 @@ def test_generate_time(self): def test_get_invocation_time(self): invocation = self._new_invocation() - self.app.workflow_manager.get_invocation.side_effect = [invocation] # type: ignore[attr-defined,union-attr] + self.app.workflow_manager.get_invocation.side_effect = [invocation] example = """# Example ```galaxy invocation_time(invocation_id=1) diff --git a/test/unit/app/queue_worker/conftest.py b/test/unit/app/queue_worker/conftest.py index 6adec5acd709..4e8fa6b0be4f 100644 --- a/test/unit/app/queue_worker/conftest.py +++ b/test/unit/app/queue_worker/conftest.py @@ -7,7 +7,7 @@ try: import psycopg except ImportError: - psycopg = None # type: ignore[assignment] + psycopg = None # type: ignore[assignment, unused-ignore] try: import psycopg2 diff --git a/test/unit/data/security/test_vault.py b/test/unit/data/security/test_vault.py index a64d3179cdfd..ef94d21cb773 100644 --- a/test/unit/data/security/test_vault.py +++ b/test/unit/data/security/test_vault.py @@ -32,23 +32,23 @@ class VaultTestBase(TestCase): def test_read_write_secret(self): self.vault.write_secret("my/test/secret", "hello world") - assert self.vault.read_secret("my/test/secret") == "hello world" # type: ignore + assert self.vault.read_secret("my/test/secret") == "hello world" def test_overwrite_secret(self): self.vault.write_secret("my/new/secret", "hello world") self.vault.write_secret("my/new/secret", "hello overwritten") - assert self.vault.read_secret("my/new/secret") == "hello overwritten" # type: ignore + assert self.vault.read_secret("my/new/secret") == "hello overwritten" def test_valid_paths(self): - with self.assertRaises(InvalidVaultKeyException): # type: ignore + with self.assertRaises(InvalidVaultKeyException): self.vault.write_secret("", "hello world") - with self.assertRaises(InvalidVaultKeyException): # type: ignore + with self.assertRaises(InvalidVaultKeyException): self.vault.write_secret("my//new/secret", "hello world") - with self.assertRaises(InvalidVaultKeyException): # type: ignore + with self.assertRaises(InvalidVaultKeyException): self.vault.write_secret("my/ /new/secret", "hello world") # leading and trailing slashes should be ignored self.vault.write_secret("/my/new/secret with space/", "hello overwritten") - assert self.vault.read_secret("my/new/secret with space") == "hello overwritten" # type: ignore + assert self.vault.read_secret("my/new/secret with space") == "hello overwritten" VAULT_CONF_HASHICORP = os.path.join(os.path.dirname(__file__), "fixtures/vault_conf_hashicorp.yml") @@ -94,7 +94,7 @@ def test_rotate_keys(self): vault.write_secret("my/rotated/secret", "hello rotated") # should succeed after rotation - app.config.vault_config_file = VAULT_CONF_DATABASE_ROTATED # type: ignore + app.config.vault_config_file = VAULT_CONF_DATABASE_ROTATED # type: ignore[attr-defined] vault = VaultFactory.from_app(app) assert vault.read_secret("my/rotated/secret") == "hello rotated" @@ -105,7 +105,7 @@ def test_wrong_keys(self): vault.write_secret("my/incorrect/secret", "hello incorrect") # should fail because decryption keys are the wrong - app.config.vault_config_file = VAULT_CONF_DATABASE_INVALID # type: ignore + app.config.vault_config_file = VAULT_CONF_DATABASE_INVALID # type: ignore[attr-defined] vault = VaultFactory.from_app(app) with self.assertRaises(InvalidToken): vault.read_secret("my/incorrect/secret") diff --git a/test/unit/job_execution/test_job_io.py b/test/unit/job_execution/test_job_io.py index df9ec27cf1e9..0f9d9c00dab0 100644 --- a/test/unit/job_execution/test_job_io.py +++ b/test/unit/job_execution/test_job_io.py @@ -29,7 +29,7 @@ class FileSourcesMockApp(GalaxyDataTestApp): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.file_sources = ConfiguredFileSources(ConfiguredFileSourcesConfig.from_app_config(self.config)) # type: ignore[assignment] + self.file_sources = ConfiguredFileSources(ConfiguredFileSourcesConfig.from_app_config(self.config)) @pytest.fixture diff --git a/test/unit/tool_util/toolbox/test_watcher.py b/test/unit/tool_util/toolbox/test_watcher.py index f735c693706d..39c696954f96 100644 --- a/test/unit/tool_util/toolbox/test_watcher.py +++ b/test/unit/tool_util/toolbox/test_watcher.py @@ -8,9 +8,10 @@ from galaxy.tool_util.toolbox import watcher from galaxy.util import bunch +from galaxy.util.watcher import can_watch -@pytest.mark.skipif(not watcher.can_watch, reason="watchdog not available") +@pytest.mark.skipif(not can_watch, reason="watchdog not available") def test_watcher(): with __test_directory() as t: tool_path = path.join(t, "test.xml") @@ -29,7 +30,7 @@ def test_watcher(): assert tool_watcher.observer is None -@pytest.mark.skipif(not watcher.can_watch, reason="watchdog not available") +@pytest.mark.skipif(not can_watch, reason="watchdog not available") def test_tool_conf_watcher(): callback = CallbackRecorder() conf_watcher = watcher.get_tool_conf_watcher(callback.call) diff --git a/tools/filters/gff/gff_filter_by_attribute.py b/tools/filters/gff/gff_filter_by_attribute.py index f2acf71c1f29..540d4d173912 100644 --- a/tools/filters/gff/gff_filter_by_attribute.py +++ b/tools/filters/gff/gff_filter_by_attribute.py @@ -170,7 +170,7 @@ def check_expression(text): statements = module.body if not len(statements) == 1: - return False # type: ignore[unreachable] + return False expression = statements[0] if expression.__class__.__name__ != "Expr": return False