tighten type ignores

This commit is contained in:
Michael R. Crusoe
2021-11-22 19:52:55 +01:00
parent 6a1168d6df
commit 7819fdc7a6
56 changed files with 265 additions and 263 deletions
+1 -1
View File
@@ -3,4 +3,4 @@ Galaxy root package -- this is a namespace package.
"""
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__) # type: ignore
__path__ = extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -291,7 +291,7 @@ class UniverseApplication(StructuredApp, GalaxyManagerApplication):
# 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.
+1 -1
View File
@@ -8,7 +8,7 @@ from argparse import ArgumentParser
try:
import pip
except ImportError:
pip = None # type: ignore
pip = None # type: ignore[assignment]
CONFIGURE_URL = "https://docs.galaxyproject.org/en/master/admin/"
+3 -3
View File
@@ -13,13 +13,13 @@ from typing import Any, Dict, Optional, Type
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 (
@@ -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 @@ class Ply:
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 @@ class PlyAscii(Ply, data.Text):
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 @@ class Vtk:
# 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 @@ class Vtk:
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 @@ class VtkAscii(Vtk, data.Text):
data.Text.__init__(self, **kwd)
class VtkBinary(Vtk, Binary):
class VtkBinary(Vtk, Binary): # type: ignore[misc]
file_ext = "vtkbinary"
subtype = 'BINARY'
+1 -1
View File
@@ -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
+1 -1
View File
@@ -5,7 +5,7 @@ try:
)
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
)
@@ -13,7 +13,7 @@ try:
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'
+2 -2
View File
@@ -16,8 +16,8 @@ from galaxy.schema.schema import TagCollection
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):
+134 -134
View File
@@ -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 @@ class History(Base, HasTags, Dictifiable, UsesAnnotations, HasName, Serializable
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 @@ class HistoryDatasetAssociation(DatasetInstance, HasTags, Dictifiable, UsesAnnot
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 @@ class HistoryDatasetCollectionAssociation(
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):
"""
+1 -1
View File
@@ -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):
@@ -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']
+1 -1
View File
@@ -17,7 +17,7 @@ try:
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 (
@@ -14,7 +14,7 @@ try:
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):
+19 -19
View File
@@ -20,11 +20,11 @@ try:
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 @@ try:
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 @@ try:
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 @@ try:
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
@@ -17,8 +17,8 @@ try:
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,
@@ -18,7 +18,7 @@ from .util import (
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 @@ try:
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'
+1 -1
View File
@@ -332,7 +332,7 @@ class DatasetFilenameWrapper(ToolParameterValueWrapper):
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(
+6 -6
View File
@@ -42,7 +42,7 @@ try:
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 @@ try:
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 @@ try:
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():
+2 -2
View File
@@ -9,7 +9,7 @@ from functools import partial
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 @@ from pathlib import Path
try:
from pwd import getpwuid
except ImportError:
getpwuid = None # type: ignore
getpwuid = None # type: ignore[assignment]
import galaxy.util
+1 -1
View File
@@ -6,7 +6,7 @@ import yaml
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
@@ -234,7 +234,7 @@ class GenomeDataProvider(BaseDataProvider):
"""
# 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))
+1 -1
View File
@@ -5,6 +5,6 @@ try:
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', )
+1 -2
View File
@@ -1,5 +1,4 @@
"""Web application stack operations
"""
"""Web application stack operations."""
import inspect
import json
+5 -7
View File
@@ -1,5 +1,4 @@
"""Web Application Stack worker messaging
"""
"""Web Application Stack worker messaging."""
import json
import logging
@@ -47,12 +46,11 @@ class ApplicationStackMessageDispatcher:
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 @@ class ApplicationStackMessage(dict):
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
+2 -2
View File
@@ -269,8 +269,8 @@ def as_form(cls: Type[BaseModel]):
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
+2 -2
View File
@@ -28,7 +28,7 @@ router = Router(tags=['tours'])
@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 @@ class FastAPITours:
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):
+1 -1
View File
@@ -45,7 +45,7 @@ class WebhooksController(BaseGalaxyAPIController):
)
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:
+3 -2
View File
@@ -1730,8 +1730,9 @@ class ToolModule(WorkflowModule):
# 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]
+4 -4
View File
@@ -396,11 +396,11 @@ class WorkflowRefactorExecutor:
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
+1 -1
View File
@@ -240,7 +240,7 @@ union_action_classes = Union[
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
+1 -1
View File
@@ -16,7 +16,7 @@ warnings.filterwarnings("ignore", message=r"[\n.]DEPRECATION: Python 2", module=
try:
from cwltool import expression
except ImportError:
expression = None # type: ignore
expression = None
from galaxy.tools.expressions import evaluate
+1 -1
View File
@@ -8,7 +8,7 @@ try:
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):
+1 -1
View File
@@ -38,7 +38,7 @@ from galaxy_test.base.testcase import FunctionalTestCase
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")
+21 -21
View File
@@ -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 @@ mapper_registry.map_imperatively(RepositoryMetadata, RepositoryMetadata.table, p
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')))
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1 -1
View File
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -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...
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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
@@ -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)
+5 -6
View File
@@ -3,6 +3,7 @@ Unit tests for ``galaxy.web.framework.webapp``
"""
import logging
import re
import sys
import unittest
import galaxy.config
@@ -59,12 +60,10 @@ class GalaxyWebTransaction_Headers_TestCase(unittest.TestCase):
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))
+1 -1
View File
@@ -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"):
+1 -1
View File
@@ -8,7 +8,7 @@ import tempfile
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):
+1
View File
@@ -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