From 7819fdc7a69a1736bf8a2e169bba54ab64aeb22b Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Mon, 22 Nov 2021 19:52:55 +0100 Subject: [PATCH] tighten type ignores --- lib/galaxy/__init__.py | 2 +- lib/galaxy/app.py | 2 +- lib/galaxy/config/script.py | 2 +- lib/galaxy/containers/docker.py | 6 +- .../datatypes/constructive_solid_geometry.py | 12 +- lib/galaxy/files/sources/ftp.py | 2 +- lib/galaxy/jobs/runners/util/cli/factory.py | 2 +- .../jobs/runners/util/cli/job/__init__.py | 2 +- lib/galaxy/managers/tags.py | 4 +- lib/galaxy/model/__init__.py | 268 +++++++++--------- lib/galaxy/model/mapping.py | 2 +- .../model/tool_shed_install/__init__.py | 4 +- lib/galaxy/objectstore/s3.py | 2 +- lib/galaxy/objectstore/s3_multipart_upload.py | 2 +- lib/galaxy/tool_util/cwl/cwltool_deps.py | 38 +-- lib/galaxy/tool_util/deps/mulled/get_tests.py | 4 +- .../tool_util/deps/mulled/mulled_search.py | 4 +- lib/galaxy/tools/wrappers.py | 2 +- lib/galaxy/util/__init__.py | 12 +- lib/galaxy/util/path/__init__.py | 4 +- lib/galaxy/util/yaml_util.py | 2 +- .../visualization/data_providers/genome.py | 2 +- lib/galaxy/web/buildapp.py | 2 +- lib/galaxy/web_stack/__init__.py | 3 +- lib/galaxy/web_stack/message.py | 12 +- lib/galaxy/webapps/galaxy/api/__init__.py | 4 +- lib/galaxy/webapps/galaxy/api/tours.py | 4 +- lib/galaxy/webapps/galaxy/api/webhooks.py | 2 +- lib/galaxy/workflow/modules.py | 5 +- lib/galaxy/workflow/refactor/execute.py | 8 +- lib/galaxy/workflow/refactor/schema.py | 2 +- lib/galaxy_ext/expressions/handle_job.py | 2 +- lib/galaxy_test/api/_framework.py | 2 +- lib/galaxy_test/selenium/framework.py | 2 +- lib/tool_shed/webapp/model/__init__.py | 42 +-- packages/app/galaxy/__init__.py | 2 +- packages/auth/galaxy/__init__.py | 2 +- packages/containers/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/objectstore/galaxy/__init__.py | 2 +- packages/tool_util/galaxy/__init__.py | 2 +- packages/util/galaxy/__init__.py | 2 +- packages/web_framework/galaxy/__init__.py | 2 +- packages/web_stack/galaxy/__init__.py | 2 +- packages/webapps/galaxy/__init__.py | 2 +- setup.cfg | 1 + test/unit/data/model/mapping/common.py | 6 +- test/unit/data/model/test_model_store.py | 2 +- ...test_request_scoped_sqlalchemy_sessions.py | 7 +- test/unit/webapps/test_webapp_base.py | 11 +- tools/interactive/isee/render.py | 2 +- tools/next_gen_conversion/solid2fastq.py | 2 +- tox.ini | 1 + 56 files changed, 265 insertions(+), 263 deletions(-) diff --git a/lib/galaxy/__init__.py b/lib/galaxy/__init__.py index a7e5f3034e47..8c478621de61 100644 --- a/lib/galaxy/__init__.py +++ b/lib/galaxy/__init__.py @@ -3,4 +3,4 @@ """ from pkgutil import extend_path -__path__ = extend_path(__path__, __name__) # type: ignore +__path__ = extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/lib/galaxy/app.py b/lib/galaxy/app.py index 713286c2391c..1dd219cc9c48 100644 --- a/lib/galaxy/app.py +++ b/lib/galaxy/app.py @@ -291,7 +291,7 @@ def __init__(self, **kwargs) -> None: # Tours registry tour_registry = build_tours_registry(self.config.tour_config_dir) self.tour_registry = tour_registry - self[ToursRegistry] = tour_registry # type: ignore + self[ToursRegistry] = tour_registry # type: ignore[misc] # Webhooks registry self.webhooks_registry = self._register_singleton(WebhooksRegistry, WebhooksRegistry(self.config.webhooks_dir)) # Load security policy. diff --git a/lib/galaxy/config/script.py b/lib/galaxy/config/script.py index ec44e7d7a2d9..82cdad9018a4 100644 --- a/lib/galaxy/config/script.py +++ b/lib/galaxy/config/script.py @@ -8,7 +8,7 @@ try: import pip except ImportError: - pip = None # type: ignore + pip = None # type: ignore[assignment] CONFIGURE_URL = "https://docs.galaxyproject.org/en/master/admin/" diff --git a/lib/galaxy/containers/docker.py b/lib/galaxy/containers/docker.py index 9a41889bcec4..438483d70f7e 100644 --- a/lib/galaxy/containers/docker.py +++ b/lib/galaxy/containers/docker.py @@ -13,13 +13,13 @@ try: import docker except ImportError: - docker = None # type: ignore + docker = None # type: ignore[assignment] try: from requests.exceptions import ConnectionError, ReadTimeout except ImportError: - ConnectionError = None # type: ignore - ReadTimeout = None # type: ignore + ConnectionError = None # type: ignore[assignment,misc] + ReadTimeout = None # type: ignore[assignment,misc] from galaxy.containers import Container, ContainerInterface from galaxy.containers.docker_decorators import ( diff --git a/lib/galaxy/datatypes/constructive_solid_geometry.py b/lib/galaxy/datatypes/constructive_solid_geometry.py index e5b7d0bedd33..4d963bfd063d 100644 --- a/lib/galaxy/datatypes/constructive_solid_geometry.py +++ b/lib/galaxy/datatypes/constructive_solid_geometry.py @@ -1,11 +1,11 @@ # TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. -# type: ignore """ Constructive Solid Geometry file formats. """ import abc +from typing import List from galaxy import util from galaxy.datatypes import data @@ -122,7 +122,7 @@ def display_peek(self, dataset): return f"Ply file ({nice_size(dataset.get_size())})" -class PlyAscii(Ply, data.Text): +class PlyAscii(Ply, data.Text): # type: ignore[misc] file_ext = "plyascii" subtype = 'ascii' @@ -130,7 +130,7 @@ def __init__(self, **kwd): data.Text.__init__(self, **kwd) -class PlyBinary(Ply, Binary): +class PlyBinary(Ply, Binary): # type: ignore[misc] file_ext = "plybinary" subtype = 'binary' @@ -313,7 +313,7 @@ def set_meta(self, dataset, **kwd): # FIELD FieldData 2 processing_field_section = True num_fields = int(items[-1]) - fields_processed = [] + fields_processed: List[str] = [] elif processing_field_section: if len(fields_processed) == num_fields: processing_field_section = False @@ -445,7 +445,7 @@ def display_peek(self, dataset): return f"Vtk file ({nice_size(dataset.get_size())})" -class VtkAscii(Vtk, data.Text): +class VtkAscii(Vtk, data.Text): # type: ignore[misc] file_ext = "vtkascii" subtype = 'ASCII' @@ -453,7 +453,7 @@ def __init__(self, **kwd): data.Text.__init__(self, **kwd) -class VtkBinary(Vtk, Binary): +class VtkBinary(Vtk, Binary): # type: ignore[misc] file_ext = "vtkbinary" subtype = 'BINARY' diff --git a/lib/galaxy/files/sources/ftp.py b/lib/galaxy/files/sources/ftp.py index 3ccdcf0fed65..eebf0fdd8527 100644 --- a/lib/galaxy/files/sources/ftp.py +++ b/lib/galaxy/files/sources/ftp.py @@ -1,7 +1,7 @@ try: from fs.ftpfs import FTPFS except ImportError: - FTPFS = None # type: ignore + FTPFS = None # type: ignore[misc,assignment] from ._pyfilesystem2 import PyFilesystem2FilesSource diff --git a/lib/galaxy/jobs/runners/util/cli/factory.py b/lib/galaxy/jobs/runners/util/cli/factory.py index 26ed37e8151f..4fa28ce1c8f5 100644 --- a/lib/galaxy/jobs/runners/util/cli/factory.py +++ b/lib/galaxy/jobs/runners/util/cli/factory.py @@ -5,7 +5,7 @@ ) code_dir = 'lib' except ImportError: - from pulsar.managers.util.cli import ( # type: ignore + from pulsar.managers.util.cli import ( # type: ignore[no-redef] CliInterface, split_params ) diff --git a/lib/galaxy/jobs/runners/util/cli/job/__init__.py b/lib/galaxy/jobs/runners/util/cli/job/__init__.py index 1a194c22a568..ea5c862c95a9 100644 --- a/lib/galaxy/jobs/runners/util/cli/job/__init__.py +++ b/lib/galaxy/jobs/runners/util/cli/job/__init__.py @@ -13,7 +13,7 @@ except ImportError: # Not in Galaxy, map Galaxy job states to Pulsar ones. - class job_states(str, Enum): # type: ignore + class job_states(str, Enum): # type: ignore[no-redef] RUNNING = 'running' OK = 'complete' QUEUED = 'queued' diff --git a/lib/galaxy/managers/tags.py b/lib/galaxy/managers/tags.py index ed8fc04fe787..3afbe9862e08 100644 --- a/lib/galaxy/managers/tags.py +++ b/lib/galaxy/managers/tags.py @@ -16,8 +16,8 @@ taggable_item_names = {item: item for item in ItemTagAssociation.associated_item_names} # This Enum is generated dynamically and mypy can not statically infer it's real type -# so it should be ignored. See:https://github.com/python/mypy/issues/4865#issuecomment-592560696 -TaggableItemClass = Enum('TaggableItemClass', taggable_item_names) # type: ignore +# so it should be ignored. See: https://github.com/python/mypy/issues/4865#issuecomment-592560696 +TaggableItemClass = Enum('TaggableItemClass', taggable_item_names) # type: ignore[misc] class ItemTagsPayload(BaseModel): diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 189536ea583b..31a1ac53afa2 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -490,50 +490,50 @@ class User(Base, Dictifiable, RepresentById): addresses = relationship('UserAddress', back_populates='user', - order_by=lambda: desc(UserAddress.update_time)) # type: ignore + order_by=lambda: desc(UserAddress.update_time)) cloudauthz = relationship('CloudAuthz', back_populates='user') custos_auth = relationship('CustosAuthnzToken', back_populates='user') default_permissions = relationship('DefaultUserPermissions', back_populates='user') groups = relationship('UserGroupAssociation', back_populates='user') histories = relationship('History', back_populates='user', - order_by=lambda: desc(History.update_time)) # type: ignore + order_by=lambda: desc(History.update_time)) # type: ignore[has-type] active_histories = relationship('History', - primaryjoin=(lambda: (History.user_id == User.id) & (not_(History.deleted))), # type: ignore + primaryjoin=(lambda: (History.user_id == User.id) & (not_(History.deleted))), # type: ignore[has-type] viewonly=True, - order_by=lambda: desc(History.update_time)) # type: ignore + order_by=lambda: desc(History.update_time)) # type: ignore[has-type] galaxy_sessions = relationship('GalaxySession', back_populates='user', - order_by=lambda: desc(GalaxySession.update_time)) # type: ignore + order_by=lambda: desc(GalaxySession.update_time)) # type: ignore[has-type] quotas = relationship('UserQuotaAssociation', back_populates='user') social_auth = relationship('UserAuthnzToken', back_populates='user') stored_workflow_menu_entries = relationship('StoredWorkflowMenuEntry', primaryjoin=(lambda: - (StoredWorkflowMenuEntry.user_id == User.id) # type: ignore - & (StoredWorkflowMenuEntry.stored_workflow_id == StoredWorkflow.id) # type: ignore - & not_(StoredWorkflow.deleted) # type: ignore + (StoredWorkflowMenuEntry.user_id == User.id) + & (StoredWorkflowMenuEntry.stored_workflow_id == StoredWorkflow.id) # type: ignore[has-type] + & not_(StoredWorkflow.deleted) # type: ignore[has-type] ), back_populates='user', cascade='all, delete-orphan', collection_class=ordering_list('order_index')) _preferences = relationship('UserPreference', collection_class=attribute_mapped_collection('name')) values = relationship('FormValues', - primaryjoin=(lambda: User.form_values_id == FormValues.id)) # type: ignore + primaryjoin=(lambda: User.form_values_id == FormValues.id)) # type: ignore[has-type] # Add type hint (will this work w/SA?) api_keys: 'List[APIKeys]' = relationship('APIKeys', back_populates='user', - order_by=lambda: desc(APIKeys.create_time)) # type: ignore + order_by=lambda: desc(APIKeys.create_time)) data_manager_histories = relationship('DataManagerHistoryAssociation', back_populates='user') roles = relationship('UserRoleAssociation', back_populates='user') stored_workflows = relationship('StoredWorkflow', back_populates='user', - primaryjoin=(lambda: User.id == StoredWorkflow.user_id)) # type: ignore + primaryjoin=(lambda: User.id == StoredWorkflow.user_id)) # type: ignore[has-type] non_private_roles = relationship( 'UserRoleAssociation', viewonly=True, primaryjoin=(lambda: - (User.id == UserRoleAssociation.user_id) # type: ignore - & (UserRoleAssociation.role_id == Role.id) # type: ignore - & not_(Role.name == User.email)) # type: ignore + (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] ) preferences: association_proxy # defined at the end of this module @@ -1935,8 +1935,8 @@ class ImplicitlyCreatedDatasetCollectionInput(Base, RepresentById): name = Column(Unicode(255)) input_dataset_collection = relationship('HistoryDatasetCollectionAssociation', - primaryjoin=(lambda: HistoryDatasetCollectionAssociation.id # type: ignore - == ImplicitlyCreatedDatasetCollectionInput.input_dataset_collection_id) # type: ignore + primaryjoin=(lambda: HistoryDatasetCollectionAssociation.id # type: ignore[has-type] + == ImplicitlyCreatedDatasetCollectionInput.input_dataset_collection_id) # type: ignore[has-type] ) def __init__(self, name, input_dataset_collection): @@ -1995,7 +1995,7 @@ class PostJobAction(Base, RepresentById): action_arguments = Column(MutableJSONType, nullable=True) workflow_step = relationship('WorkflowStep', back_populates='post_job_actions', - primaryjoin=(lambda: WorkflowStep.id == PostJobAction.workflow_step_id) # type: ignore + primaryjoin=(lambda: WorkflowStep.id == PostJobAction.workflow_step_id) # type: ignore[has-type] ) def __init__(self, action_type, workflow_step=None, output_name=None, action_arguments=None): @@ -2298,7 +2298,7 @@ class HistoryAudit(Base, RepresentById): # This class should never be instantiated. # See https://github.com/galaxyproject/galaxy/pull/11914 for details. - __init__ = None # type: ignore + __init__ = None # type: ignore[assignment] @classmethod def prune(cls, sa_session): @@ -2337,50 +2337,50 @@ class History(Base, HasTags, Dictifiable, UsesAnnotations, HasName, Serializable datasets = relationship('HistoryDatasetAssociation', back_populates='history', - order_by=lambda: asc(HistoryDatasetAssociation.hid)) # type: ignore + order_by=lambda: asc(HistoryDatasetAssociation.hid)) # type: ignore[has-type] exports = relationship('JobExportHistoryArchive', back_populates='history', - primaryjoin=lambda: JobExportHistoryArchive.history_id == History.id, # type: ignore - order_by=lambda: desc(JobExportHistoryArchive.id)) # type: ignore + primaryjoin=lambda: JobExportHistoryArchive.history_id == History.id, + order_by=lambda: desc(JobExportHistoryArchive.id)) active_datasets = relationship('HistoryDatasetAssociation', primaryjoin=( - lambda: and_(HistoryDatasetAssociation.history_id # type: ignore - == History.id, not_(HistoryDatasetAssociation.deleted)) # type: ignore + lambda: and_(HistoryDatasetAssociation.history_id # type: ignore[attr-defined] + == History.id, not_(HistoryDatasetAssociation.deleted)) # type: ignore[has-type] ), - order_by=lambda: asc(HistoryDatasetAssociation.hid), # type: ignore + order_by=lambda: asc(HistoryDatasetAssociation.hid), # type: ignore[has-type] viewonly=True) dataset_collections = relationship('HistoryDatasetCollectionAssociation', back_populates='history') active_dataset_collections = relationship('HistoryDatasetCollectionAssociation', primaryjoin=( - lambda: (and_(HistoryDatasetCollectionAssociation.history_id == History.id, # type: ignore - not_(HistoryDatasetCollectionAssociation.deleted))) # type: ignore + lambda: (and_(HistoryDatasetCollectionAssociation.history_id == History.id, # type: ignore[has-type] + not_(HistoryDatasetCollectionAssociation.deleted))) # type: ignore[has-type] ), - order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid), # type: ignore + order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid), # type: ignore[has-type] viewonly=True) visible_datasets = relationship('HistoryDatasetAssociation', primaryjoin=( - lambda: and_(HistoryDatasetAssociation.history_id == History.id, # type: ignore - not_(HistoryDatasetAssociation.deleted), HistoryDatasetAssociation.visible) # type: ignore + lambda: and_(HistoryDatasetAssociation.history_id == History.id, # type: ignore[attr-defined] + not_(HistoryDatasetAssociation.deleted), HistoryDatasetAssociation.visible) # type: ignore[has-type] ), - order_by=lambda: asc(HistoryDatasetAssociation.hid), # type: ignore + order_by=lambda: asc(HistoryDatasetAssociation.hid), # type: ignore[has-type] viewonly=True) visible_dataset_collections = relationship('HistoryDatasetCollectionAssociation', primaryjoin=( lambda: and_( - HistoryDatasetCollectionAssociation.history_id == History.id, # type: ignore - not_(HistoryDatasetCollectionAssociation.deleted), # type: ignore - HistoryDatasetCollectionAssociation.visible) # type: ignore + HistoryDatasetCollectionAssociation.history_id == History.id, # type: ignore[has-type] + not_(HistoryDatasetCollectionAssociation.deleted), # type: ignore[has-type] + HistoryDatasetCollectionAssociation.visible) # type: ignore[has-type] ), - order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid), # type: ignore + order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid), # type: ignore[has-type] viewonly=True) tags = relationship('HistoryTagAssociation', - order_by=lambda: HistoryTagAssociation.id, # type: ignore + order_by=lambda: HistoryTagAssociation.id, back_populates='history') annotations = relationship('HistoryAnnotationAssociation', - order_by=lambda: HistoryAnnotationAssociation.id, # type: ignore + order_by=lambda: HistoryAnnotationAssociation.id, back_populates='history') ratings = relationship('HistoryRatingAssociation', - order_by=lambda: HistoryRatingAssociation.id, # type: ignore + order_by=lambda: HistoryRatingAssociation.id, # type: ignore[has-type] back_populates='history') default_permissions = relationship('DefaultHistoryPermissions', back_populates='history') users_shared_with = relationship('HistoryUserShareAssociation', back_populates='history') @@ -2678,7 +2678,7 @@ def disk_size(self): rval = 0 return rval - @disk_size.expression # type: ignore + @disk_size.expression # type: ignore[no-redef] def disk_size(cls): """ Return a query scalar that will get any history's size in bytes by summing @@ -4365,7 +4365,7 @@ def history_content_type(self): def type_id(self): return '-'.join((self.content_type, str(self.id))) - @type_id.expression # type: ignore + @type_id.expression # type: ignore[no-redef] def type_id(cls): return ((type_coerce(cls.content_type, Unicode) + '-' + type_coerce(cls.id, Unicode)).label('type_id')) @@ -4435,11 +4435,11 @@ class HistoryDatasetAssociationSubset(Base, RepresentById): location = Column(Unicode(255), index=True) hda = relationship('HistoryDatasetAssociation', - primaryjoin=(lambda: HistoryDatasetAssociationSubset.history_dataset_association_id # type: ignore - == HistoryDatasetAssociation.id)) # type: ignore + primaryjoin=(lambda: HistoryDatasetAssociationSubset.history_dataset_association_id + == HistoryDatasetAssociation.id)) subset = relationship('HistoryDatasetAssociation', - primaryjoin=(lambda: HistoryDatasetAssociationSubset.history_dataset_association_subset_id # type: ignore - == HistoryDatasetAssociation.id)) # type: ignore + primaryjoin=(lambda: HistoryDatasetAssociationSubset.history_dataset_association_subset_id + == HistoryDatasetAssociation.id)) def __init__(self, hda, subset, location): self.hda = hda @@ -4544,7 +4544,7 @@ class LibraryFolder(Base, Dictifiable, HasName, Serializable): genome_build = Column(TrimmedString(40)) folders = relationship('LibraryFolder', - primaryjoin=(lambda: LibraryFolder.id == LibraryFolder.parent_id), # type: ignore + primaryjoin=(lambda: LibraryFolder.id == LibraryFolder.parent_id), order_by=asc(name), back_populates='parent') parent = relationship('LibraryFolder', back_populates='folders', remote_side=[id]) @@ -4970,13 +4970,13 @@ class LibraryInfoAssociation(Base, RepresentById): library = relationship('Library', primaryjoin=( lambda: and_( - LibraryInfoAssociation.library_id == Library.id, # type: ignore - not_(LibraryInfoAssociation.deleted)) # type: ignore + LibraryInfoAssociation.library_id == Library.id, + not_(LibraryInfoAssociation.deleted)) )) template = relationship('FormDefinition', - primaryjoin=lambda: LibraryInfoAssociation.form_definition_id == FormDefinition.id) # type: ignore + primaryjoin=lambda: LibraryInfoAssociation.form_definition_id == FormDefinition.id) info = relationship('FormValues', - primaryjoin=lambda: LibraryInfoAssociation.form_values_id == FormValues.id) # type: ignore + primaryjoin=lambda: LibraryInfoAssociation.form_values_id == FormValues.id) # type: ignore[has-type] def __init__(self, library, form_definition, info, inheritable=False): self.library = library @@ -4997,12 +4997,12 @@ class LibraryFolderInfoAssociation(Base, RepresentById): folder = relationship('LibraryFolder', primaryjoin=(lambda: - (LibraryFolderInfoAssociation.library_folder_id == LibraryFolder.id) # type: ignore - & (not_(LibraryFolderInfoAssociation.deleted)))) # type: ignore + (LibraryFolderInfoAssociation.library_folder_id == LibraryFolder.id) + & (not_(LibraryFolderInfoAssociation.deleted)))) template = relationship('FormDefinition', - primaryjoin=(lambda: LibraryFolderInfoAssociation.form_definition_id == FormDefinition.id)) # type: ignore + primaryjoin=(lambda: LibraryFolderInfoAssociation.form_definition_id == FormDefinition.id)) info = relationship('FormValues', - primaryjoin=(lambda: LibraryFolderInfoAssociation.form_values_id == FormValues.id)) # type: ignore + primaryjoin=(lambda: LibraryFolderInfoAssociation.form_values_id == FormValues.id)) # type: ignore[has-type] def __init__(self, folder, form_definition, info, inheritable=False): self.folder = folder @@ -5029,10 +5029,10 @@ class LibraryDatasetDatasetInfoAssociation(Base, RepresentById): )) template = relationship('FormDefinition', primaryjoin=(lambda: - LibraryDatasetDatasetInfoAssociation.form_definition_id == FormDefinition.id)) # type: ignore + LibraryDatasetDatasetInfoAssociation.form_definition_id == FormDefinition.id)) info = relationship('FormValues', primaryjoin=(lambda: - LibraryDatasetDatasetInfoAssociation.form_values_id == FormValues.id)) # type: ignore + LibraryDatasetDatasetInfoAssociation.form_values_id == FormValues.id)) # type: ignore[has-type] def __init__(self, library_dataset_dataset_association, form_definition, info): # TODO: need to figure out if this should be inheritable to the associated LibraryDataset @@ -5061,20 +5061,20 @@ class ImplicitlyConvertedDatasetAssociation(Base, RepresentById): type = Column(TrimmedString(255)) parent_hda = relationship('HistoryDatasetAssociation', - primaryjoin=(lambda: ImplicitlyConvertedDatasetAssociation.hda_parent_id # type: ignore - == HistoryDatasetAssociation.id), # type: ignore + primaryjoin=(lambda: ImplicitlyConvertedDatasetAssociation.hda_parent_id + == HistoryDatasetAssociation.id), back_populates='implicitly_converted_datasets') dataset_ldda = relationship('LibraryDatasetDatasetAssociation', - primaryjoin=(lambda: ImplicitlyConvertedDatasetAssociation.ldda_id # type: ignore - == LibraryDatasetDatasetAssociation.id), # type: ignore + primaryjoin=(lambda: ImplicitlyConvertedDatasetAssociation.ldda_id + == LibraryDatasetDatasetAssociation.id), back_populates='implicitly_converted_parent_datasets') dataset = relationship('HistoryDatasetAssociation', - primaryjoin=(lambda: ImplicitlyConvertedDatasetAssociation.hda_id # type: ignore - == HistoryDatasetAssociation.id), # type: ignore + primaryjoin=(lambda: ImplicitlyConvertedDatasetAssociation.hda_id + == HistoryDatasetAssociation.id), back_populates='implicitly_converted_parent_datasets') parent_ldda = relationship('LibraryDatasetDatasetAssociation', - primaryjoin=(lambda: ImplicitlyConvertedDatasetAssociation.ldda_parent_id # type: ignore - == LibraryDatasetDatasetAssociation.table.c.id), # type: ignore + primaryjoin=(lambda: ImplicitlyConvertedDatasetAssociation.ldda_parent_id + == LibraryDatasetDatasetAssociation.table.c.id), back_populates='implicitly_converted_datasets') def __init__(self, id=None, parent=None, dataset=None, file_type=None, deleted=False, purged=False, metadata_safe=True): @@ -5135,9 +5135,9 @@ class DatasetCollection(Base, Dictifiable, UsesAnnotations, Serializable): update_time = Column(DateTime, default=now, onupdate=now) elements = relationship('DatasetCollectionElement', - primaryjoin=(lambda: DatasetCollection.id == DatasetCollectionElement.dataset_collection_id), # type: ignore + primaryjoin=(lambda: DatasetCollection.id == DatasetCollectionElement.dataset_collection_id), # type: ignore[has-type] back_populates='collection', - order_by=lambda: DatasetCollectionElement.element_index) # type: ignore + order_by=lambda: DatasetCollectionElement.element_index) # type: ignore[has-type] dict_collection_visible_keys = ['id', 'collection_type'] dict_element_visible_keys = ['id', 'collection_type'] @@ -5542,8 +5542,8 @@ class HistoryDatasetCollectionAssociation( back_populates='copied_from_history_dataset_collection_association', ) implicit_input_collections = relationship('ImplicitlyCreatedDatasetCollectionInput', - primaryjoin=(lambda: HistoryDatasetCollectionAssociation.id # type: ignore - == ImplicitlyCreatedDatasetCollectionInput.dataset_collection_id) # type: ignore + primaryjoin=(lambda: HistoryDatasetCollectionAssociation.id + == ImplicitlyCreatedDatasetCollectionInput.dataset_collection_id) ) implicit_collection_jobs = relationship('ImplicitCollectionJobs', uselist=False) job = relationship( @@ -5552,24 +5552,24 @@ class HistoryDatasetCollectionAssociation( uselist=False, ) job_state_summary = relationship(HistoryDatasetCollectionJobStateSummary, - primaryjoin=(lambda: HistoryDatasetCollectionAssociation.id # type: ignore - == HistoryDatasetCollectionJobStateSummary.__table__.c.hdca_id), # type: ignore + primaryjoin=(lambda: HistoryDatasetCollectionAssociation.id + == HistoryDatasetCollectionJobStateSummary.__table__.c.hdca_id), foreign_keys=HistoryDatasetCollectionJobStateSummary.__table__.c.hdca_id, uselist=False, ) tags = relationship( 'HistoryDatasetCollectionTagAssociation', - order_by=lambda: HistoryDatasetCollectionTagAssociation.id, # type: ignore + order_by=lambda: HistoryDatasetCollectionTagAssociation.id, back_populates='dataset_collection', ) annotations = relationship( 'HistoryDatasetCollectionAssociationAnnotationAssociation', - order_by=lambda: HistoryDatasetCollectionAssociationAnnotationAssociation.id, # type: ignore + order_by=lambda: HistoryDatasetCollectionAssociationAnnotationAssociation.id, back_populates='history_dataset_collection', ) ratings = relationship( 'HistoryDatasetCollectionRatingAssociation', - order_by=lambda: HistoryDatasetCollectionRatingAssociation.id, # type: ignore + order_by=lambda: HistoryDatasetCollectionRatingAssociation.id, # type: ignore[has-type] back_populates='dataset_collection', ) @@ -5596,7 +5596,7 @@ def history_content_type(self): def type_id(self): return '-'.join((self.content_type, str(self.id))) - @type_id.expression # type: ignore + @type_id.expression # type: ignore[no-redef] def type_id(cls): return ((type_coerce(cls.content_type, Unicode) + '-' + type_coerce(cls.id, Unicode)).label('type_id')) @@ -5794,13 +5794,13 @@ class LibraryDatasetCollectionAssociation(Base, DatasetCollectionInstance, Repre folder = relationship('LibraryFolder') tags = relationship('LibraryDatasetCollectionTagAssociation', - order_by=lambda: LibraryDatasetCollectionTagAssociation.id, # type: ignore + order_by=lambda: LibraryDatasetCollectionTagAssociation.id, back_populates='dataset_collection') annotations = relationship('LibraryDatasetCollectionAnnotationAssociation', - order_by=lambda: LibraryDatasetCollectionAnnotationAssociation.id, # type: ignore + order_by=lambda: LibraryDatasetCollectionAnnotationAssociation.id, back_populates="dataset_collection") ratings = relationship('LibraryDatasetCollectionRatingAssociation', - order_by=lambda: LibraryDatasetCollectionRatingAssociation.id, # type: ignore + order_by=lambda: LibraryDatasetCollectionRatingAssociation.id, # type: ignore[has-type] back_populates="dataset_collection") editable_keys = ('name', 'deleted') @@ -5840,13 +5840,13 @@ class DatasetCollectionElement(Base, Dictifiable, Serializable): element_identifier = Column(Unicode(255)) hda = relationship('HistoryDatasetAssociation', - primaryjoin=(lambda: DatasetCollectionElement.hda_id == HistoryDatasetAssociation.id)) # type: ignore + primaryjoin=(lambda: DatasetCollectionElement.hda_id == HistoryDatasetAssociation.id)) ldda = relationship('LibraryDatasetDatasetAssociation', - primaryjoin=(lambda: DatasetCollectionElement.ldda_id == LibraryDatasetDatasetAssociation.id)) # type: ignore + primaryjoin=(lambda: DatasetCollectionElement.ldda_id == LibraryDatasetDatasetAssociation.id)) child_collection = relationship('DatasetCollection', - primaryjoin=(lambda: DatasetCollectionElement.child_collection_id == DatasetCollection.id)) # type: ignore + primaryjoin=(lambda: DatasetCollectionElement.child_collection_id == DatasetCollection.id)) collection = relationship('DatasetCollection', - primaryjoin=(lambda: DatasetCollection.id == DatasetCollectionElement.dataset_collection_id), # type: ignore + primaryjoin=(lambda: DatasetCollection.id == DatasetCollectionElement.dataset_collection_id), back_populates='elements', ) @@ -6090,32 +6090,32 @@ class StoredWorkflow(Base, HasTags, Dictifiable, RepresentById): published = Column(Boolean, index=True, default=False) user = relationship('User', - primaryjoin=(lambda: User.id == StoredWorkflow.user_id), # type: ignore + primaryjoin=(lambda: User.id == StoredWorkflow.user_id), back_populates='stored_workflows') workflows = relationship('Workflow', back_populates='stored_workflow', cascade="all, delete-orphan", - primaryjoin=(lambda: StoredWorkflow.id == Workflow.stored_workflow_id), # type: ignore - order_by=lambda: -Workflow.id) # type: ignore + primaryjoin=(lambda: StoredWorkflow.id == Workflow.stored_workflow_id), # type: ignore[has-type] + order_by=lambda: -Workflow.id) # type: ignore[has-type] latest_workflow = relationship('Workflow', post_update=True, - primaryjoin=(lambda: StoredWorkflow.latest_workflow_id == Workflow.id), # type: ignore + primaryjoin=(lambda: StoredWorkflow.latest_workflow_id == Workflow.id), # type: ignore[has-type] lazy=False) tags = relationship('StoredWorkflowTagAssociation', - order_by=lambda: StoredWorkflowTagAssociation.id, # type: ignore + order_by=lambda: StoredWorkflowTagAssociation.id, back_populates="stored_workflow") owner_tags = relationship('StoredWorkflowTagAssociation', primaryjoin=(lambda: - and_(StoredWorkflow.id == StoredWorkflowTagAssociation.stored_workflow_id, # type: ignore - StoredWorkflow.user_id == StoredWorkflowTagAssociation.user_id) # type: ignore + and_(StoredWorkflow.id == StoredWorkflowTagAssociation.stored_workflow_id, + StoredWorkflow.user_id == StoredWorkflowTagAssociation.user_id) ), viewonly=True, - order_by=lambda: StoredWorkflowTagAssociation.id) # type: ignore + order_by=lambda: StoredWorkflowTagAssociation.id) annotations = relationship('StoredWorkflowAnnotationAssociation', - order_by=lambda: StoredWorkflowAnnotationAssociation.id, # type: ignore + order_by=lambda: StoredWorkflowAnnotationAssociation.id, back_populates="stored_workflow") ratings = relationship('StoredWorkflowRatingAssociation', - order_by=lambda: StoredWorkflowRatingAssociation.id, # type: ignore + order_by=lambda: StoredWorkflowRatingAssociation.id, # type: ignore[has-type] back_populates="stored_workflow") users_shared_with = relationship('StoredWorkflowUserShareAssociation', back_populates='stored_workflow') @@ -6193,16 +6193,16 @@ class Workflow(Base, Dictifiable, RepresentById): steps = relationship('WorkflowStep', back_populates='workflow', - primaryjoin=(lambda: Workflow.id == WorkflowStep.workflow_id), # type: ignore - order_by=lambda: asc(WorkflowStep.order_index), # type: ignore + primaryjoin=(lambda: Workflow.id == WorkflowStep.workflow_id), # type: ignore[has-type] + order_by=lambda: asc(WorkflowStep.order_index), # type: ignore[has-type] cascade="all, delete-orphan", lazy=False) parent_workflow_steps = relationship( 'WorkflowStep', - primaryjoin=(lambda: Workflow.id == WorkflowStep.subworkflow_id), # type: ignore + primaryjoin=(lambda: Workflow.id == WorkflowStep.subworkflow_id), # type: ignore[has-type] back_populates='subworkflow') stored_workflow = relationship('StoredWorkflow', - primaryjoin=(lambda: StoredWorkflow.id == Workflow.stored_workflow_id), # type: ignore + primaryjoin=(lambda: StoredWorkflow.id == Workflow.stored_workflow_id), back_populates='workflows') step_count: column_property @@ -6360,24 +6360,24 @@ class WorkflowStep(Base, RepresentById): temp_input_connections: Optional[InputConnDictType] subworkflow = relationship('Workflow', - primaryjoin=(lambda: Workflow.id == WorkflowStep.subworkflow_id), # type: ignore + primaryjoin=(lambda: Workflow.id == WorkflowStep.subworkflow_id), back_populates='parent_workflow_steps') dynamic_tool = relationship('DynamicTool', - primaryjoin=(lambda: DynamicTool.id == WorkflowStep.dynamic_tool_id)) # type: ignore + primaryjoin=(lambda: DynamicTool.id == WorkflowStep.dynamic_tool_id)) tags = relationship('WorkflowStepTagAssociation', - order_by=lambda: WorkflowStepTagAssociation.id, # type: ignore + order_by=lambda: WorkflowStepTagAssociation.id, back_populates='workflow_step') annotations = relationship('WorkflowStepAnnotationAssociation', - order_by=lambda: WorkflowStepAnnotationAssociation.id, # type: ignore + order_by=lambda: WorkflowStepAnnotationAssociation.id, back_populates="workflow_step") post_job_actions = relationship('PostJobAction', back_populates='workflow_step') inputs = relationship('WorkflowStepInput', back_populates='workflow_step') workflow_outputs = relationship('WorkflowOutput', back_populates='workflow_step') output_connections = relationship('WorkflowStepConnection', - primaryjoin=(lambda: WorkflowStepConnection.output_step_id == WorkflowStep.id) # type: ignore + primaryjoin=(lambda: WorkflowStepConnection.output_step_id == WorkflowStep.id) ) workflow = relationship('Workflow', - primaryjoin=(lambda: Workflow.id == WorkflowStep.workflow_id), # type: ignore + primaryjoin=(lambda: Workflow.id == WorkflowStep.workflow_id), back_populates='steps' ) @@ -6582,11 +6582,11 @@ class WorkflowStepInput(Base, RepresentById): workflow_step = relationship('WorkflowStep', back_populates='inputs', cascade='all', - primaryjoin=(lambda: WorkflowStepInput.workflow_step_id == WorkflowStep.id)) # type: ignore + primaryjoin=(lambda: WorkflowStepInput.workflow_step_id == WorkflowStep.id)) connections = relationship( 'WorkflowStepConnection', back_populates='input_step_input', - primaryjoin=(lambda: WorkflowStepConnection.input_step_input_id == WorkflowStepInput.id)) # type: ignore + primaryjoin=(lambda: WorkflowStepConnection.input_step_input_id == WorkflowStepInput.id)) def __init__(self, workflow_step): self.workflow_step = workflow_step @@ -6616,13 +6616,13 @@ class WorkflowStepConnection(Base, RepresentById): input_step_input = relationship('WorkflowStepInput', back_populates='connections', cascade='all', - primaryjoin=(lambda: WorkflowStepConnection.input_step_input_id == WorkflowStepInput.id)) # type: ignore + primaryjoin=(lambda: WorkflowStepConnection.input_step_input_id == WorkflowStepInput.id)) input_subworkflow_step = relationship('WorkflowStep', - primaryjoin=(lambda: WorkflowStepConnection.input_subworkflow_step_id == WorkflowStep.id)) # type: ignore + primaryjoin=(lambda: WorkflowStepConnection.input_subworkflow_step_id == WorkflowStep.id)) output_step = relationship('WorkflowStep', back_populates='output_connections', cascade='all', - primaryjoin=(lambda: WorkflowStepConnection.output_step_id == WorkflowStep.id)) # type: ignore + primaryjoin=(lambda: WorkflowStepConnection.output_step_id == WorkflowStep.id)) # Constant used in lieu of output_name and input_name to indicate an # implicit connection between two steps that is not dependent on a dataset @@ -6701,9 +6701,9 @@ class StoredWorkflowMenuEntry(Base, RepresentById): stored_workflow = relationship('StoredWorkflow') user = relationship('User', back_populates='stored_workflow_menu_entries', primaryjoin=(lambda: - (StoredWorkflowMenuEntry.user_id == User.id) # type: ignore - & (StoredWorkflowMenuEntry.stored_workflow_id == StoredWorkflow.id) # type: ignore - & not_(StoredWorkflow.deleted)) # type: ignore + (StoredWorkflowMenuEntry.user_id == User.id) + & (StoredWorkflowMenuEntry.stored_workflow_id == StoredWorkflow.id) + & not_(StoredWorkflow.deleted)) ) @@ -6732,8 +6732,8 @@ class WorkflowInvocation(Base, UsesCreateAndUpdateTime, Dictifiable, RepresentBy back_populates='workflow_invocation') subworkflow_invocations = relationship('WorkflowInvocationToSubworkflowInvocationAssociation', primaryjoin=(lambda: - WorkflowInvocationToSubworkflowInvocationAssociation.workflow_invocation_id # type: ignore - == WorkflowInvocation.id), # type: ignore + WorkflowInvocationToSubworkflowInvocationAssociation.workflow_invocation_id + == WorkflowInvocation.id), back_populates='parent_workflow_invocation', uselist=True, ) @@ -7104,15 +7104,15 @@ class WorkflowInvocationToSubworkflowInvocationAssociation(Base, Dictifiable, Re subworkflow_invocation = relationship('WorkflowInvocation', primaryjoin=(lambda: - WorkflowInvocationToSubworkflowInvocationAssociation.subworkflow_invocation_id # type: ignore - == WorkflowInvocation.id), # type: ignore + WorkflowInvocationToSubworkflowInvocationAssociation.subworkflow_invocation_id + == WorkflowInvocation.id), uselist=False, ) workflow_step = relationship('WorkflowStep') parent_workflow_invocation = relationship('WorkflowInvocation', primaryjoin=(lambda: - WorkflowInvocationToSubworkflowInvocationAssociation.workflow_invocation_id # type: ignore - == WorkflowInvocation.id), # type: ignore + WorkflowInvocationToSubworkflowInvocationAssociation.workflow_invocation_id + == WorkflowInvocation.id), back_populates='subworkflow_invocations', uselist=False, ) @@ -7148,9 +7148,9 @@ class WorkflowInvocationStep(Base, Dictifiable, RepresentById): output_value = relationship('WorkflowInvocationOutputValue', foreign_keys='[WorkflowInvocationStep.workflow_invocation_id, WorkflowInvocationStep.workflow_step_id]', primaryjoin=(lambda: and_( - WorkflowInvocationStep.workflow_invocation_id # type: ignore - == WorkflowInvocationOutputValue.workflow_invocation_id, # type: ignore - WorkflowInvocationStep.workflow_step_id == WorkflowInvocationOutputValue.workflow_step_id, # type: ignore + WorkflowInvocationStep.workflow_invocation_id + == WorkflowInvocationOutputValue.workflow_invocation_id, + WorkflowInvocationStep.workflow_step_id == WorkflowInvocationOutputValue.workflow_step_id, )), back_populates='workflow_invocation_step', viewonly=True @@ -7383,8 +7383,8 @@ class WorkflowInvocationOutputValue(Base, Dictifiable, RepresentById): workflow_invocation_step = relationship('WorkflowInvocationStep', foreign_keys='[WorkflowInvocationStep.workflow_invocation_id, WorkflowInvocationStep.workflow_step_id]', primaryjoin=(lambda: and_( - WorkflowInvocationStep.workflow_invocation_id == WorkflowInvocationOutputValue.workflow_invocation_id, # type: ignore - WorkflowInvocationStep.workflow_step_id == WorkflowInvocationOutputValue.workflow_step_id, # type: ignore + WorkflowInvocationStep.workflow_invocation_id == WorkflowInvocationOutputValue.workflow_invocation_id, + WorkflowInvocationStep.workflow_step_id == WorkflowInvocationOutputValue.workflow_step_id, )), back_populates='output_value', viewonly=True @@ -7514,7 +7514,7 @@ class FormDefinition(Base, Dictifiable, RepresentById): form_definition_current = relationship( 'FormDefinitionCurrent', back_populates='forms', - primaryjoin=(lambda: FormDefinitionCurrent.id == FormDefinition.form_definition_current_id)) # type: ignore + primaryjoin=(lambda: FormDefinitionCurrent.id == FormDefinition.form_definition_current_id)) # type: ignore[has-type] # The following form_builder classes are supported by the FormDefinition class. supported_field_types = [AddressField, CheckboxField, PasswordField, SelectField, TextArea, TextField, WorkflowField, WorkflowMappingField, HistoryField] @@ -7562,11 +7562,11 @@ class FormDefinitionCurrent(Base, RepresentById): 'FormDefinition', back_populates='form_definition_current', cascade='all, delete-orphan', - primaryjoin=(lambda: FormDefinitionCurrent.id == FormDefinition.form_definition_current_id)) # type: ignore + primaryjoin=(lambda: FormDefinitionCurrent.id == FormDefinition.form_definition_current_id)) latest_form = relationship( 'FormDefinition', post_update=True, - primaryjoin=(lambda: FormDefinitionCurrent.latest_form_id == FormDefinition.id)) # type: ignore + primaryjoin=(lambda: FormDefinitionCurrent.latest_form_id == FormDefinition.id)) def __init__(self, form_definition=None): self.latest_form = form_definition @@ -7582,7 +7582,7 @@ class FormValues(Base, RepresentById): content = Column(MutableJSONType) form_definition = relationship( 'FormDefinition', - primaryjoin=(lambda: FormValues.form_definition_id == FormDefinition.id)) # type: ignore + primaryjoin=(lambda: FormValues.form_definition_id == FormDefinition.id)) def __init__(self, form_def=None, content=None): self.form_definition = form_def @@ -7944,24 +7944,24 @@ class Page(Base, Dictifiable, RepresentById): revisions = relationship( 'PageRevision', cascade="all, delete-orphan", - primaryjoin=(lambda: Page.id == PageRevision.page_id), # type: ignore + primaryjoin=(lambda: Page.id == PageRevision.page_id), # type: ignore[has-type] back_populates='page') latest_revision = relationship( 'PageRevision', post_update=True, - primaryjoin=(lambda: Page.latest_revision_id == PageRevision.id), # type: ignore + primaryjoin=(lambda: Page.latest_revision_id == PageRevision.id), # type: ignore[has-type] lazy=False) tags = relationship( 'PageTagAssociation', - order_by=lambda: PageTagAssociation.id, # type: ignore + order_by=lambda: PageTagAssociation.id, back_populates='page') annotations = relationship( 'PageAnnotationAssociation', - order_by=lambda: PageAnnotationAssociation.id, # type: ignore + order_by=lambda: PageAnnotationAssociation.id, back_populates='page') ratings = relationship( 'PageRatingAssociation', - order_by=lambda: PageRatingAssociation.id, # type: ignore + order_by=lambda: PageRatingAssociation.id, # type: ignore[has-type] back_populates='page') users_shared_with = relationship( 'PageUserShareAssociation', @@ -8001,7 +8001,7 @@ class PageRevision(Base, Dictifiable, RepresentById): content = Column(TEXT) content_format = Column(TrimmedString(32)) page = relationship('Page', - primaryjoin=(lambda: Page.id == PageRevision.page_id)) # type: ignore + primaryjoin=(lambda: Page.id == PageRevision.page_id)) DEFAULT_CONTENT_FORMAT = 'html' dict_element_visible_keys = ['id', 'page_id', 'title', 'content', 'content_format'] @@ -8051,19 +8051,19 @@ class Visualization(Base, RepresentById): revisions = relationship('VisualizationRevision', back_populates='visualization', cascade="all, delete-orphan", - primaryjoin=(lambda: Visualization.id == VisualizationRevision.visualization_id)) # type: ignore + primaryjoin=(lambda: Visualization.id == VisualizationRevision.visualization_id)) latest_revision = relationship('VisualizationRevision', post_update=True, - primaryjoin=(lambda: Visualization.latest_revision_id == VisualizationRevision.id), # type: ignore + primaryjoin=(lambda: Visualization.latest_revision_id == VisualizationRevision.id), lazy=False) tags = relationship('VisualizationTagAssociation', - order_by=lambda: VisualizationTagAssociation.id, # type: ignore + order_by=lambda: VisualizationTagAssociation.id, back_populates="visualization") annotations = relationship('VisualizationAnnotationAssociation', - order_by=lambda: VisualizationAnnotationAssociation.id, # type: ignore + order_by=lambda: VisualizationAnnotationAssociation.id, back_populates="visualization") ratings = relationship('VisualizationRatingAssociation', - order_by=lambda: VisualizationRatingAssociation.id, # type: ignore + order_by=lambda: VisualizationRatingAssociation.id, # type: ignore[has-type] back_populates="visualization") users_shared_with = relationship('VisualizationUserShareAssociation', back_populates='visualization') @@ -8116,7 +8116,7 @@ class VisualizationRevision(Base, RepresentById): config = Column(MutableJSONType) visualization = relationship('Visualization', back_populates='revisions', - primaryjoin=(lambda: Visualization.id == VisualizationRevision.visualization_id)) # type: ignore + primaryjoin=(lambda: Visualization.id == VisualizationRevision.visualization_id)) def copy(self, visualization=None): """ diff --git a/lib/galaxy/model/mapping.py b/lib/galaxy/model/mapping.py index cb57baf82eb5..92f94416ca75 100644 --- a/lib/galaxy/model/mapping.py +++ b/lib/galaxy/model/mapping.py @@ -36,7 +36,7 @@ def _workflow_invocation_update(self): session.execute(stmt) -model.WorkflowInvocation.update = _workflow_invocation_update # type: ignore +model.WorkflowInvocation.update = _workflow_invocation_update class GalaxyModelMapping(SharedModelMapping): diff --git a/lib/galaxy/model/tool_shed_install/__init__.py b/lib/galaxy/model/tool_shed_install/__init__.py index a8c8bb46b423..825e1e6900cd 100644 --- a/lib/galaxy/model/tool_shed_install/__init__.py +++ b/lib/galaxy/model/tool_shed_install/__init__.py @@ -663,9 +663,9 @@ class ToolVersion(Base, Dictifiable, _HasTable): tool_id = Column(String(255)) tool_shed_repository_id = Column(ForeignKey('tool_shed_repository.id'), index=True, nullable=True) parent_tool_association = relationship('ToolVersionAssociation', - primaryjoin=(lambda: ToolVersion.id == ToolVersionAssociation.tool_id)) # type: ignore + primaryjoin=(lambda: ToolVersion.id == ToolVersionAssociation.tool_id)) child_tool_association = relationship('ToolVersionAssociation', - primaryjoin=(lambda: ToolVersion.id == ToolVersionAssociation.parent_id)) # type: ignore + primaryjoin=(lambda: ToolVersion.id == ToolVersionAssociation.parent_id)) tool_shed_repository = relationship('ToolShedRepository', back_populates='tool_versions') dict_element_visible_keys = ['id', 'tool_shed_repository'] diff --git a/lib/galaxy/objectstore/s3.py b/lib/galaxy/objectstore/s3.py index 0f7079fe78f4..40b91a567ce1 100644 --- a/lib/galaxy/objectstore/s3.py +++ b/lib/galaxy/objectstore/s3.py @@ -17,7 +17,7 @@ from boto.s3.connection import S3Connection from boto.s3.key import Key except ImportError: - boto = None # type: ignore + boto = None # type: ignore[assignment] from galaxy.exceptions import ObjectInvalid, ObjectNotFound from galaxy.util import ( diff --git a/lib/galaxy/objectstore/s3_multipart_upload.py b/lib/galaxy/objectstore/s3_multipart_upload.py index 050bef97b299..f90a4937ef62 100644 --- a/lib/galaxy/objectstore/s3_multipart_upload.py +++ b/lib/galaxy/objectstore/s3_multipart_upload.py @@ -14,7 +14,7 @@ import boto from boto.s3.connection import S3Connection except ImportError: - boto = None # type: ignore + boto = None # type: ignore[assignment] def mp_from_ids(s3server, mp_id, mp_keyname, mp_bucketname): diff --git a/lib/galaxy/tool_util/cwl/cwltool_deps.py b/lib/galaxy/tool_util/cwl/cwltool_deps.py index 87677ba7dcb7..02155e81dd98 100644 --- a/lib/galaxy/tool_util/cwl/cwltool_deps.py +++ b/lib/galaxy/tool_util/cwl/cwltool_deps.py @@ -20,11 +20,11 @@ pathmapper, ) except ImportError: - main = None # type: ignore - workflow = None # type: ignore - job = None # type: ignore - process = None # type: ignore - pathmapper = None # type: ignore + main = None # type: ignore[assignment] + workflow = None # type: ignore[assignment] + job = None # type: ignore[assignment] + process = None # type: ignore[assignment] + pathmapper = None # type: ignore[assignment] try: from cwltool.context import ( @@ -35,11 +35,11 @@ from cwltool.job import relink_initialworkdir from cwltool.stdfsaccess import StdFsAccess except ImportError: - getdefault = None # type: ignore - LoadingContext = None # type: ignore - relink_initialworkdir = None # type: ignore - RuntimeContext = None # type: ignore - StdFsAccess = None # type: ignore + getdefault = None # type: ignore[assignment] + LoadingContext = None # type: ignore[assignment,misc] + relink_initialworkdir = None # type: ignore[assignment] + RuntimeContext = None # type: ignore[assignment,misc] + StdFsAccess = None # type: ignore[assignment,misc] try: from cwltool import load_tool @@ -48,25 +48,25 @@ resolve_and_validate_document, ) except ImportError: - default_loader = None # type: ignore - load_tool = None # type: ignore - resolve_and_validate_document = None # type: ignore + default_loader = None # type: ignore[assignment] + load_tool = None # type: ignore[assignment] + resolve_and_validate_document = None # type: ignore[assignment] try: from cwltool import command_line_tool except ImportError: - command_line_tool = None # type: ignore + command_line_tool = None # type: ignore[assignment] try: from cwltool.load_tool import resolve_and_validate_document except ImportError: - resolve_and_validate_document = None # type: ignore + resolve_and_validate_document = None # type: ignore[assignment] try: import shellescape except ImportError: - shellescape = None # type: ignore + shellescape = None try: import schema_salad @@ -75,9 +75,9 @@ sourceline, ) except ImportError: - schema_salad = None # type: ignore - ref_resolver = None # type: ignore - sourceline = None # type: ignore + schema_salad = None # type: ignore[assignment] + ref_resolver = None # type: ignore[assignment] + sourceline = None # type: ignore[assignment] needs_shell_quoting = re.compile(r"""(^$|[\s|&;()<>\'"$@])""").search diff --git a/lib/galaxy/tool_util/deps/mulled/get_tests.py b/lib/galaxy/tool_util/deps/mulled/get_tests.py index b533733ed562..f2d05daf8b2a 100644 --- a/lib/galaxy/tool_util/deps/mulled/get_tests.py +++ b/lib/galaxy/tool_util/deps/mulled/get_tests.py @@ -17,8 +17,8 @@ from jinja2 import Template from jinja2.exceptions import UndefinedError except ImportError: - Template = None # type: ignore - UndefinedError = Exception # type: ignore + Template = None # type: ignore[assignment,misc] + UndefinedError = Exception # type: ignore[assignment,misc] from .util import ( get_file_from_recipe_url, diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_search.py b/lib/galaxy/tool_util/deps/mulled/mulled_search.py index 822d939edfa7..dd9606d600ec 100755 --- a/lib/galaxy/tool_util/deps/mulled/mulled_search.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_search.py @@ -18,7 +18,7 @@ try: from conda.cli.python_api import run_command except ImportError: - run_command = None # type: ignore + run_command = None try: from whoosh.fields import Schema @@ -27,7 +27,7 @@ from whoosh.index import create_in from whoosh.qparser import QueryParser except ImportError: - Schema = TEXT = STORED = create_in = QueryParser = None # type: ignore + Schema = TEXT = STORED = create_in = QueryParser = None QUAY_API_URL = 'https://quay.io/api/v1/repository' diff --git a/lib/galaxy/tools/wrappers.py b/lib/galaxy/tools/wrappers.py index 80a575249ef9..cb9c0297938e 100644 --- a/lib/galaxy/tools/wrappers.py +++ b/lib/galaxy/tools/wrappers.py @@ -332,7 +332,7 @@ def __init__( if not dataset: try: # TODO: allow this to work when working with grouping - ext = tool.inputs[name].extensions[0] # type: ignore + ext = tool.inputs[name].extensions[0] # type: ignore[union-attr] except Exception: ext = "data" self.dataset = cast( diff --git a/lib/galaxy/util/__init__.py b/lib/galaxy/util/__init__.py index 021da524f8ea..2c5e39c08c2b 100644 --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -42,7 +42,7 @@ import grp except ImportError: # For Pulsar on Windows (which does not use the function that uses grp) - grp = None # type: ignore + grp = None # type: ignore[assignment] from boltons.iterutils import ( default_enter, remap, @@ -52,7 +52,7 @@ from lxml import etree except ImportError: LXML_AVAILABLE = False - import xml.etree.ElementTree as etree # type: ignore + import xml.etree.ElementTree as etree # type: ignore[assignment,no-redef] from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry @@ -60,8 +60,8 @@ import docutils.core as docutils_core import docutils.writers.html4css1 as docutils_html4css1 except ImportError: - docutils_core = None # type: ignore - docutils_html4css1 = None # type: ignore + docutils_core = None # type: ignore[assignment] + docutils_html4css1 = None # type: ignore[assignment] try: import uwsgi @@ -1542,8 +1542,8 @@ def safe_str_cmp(a, b): # Don't use these two directly, prefer method version that "works" with packaged Galaxy. -galaxy_root_path = os.path.join(__path__[0], os.pardir, os.pardir, os.pardir) # type: ignore -galaxy_samples_path = os.path.join(__path__[0], os.pardir, 'config', 'sample') # type: ignore +galaxy_root_path = os.path.join(__path__[0], os.pardir, os.pardir, os.pardir) # type: ignore[name-defined] +galaxy_samples_path = os.path.join(__path__[0], os.pardir, 'config', 'sample') # type: ignore[name-defined] def galaxy_directory(): diff --git a/lib/galaxy/util/path/__init__.py b/lib/galaxy/util/path/__init__.py index 94e3eb74bbc9..5d8b4bffbaa1 100644 --- a/lib/galaxy/util/path/__init__.py +++ b/lib/galaxy/util/path/__init__.py @@ -9,7 +9,7 @@ try: from grp import getgrgid except ImportError: - getgrgid = None # type: ignore + getgrgid = None # type: ignore[assignment] from itertools import starmap from operator import getitem from os import ( @@ -36,7 +36,7 @@ try: from pwd import getpwuid except ImportError: - getpwuid = None # type: ignore + getpwuid = None # type: ignore[assignment] import galaxy.util diff --git a/lib/galaxy/util/yaml_util.py b/lib/galaxy/util/yaml_util.py index 3a6fa8039fdf..3427a70fd16f 100644 --- a/lib/galaxy/util/yaml_util.py +++ b/lib/galaxy/util/yaml_util.py @@ -6,7 +6,7 @@ try: from yaml import CSafeLoader as SafeLoader except ImportError: - from yaml import SafeLoader # type: ignore + from yaml import SafeLoader # type: ignore[misc] from yaml.constructor import ConstructorError diff --git a/lib/galaxy/visualization/data_providers/genome.py b/lib/galaxy/visualization/data_providers/genome.py index cd6f5d622bae..5647443d2770 100644 --- a/lib/galaxy/visualization/data_providers/genome.py +++ b/lib/galaxy/visualization/data_providers/genome.py @@ -234,7 +234,7 @@ def get_filters(self): """ # Get column names. try: - column_names = self.original_dataset.datatype.column_names # type: ignore + column_names = self.original_dataset.datatype.column_names # type: ignore[attr-defined] except AttributeError: try: column_names = list(range(self.original_dataset.metadata.columns)) diff --git a/lib/galaxy/web/buildapp.py b/lib/galaxy/web/buildapp.py index cab2610058a8..2641c01dde7f 100644 --- a/lib/galaxy/web/buildapp.py +++ b/lib/galaxy/web/buildapp.py @@ -5,6 +5,6 @@ except ImportError: # when installed as a library, galaxy-web-apps may not be available - this # is fine - we shouldn't be using this entry point anyway. - app_factory = None # type: ignore + app_factory = None # type: ignore[misc, assignment] __all__ = ('app_factory', ) diff --git a/lib/galaxy/web_stack/__init__.py b/lib/galaxy/web_stack/__init__.py index 3008347efc5d..01d30f1e8a7c 100644 --- a/lib/galaxy/web_stack/__init__.py +++ b/lib/galaxy/web_stack/__init__.py @@ -1,5 +1,4 @@ -"""Web application stack operations -""" +"""Web application stack operations.""" import inspect import json diff --git a/lib/galaxy/web_stack/message.py b/lib/galaxy/web_stack/message.py index f57a6d40229e..1e1266bd9274 100644 --- a/lib/galaxy/web_stack/message.py +++ b/lib/galaxy/web_stack/message.py @@ -1,5 +1,4 @@ -"""Web Application Stack worker messaging -""" +"""Web Application Stack worker messaging.""" import json import logging @@ -47,12 +46,11 @@ def dispatch(self, msg_str): class ApplicationStackMessage(dict): - target: Optional[str] = None # type: ignore default_handler = None _validate_kwargs = ('target',) def __init__(self, target=None, **kwargs): - self['target'] = target or self.__class__.target + self['target'] = target self._merge_class_tuples() def _merge_class_tuples(self): @@ -95,11 +93,11 @@ def bind_default_handler(self, obj, name): log.debug("Bound default message handler '%s.%s' to %s", self.__class__.__name__, self.default_handler.__name__, getattr(obj, name)) - @property # type: ignore - def target(self): + @property + def target(self) -> Optional[str]: return self['target'] - @target.setter # type: ignore + @target.setter # type: ignore[attr-defined] def set_target(self, target): self['target'] = target diff --git a/lib/galaxy/webapps/galaxy/api/__init__.py b/lib/galaxy/webapps/galaxy/api/__init__.py index 2b0fc04dc847..60fedadd3427 100644 --- a/lib/galaxy/webapps/galaxy/api/__init__.py +++ b/lib/galaxy/webapps/galaxy/api/__init__.py @@ -269,8 +269,8 @@ async def _as_form(**data): sig = inspect.signature(_as_form) sig = sig.replace(parameters=new_params) - _as_form.__signature__ = sig # type: ignore - cls.as_form = _as_form # type: ignore + _as_form.__signature__ = sig # type: ignore[attr-defined] + cls.as_form = _as_form # type: ignore[attr-defined] return cls diff --git a/lib/galaxy/webapps/galaxy/api/tours.py b/lib/galaxy/webapps/galaxy/api/tours.py index 7234012aae7d..d1cc0c1afd48 100644 --- a/lib/galaxy/webapps/galaxy/api/tours.py +++ b/lib/galaxy/webapps/galaxy/api/tours.py @@ -28,7 +28,7 @@ @router.cbv class FastAPITours: # ugh - mypy https://github.com/python/mypy/issues/5374 - registry: ToursRegistry = depends(ToursRegistry) # type: ignore + registry: ToursRegistry = depends(ToursRegistry) # type: ignore[misc] @router.get('/api/tours') def index(self) -> TourList: @@ -47,7 +47,7 @@ def update_tour(self, tour_id: str) -> TourDetails: class ToursController(BaseGalaxyAPIController): - registry: ToursRegistry = depends(ToursRegistry) # type: ignore + registry: ToursRegistry = depends(ToursRegistry) # type: ignore[misc] @expose_api_anonymous_and_sessionless def index(self, trans, **kwd): diff --git a/lib/galaxy/webapps/galaxy/api/webhooks.py b/lib/galaxy/webapps/galaxy/api/webhooks.py index 1761777500d1..27d28c8d0f04 100644 --- a/lib/galaxy/webapps/galaxy/api/webhooks.py +++ b/lib/galaxy/webapps/galaxy/api/webhooks.py @@ -45,7 +45,7 @@ def webhook_data(self, trans: Any, webhook_id, **kwd): ) if webhook and webhook.helper != '': - return imp.load_source(webhook.path, webhook.helper).main( # type: ignore + return imp.load_source(webhook.path, webhook.helper).main( # type: ignore[attr-defined] trans, webhook, params, ) else: diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index c6ce74207a96..8e1185c6c2ab 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -1730,8 +1730,9 @@ def callback(input, prefixed_name, **kwargs): # Pull out dataset instance (=HDA) from element and set a temporary element_identifier attribute # See https://github.com/galaxyproject/galaxy/pull/1693 for context. replacement = dataset_instance - if hasattr(iteration_elements[prefixed_name], 'element_identifier') and iteration_elements[prefixed_name].element_identifier: - replacement.element_identifier = iteration_elements[prefixed_name].element_identifier # type: ignore + temp = iteration_elements[prefixed_name] + if hasattr(temp, 'element_identifier') and temp.element_identifier: + replacement.element_identifier = temp.element_identifier # type: ignore[attr-defined] else: # If collection - just use element model object. replacement = iteration_elements[prefixed_name] diff --git a/lib/galaxy/workflow/refactor/execute.py b/lib/galaxy/workflow/refactor/execute.py index 3a6a76a99ea1..aebf7851ac59 100644 --- a/lib/galaxy/workflow/refactor/execute.py +++ b/lib/galaxy/workflow/refactor/execute.py @@ -396,11 +396,11 @@ def _apply_upgrade_tool(self, action: UpgradeToolAction, execution: RefactorActi def _apply_upgrade_all_steps(self, action: UpgradeAllStepsAction, execution: RefactorActionExecution): for step_order_index, step in self._as_dict["steps"].items(): if step.get('type') == 'subworkflow': - step_action = UpgradeSubworkflowAction(action_type='upgrade_subworkflow', step={'order_index': step_order_index}) - self._apply_upgrade_subworkflow(step_action, execution) + step_action_s = UpgradeSubworkflowAction(action_type='upgrade_subworkflow', step={'order_index': step_order_index}) + self._apply_upgrade_subworkflow(step_action_s, execution) elif step.get('type') == 'tool': - step_action = UpgradeToolAction(action_type='upgrade_tool', step={'order_index': step_order_index}) # type: ignore - self._apply_upgrade_tool(step_action, execution) # type: ignore + step_action_t = UpgradeToolAction(action_type='upgrade_tool', step={'order_index': step_order_index}) + self._apply_upgrade_tool(step_action_t, execution) def _find_step(self, step_reference: step_reference_union): order_index = None diff --git a/lib/galaxy/workflow/refactor/schema.py b/lib/galaxy/workflow/refactor/schema.py index a4ca1800242f..544eccc828bb 100644 --- a/lib/galaxy/workflow/refactor/schema.py +++ b/lib/galaxy/workflow/refactor/schema.py @@ -240,7 +240,7 @@ class UpgradeAllStepsAction(BaseAction): ACTION_CLASSES_BY_TYPE = {} -for action_class in union_action_classes.__args__: # type: ignore +for action_class in union_action_classes.__args__: # type: ignore[attr-defined] action_type_def = action_class.schema()["properties"]["action_type"] try: # pydantic 1.8 diff --git a/lib/galaxy_ext/expressions/handle_job.py b/lib/galaxy_ext/expressions/handle_job.py index e84c454d170d..0001520bb01b 100644 --- a/lib/galaxy_ext/expressions/handle_job.py +++ b/lib/galaxy_ext/expressions/handle_job.py @@ -16,7 +16,7 @@ try: from cwltool import expression except ImportError: - expression = None # type: ignore + expression = None from galaxy.tools.expressions import evaluate diff --git a/lib/galaxy_test/api/_framework.py b/lib/galaxy_test/api/_framework.py index a6b1ea0c3d4d..cb4db22ecc28 100644 --- a/lib/galaxy_test/api/_framework.py +++ b/lib/galaxy_test/api/_framework.py @@ -8,7 +8,7 @@ except ImportError: # Galaxy libraries and galaxy test driver not available, just assume we're # targetting a remote Galaxy. - GalaxyTestDriver = None # type: ignore + GalaxyTestDriver = None # type: ignore[misc,assignment] class ApiTestCase(FunctionalTestCase, UsesApiTestCaseMixin, TestCase): diff --git a/lib/galaxy_test/selenium/framework.py b/lib/galaxy_test/selenium/framework.py index ec525d596d29..edbbc95000eb 100644 --- a/lib/galaxy_test/selenium/framework.py +++ b/lib/galaxy_test/selenium/framework.py @@ -38,7 +38,7 @@ try: from galaxy_test.driver.driver_util import GalaxyTestDriver except ImportError: - GalaxyTestDriver = None # type: ignore + GalaxyTestDriver = None # type: ignore[misc,assignment] DEFAULT_TIMEOUT_MULTIPLIER = 1 DEFAULT_TEST_ERRORS_DIRECTORY = os.path.abspath("database/test_errors") diff --git a/lib/tool_shed/webapp/model/__init__.py b/lib/tool_shed/webapp/model/__init__.py index 13287839fafd..9136d3097d7b 100644 --- a/lib/tool_shed/webapp/model/__init__.py +++ b/lib/tool_shed/webapp/model/__init__.py @@ -93,16 +93,16 @@ class User(Base, Dictifiable, _HasTable): deleted = Column(Boolean, index=True, default=False) purged = Column(Boolean, index=True, default=False) active_repositories = relationship('Repository', - primaryjoin=(lambda: (Repository.user_id == User.id) & (not_(Repository.deleted))), # type: ignore + primaryjoin=(lambda: (Repository.user_id == User.id) & (not_(Repository.deleted))), # type: ignore[has-type] back_populates='user', - order_by=lambda: desc(Repository.name)) # type: ignore + order_by=lambda: desc(Repository.name)) # type: ignore[has-type] galaxy_sessions = relationship('GalaxySession', back_populates='user', - order_by=lambda: desc(GalaxySession.update_time)) # type: ignore + order_by=lambda: desc(GalaxySession.update_time)) # type: ignore[has-type] api_keys = relationship( 'APIKeys', back_populates='user', - order_by=lambda: desc(APIKeys.create_time)) # type: ignore + order_by=lambda: desc(APIKeys.create_time)) reset_tokens = relationship('PasswordResetToken', back_populates='user') groups = relationship('UserGroupAssociation', back_populates='user') @@ -114,9 +114,9 @@ class User(Base, Dictifiable, _HasTable): 'UserRoleAssociation', viewonly=True, primaryjoin=(lambda: - (User.id == UserRoleAssociation.user_id) # type: ignore - & (UserRoleAssociation.role_id == Role.id) # type: ignore - & not_(Role.name == User.email)) # type: ignore + (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] ) repository_reviews = relationship('RepositoryReview', back_populates='user') @@ -343,14 +343,14 @@ class Repository(Base, Dictifiable, _HasTable): deprecated = Column(Boolean, default=False) categories = relationship('RepositoryCategoryAssociation', back_populates='repository') ratings = relationship('RepositoryRatingAssociation', - order_by=lambda: desc(RepositoryRatingAssociation.update_time), back_populates='repository') # type: ignore + order_by=lambda: desc(RepositoryRatingAssociation.update_time), back_populates='repository') user = relationship('User', back_populates='active_repositories') downloadable_revisions = relationship('RepositoryMetadata', - primaryjoin=lambda: (Repository.id == RepositoryMetadata.repository_id) & (RepositoryMetadata.downloadable == true()), # type: ignore + primaryjoin=lambda: (Repository.id == RepositoryMetadata.repository_id) & (RepositoryMetadata.downloadable == true()), # type: ignore[attr-defined,has-type] viewonly=True, - order_by=lambda: desc(RepositoryMetadata.update_time)) # type: ignore + order_by=lambda: desc(RepositoryMetadata.update_time)) # type: ignore[attr-defined] metadata_revisions = relationship('RepositoryMetadata', - order_by=lambda: desc(RepositoryMetadata.update_time), # type: ignore + order_by=lambda: desc(RepositoryMetadata.update_time), # type: ignore[attr-defined] back_populates='repository') roles = relationship('RepositoryRoleAssociation', back_populates='repository') reviews = relationship('RepositoryReview', back_populates='repository') @@ -520,22 +520,22 @@ class RepositoryReview(Base, Dictifiable, _HasTable): # reset on a repository! repository_metadata = relationship('RepositoryMetadata', viewonly=True, - foreign_keys=lambda: [RepositoryReview.repository_id, RepositoryReview.changeset_revision], # type: ignore - primaryjoin=lambda: ((RepositoryReview.repository_id == RepositoryMetadata.repository_id) # type: ignore - & (RepositoryReview.changeset_revision == RepositoryMetadata.changeset_revision)), # type: ignore + foreign_keys=lambda: [RepositoryReview.repository_id, RepositoryReview.changeset_revision], + primaryjoin=lambda: ((RepositoryReview.repository_id == RepositoryMetadata.repository_id) # type: ignore[has-type] + & (RepositoryReview.changeset_revision == RepositoryMetadata.changeset_revision)), # type: ignore[has-type] back_populates='reviews') user = relationship('User', back_populates='repository_reviews') component_reviews = relationship('ComponentReview', viewonly=True, - primaryjoin=lambda: ((RepositoryReview.id == ComponentReview.repository_review_id) # type: ignore - & (ComponentReview.deleted == false())), # type: ignore + primaryjoin=lambda: ((RepositoryReview.id == ComponentReview.repository_review_id) # type: ignore[has-type] + & (ComponentReview.deleted == false())), # type: ignore[has-type] back_populates='repository_review') private_component_reviews = relationship('ComponentReview', viewonly=True, - primaryjoin=lambda: ((RepositoryReview.id == ComponentReview.repository_review_id) # type: ignore - & (ComponentReview.deleted == false()) & (ComponentReview.private == true()))) # type: ignore + primaryjoin=lambda: ((RepositoryReview.id == ComponentReview.repository_review_id) # type: ignore[has-type] + & (ComponentReview.deleted == false()) & (ComponentReview.private == true()))) # type: ignore[has-type] dict_collection_visible_keys = ['id', 'repository_id', 'changeset_revision', 'user_id', 'rating', 'deleted'] dict_element_visible_keys = ['id', 'repository_id', 'changeset_revision', 'user_id', 'rating', 'deleted'] @@ -735,9 +735,9 @@ def repository_dependencies(self): repository=relationship(Repository, back_populates='metadata_revisions'), reviews=relationship(RepositoryReview, viewonly=True, - foreign_keys=lambda: [RepositoryReview.repository_id, RepositoryReview.changeset_revision], # type: ignore - primaryjoin=lambda: ((RepositoryReview.repository_id == RepositoryMetadata.repository_id) # type: ignore - & (RepositoryReview.changeset_revision == RepositoryMetadata.changeset_revision)), # type: ignore + foreign_keys=lambda: [RepositoryReview.repository_id, RepositoryReview.changeset_revision], + primaryjoin=lambda: ((RepositoryReview.repository_id == RepositoryMetadata.repository_id) + & (RepositoryReview.changeset_revision == RepositoryMetadata.changeset_revision)), back_populates='repository_metadata'))) diff --git a/packages/app/galaxy/__init__.py b/packages/app/galaxy/__init__.py index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/app/galaxy/__init__.py +++ b/packages/app/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__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 index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/auth/galaxy/__init__.py +++ b/packages/auth/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/containers/galaxy/__init__.py b/packages/containers/galaxy/__init__.py index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/containers/galaxy/__init__.py +++ b/packages/containers/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__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 index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/data/galaxy/__init__.py +++ b/packages/data/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__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 index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/files/galaxy/__init__.py +++ b/packages/files/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__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 index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/job_execution/galaxy/__init__.py +++ b/packages/job_execution/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__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 index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/job_metrics/galaxy/__init__.py +++ b/packages/job_metrics/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__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 index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/objectstore/galaxy/__init__.py +++ b/packages/objectstore/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__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 index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/tool_util/galaxy/__init__.py +++ b/packages/tool_util/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__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 index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/util/galaxy/__init__.py +++ b/packages/util/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__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 index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/web_framework/galaxy/__init__.py +++ b/packages/web_framework/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__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 index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/web_stack/galaxy/__init__.py +++ b/packages/web_stack/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/packages/webapps/galaxy/__init__.py b/packages/webapps/galaxy/__init__.py index 0d1f7edf5dc6..8e13dacd2533 100644 --- a/packages/webapps/galaxy/__init__.py +++ b/packages/webapps/galaxy/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type] diff --git a/setup.cfg b/setup.cfg index a5d24363d301..1f05ca9e99b1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,6 +21,7 @@ show_error_codes = True ignore_missing_imports = True check_untyped_defs = True exclude = lib/galaxy/tools/bundled|test/functional +pretty = True [mypy-galaxy.util.oset] # lots of tricky code in here... diff --git a/test/unit/data/model/mapping/common.py b/test/unit/data/model/mapping/common.py index 8b3709df8821..b941e493bd72 100644 --- a/test/unit/data/model/mapping/common.py +++ b/test/unit/data/model/mapping/common.py @@ -122,10 +122,10 @@ def collection_consists_of_objects(collection, *objects): # Sort, then compare each member by its 'id' attribute, which must be its primary key. collection.sort(key=lambda item: item.id) - objects = list(objects) # type: ignore - objects.sort(key=lambda item: item.id) # type: ignore + objects_l = list(objects) + objects_l.sort(key=lambda item: item.id) - for item1, item2 in zip(collection, objects): + for item1, item2 in zip(collection, objects_l): if item1.id is None or item2.id is None or item1.id != item2.id: return False return True diff --git a/test/unit/data/model/test_model_store.py b/test/unit/data/model/test_model_store.py index 048e54f2abb1..9d52bae99e81 100644 --- a/test/unit/data/model/test_model_store.py +++ b/test/unit/data/model/test_model_store.py @@ -494,7 +494,7 @@ def _mock_app(store_by="id"): app = GalaxyDataTestApp() test_object_store_config = TestConfig(store_by=store_by) app.object_store = test_object_store_config.object_store - app.model.Dataset.object_store = app.object_store # type: ignore + app.model.Dataset.object_store = app.object_store return app diff --git a/test/unit/webapps/test_request_scoped_sqlalchemy_sessions.py b/test/unit/webapps/test_request_scoped_sqlalchemy_sessions.py index 509ddd030c43..b1632d192fc7 100644 --- a/test/unit/webapps/test_request_scoped_sqlalchemy_sessions.py +++ b/test/unit/webapps/test_request_scoped_sqlalchemy_sessions.py @@ -1,6 +1,7 @@ import asyncio import concurrent.futures import functools +import sys import threading import time import uuid @@ -148,8 +149,10 @@ async def test_request_scoped_sa_session_concurrent_requests_async(): @pytest.mark.asyncio async def test_request_scoped_sa_session_concurrent_requests_and_background_thread(): add_request_id_middleware(app) - # TODO: remove the following type ignore statement after dropping Python 3.6 support. - loop = asyncio.get_running_loop() # type: ignore + if sys.version_info > (3, 6): + loop = asyncio.get_running_loop() + else: + loop = asyncio.get_event_loop() target = functools.partial(assert_scoped_session_is_thread_local, GX_APP) with concurrent.futures.ThreadPoolExecutor() as pool: background_pool = loop.run_in_executor(pool, target) diff --git a/test/unit/webapps/test_webapp_base.py b/test/unit/webapps/test_webapp_base.py index cba03fe2b1fd..f799157e329e 100644 --- a/test/unit/webapps/test_webapp_base.py +++ b/test/unit/webapps/test_webapp_base.py @@ -3,6 +3,7 @@ """ import logging import re +import sys import unittest import galaxy.config @@ -59,12 +60,10 @@ def test_parse_allowed_origin_hostnames(self): hostnames = config._parse_allowed_origin_hostnames({ "allowed_origin_hostnames": r"/host\d{2}/,geocities.com,miskatonic.edu" }) - # TODO: remove the following type ignore statement after dropping Python 3.6 support. - # re._pattern_type has been changed to re.Pattern in python 3.7 - try: - Pattern = re.Pattern # type: ignore - except AttributeError: - Pattern = re._pattern_type # type: ignore + if sys.version_info >= (3, 7): + Pattern = re.Pattern + else: + Pattern = re._pattern_type self.assertTrue(isinstance(hostnames[0], Pattern)) self.assertTrue(isinstance(hostnames[1], str)) self.assertTrue(isinstance(hostnames[2], str)) diff --git a/tools/interactive/isee/render.py b/tools/interactive/isee/render.py index c75668be85fa..334436353e86 100644 --- a/tools/interactive/isee/render.py +++ b/tools/interactive/isee/render.py @@ -38,7 +38,7 @@ def render_plots(call, plots): def get_render_func(plot): """Return the appropriate function to render plot.""" # This is probably broken and unused - return OPTIONS['plots'][plot['plot_types']['plot_type'].value] # type: ignore + return OPTIONS['plots'][plot['plot_types']['plot_type'].value] # type: ignore[index] def reduced_dimension_plot(pw="6L"): diff --git a/tools/next_gen_conversion/solid2fastq.py b/tools/next_gen_conversion/solid2fastq.py index 67e8b605c590..a78ccdbfc3c9 100644 --- a/tools/next_gen_conversion/solid2fastq.py +++ b/tools/next_gen_conversion/solid2fastq.py @@ -8,7 +8,7 @@ try: maketrans = str.maketrans except AttributeError: - from string import maketrans # type: ignore + from string import maketrans # type: ignore[attr-defined,no-redef] def stop_err(msg): diff --git a/tox.ini b/tox.ini index cd9fd34a59ad..3a403876a57f 100644 --- a/tox.ini +++ b/tox.ini @@ -19,6 +19,7 @@ passenv = CI CONDA_EXE GALAXY_CONFIG_OVERRIDE_DATABASE_CONNECTION APP_WEBSERVER + TERM setenv = first_startup: GALAXY_PYTHON=python first_startup: GALAXY_CONFIG_DATABASE_AUTO_MIGRATE=true