Enable `warn_unused_ignores` mypy option

This commit is contained in:
Nicola Soranzo
2024-04-16 01:12:58 +01:00
parent dcb6f061f6
commit 053ca5198e
68 changed files with 177 additions and 187 deletions
+1 -1
View File
@@ -4,4 +4,4 @@ Galaxy root package -- this is a namespace package.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__) # type: ignore[has-type]
__path__ = extend_path(__path__, __name__)
+1 -1
View File
@@ -687,7 +687,7 @@ class UniverseApplication(StructuredApp, GalaxyManagerApplication):
self.watchers = self._register_singleton(ConfigWatchers)
self._configure_toolbox()
# Load Data Manager
self.data_managers = self._register_singleton(DataManagers) # type: ignore[type-abstract]
self.data_managers = self._register_singleton(DataManagers)
# Load the update repository manager.
self.update_repository_manager = self._register_singleton(
UpdateRepositoryManager, UpdateRepositoryManager(self)
@@ -81,7 +81,7 @@ class BaseToolBoxTestCase(TestCase, UsesTools):
install_model = mapping.init("sqlite:///:memory:", create_tables=True)
self.app.tool_cache = ToolCache()
self.app.install_model = install_model
self.app.reindex_tool_search = self.__reindex # type: ignore[assignment]
self.app.reindex_tool_search = self.__reindex # type: ignore[method-assign]
itp_config = os.path.join(self.test_directory, "integrated_tool_panel.xml")
self.app.config.integrated_tool_panel_config = itp_config
self.app.watchers = ConfigWatchers(self.app)
+1 -1
View File
@@ -35,7 +35,7 @@ from . import IdentityProvider
try:
import pkce
except ImportError:
pkce = None # type: ignore[assignment]
pkce = None # type: ignore[assignment, unused-ignore]
log = logging.getLogger(__name__)
STATE_COOKIE_NAME = "galaxy-oidc-state"
@@ -142,7 +142,7 @@ class Ply:
return f"Ply file ({nice_size(dataset.get_size())})"
class PlyAscii(Ply, data.Text): # type: ignore[misc]
class PlyAscii(Ply, data.Text):
"""
>>> from galaxy.datatypes.sniff import get_test_fname
>>> fname = get_test_fname('test.plyascii')
@@ -160,7 +160,7 @@ class PlyAscii(Ply, data.Text): # type: ignore[misc]
data.Text.__init__(self, **kwd)
class PlyBinary(Ply, Binary): # type: ignore[misc]
class PlyBinary(Ply, Binary):
file_ext = "plybinary"
subtype = "binary"
@@ -477,7 +477,7 @@ class Vtk:
return f"Vtk file ({nice_size(dataset.get_size())})"
class VtkAscii(Vtk, data.Text): # type: ignore[misc]
class VtkAscii(Vtk, data.Text):
"""
>>> from galaxy.datatypes.sniff import get_test_fname
>>> fname = get_test_fname('test.vtkascii')
@@ -495,7 +495,7 @@ class VtkAscii(Vtk, data.Text): # type: ignore[misc]
data.Text.__init__(self, **kwd)
class VtkBinary(Vtk, Binary): # type: ignore[misc]
class VtkBinary(Vtk, Binary):
"""
>>> from galaxy.datatypes.sniff import get_test_fname
>>> fname = get_test_fname('test.vtkbinary')
+3 -3
View File
@@ -521,10 +521,10 @@ class AWSBatchJobRunner(AsynchronousJobRunner):
check_required = []
parsed_params = {}
for k, spec in self.DESTINATION_PARAMS_SPEC.items():
value = params.get(k, spec.get("default")) # type: ignore[attr-defined]
if spec.get("required") and not value: # type: ignore[attr-defined]
value = params.get(k, spec.get("default"))
if spec.get("required") and not value:
check_required.append(k)
mapper = spec.get("map") # type: ignore[attr-defined]
mapper = spec.get("map")
parsed_params[k] = mapper(value) # type: ignore[operator]
if check_required:
raise AWSBatchRunnerException(
+1 -1
View File
@@ -11,7 +11,7 @@ try:
)
except ImportError:
"""Don't make psutil a strict requirement, but use if available."""
Process = None # type: ignore
Process = None
def kill_pid(pid: int, use_psutil: bool = True):
+1 -1
View File
@@ -413,7 +413,7 @@ class HistoryContentsManager(base.SortableManager):
component_class = self.contained_class
stmt = (
select(component_class)
.where(component_class.id.in_(id_list)) # type: ignore[attr-defined]
.where(component_class.id.in_(id_list))
.options(undefer(component_class._metadata))
.options(joinedload(component_class.dataset).joinedload(model.Dataset.actions))
.options(joinedload(component_class.tags)) # type: ignore[attr-defined]
+1 -1
View File
@@ -313,7 +313,7 @@ class UserManager(base.ModelManager, deletable.PurgableManagerMixin):
def by_oidc_access_token(self, access_token: str):
if hasattr(self.app, "authnz_manager") and self.app.authnz_manager:
user = self.app.authnz_manager.match_access_token_to_user(self.app.model.session, access_token) # type: ignore[attr-defined]
user = self.app.authnz_manager.match_access_token_to_user(self.app.model.session, access_token)
return user
else:
return None
+1 -1
View File
@@ -538,7 +538,7 @@ class WorkflowsManager(sharable.SharableModelManager, deletable.DeletableManager
for inv in trans.sa_session.scalars(stmt)
if self.check_security(trans, inv, check_ownership=True, check_accessible=False)
]
return invocations, total_matches # type:ignore[return-value]
return invocations, total_matches
MissingToolsT = List[Tuple[str, str, Optional[str], str]]
+46 -52
View File
@@ -759,12 +759,12 @@ class User(Base, Dictifiable, RepresentById):
back_populates="user", order_by=lambda: desc(History.update_time), cascade_backrefs=False # type: ignore[has-type]
)
active_histories: Mapped[List["History"]] = relationship(
primaryjoin=(lambda: (History.user_id == User.id) & (not_(History.deleted)) & (not_(History.archived))), # type: ignore[has-type]
primaryjoin=(lambda: (History.user_id == User.id) & (not_(History.deleted)) & (not_(History.archived))),
viewonly=True,
order_by=lambda: desc(History.update_time), # type: ignore[has-type]
)
galaxy_sessions: Mapped[List["GalaxySession"]] = relationship(
back_populates="user", order_by=lambda: desc(GalaxySession.update_time), cascade_backrefs=False # type: ignore[has-type]
back_populates="user", order_by=lambda: desc(GalaxySession.update_time), cascade_backrefs=False
)
quotas: Mapped[List["UserQuotaAssociation"]] = relationship(back_populates="user")
quota_source_usages: Mapped[List["UserQuotaSourceUsage"]] = relationship(back_populates="user")
@@ -772,25 +772,23 @@ class User(Base, Dictifiable, RepresentById):
stored_workflow_menu_entries: Mapped[List["StoredWorkflowMenuEntry"]] = relationship(
primaryjoin=(
lambda: (StoredWorkflowMenuEntry.user_id == User.id)
& (StoredWorkflowMenuEntry.stored_workflow_id == StoredWorkflow.id) # type: ignore[has-type]
& not_(StoredWorkflow.deleted) # type: ignore[has-type]
& (StoredWorkflowMenuEntry.stored_workflow_id == StoredWorkflow.id)
& not_(StoredWorkflow.deleted)
),
back_populates="user",
cascade="all, delete-orphan",
collection_class=ordering_list("order_index"),
)
_preferences: Mapped[Dict[str, "UserPreference"]] = relationship(collection_class=attribute_keyed_dict("name"))
values: Mapped[List["FormValues"]] = relationship(
primaryjoin=(lambda: User.form_values_id == FormValues.id) # type: ignore[has-type]
)
values: Mapped[List["FormValues"]] = relationship(primaryjoin=(lambda: User.form_values_id == FormValues.id))
# Add type hint (will this work w/SA?)
api_keys: Mapped[List["APIKeys"]] = relationship(
back_populates="user",
order_by=lambda: desc(APIKeys.create_time),
primaryjoin=(
lambda: and_(
User.id == APIKeys.user_id, # type: ignore[attr-defined]
not_(APIKeys.deleted == true()), # type: ignore[has-type]
User.id == APIKeys.user_id,
not_(APIKeys.deleted == true()),
)
),
)
@@ -798,7 +796,7 @@ class User(Base, Dictifiable, RepresentById):
roles: Mapped[List["UserRoleAssociation"]] = relationship(back_populates="user")
stored_workflows: Mapped[List["StoredWorkflow"]] = relationship(
back_populates="user",
primaryjoin=(lambda: User.id == StoredWorkflow.user_id), # type: ignore[has-type]
primaryjoin=(lambda: User.id == StoredWorkflow.user_id),
cascade_backrefs=False,
)
all_notifications: Mapped[List["UserNotificationAssociation"]] = relationship(
@@ -807,9 +805,9 @@ class User(Base, Dictifiable, RepresentById):
non_private_roles: Mapped[List["UserRoleAssociation"]] = relationship(
viewonly=True,
primaryjoin=(
lambda: (User.id == UserRoleAssociation.user_id) # type: ignore[has-type]
& (UserRoleAssociation.role_id == Role.id) # type: ignore[has-type]
& not_(Role.name == User.email) # type: ignore[has-type]
lambda: (User.id == UserRoleAssociation.user_id)
& (UserRoleAssociation.role_id == Role.id)
& not_(Role.name == User.email)
),
)
@@ -2512,9 +2510,9 @@ class ImplicitlyCreatedDatasetCollectionInput(Base, RepresentById):
input_dataset_collection: Mapped[Optional["HistoryDatasetCollectionAssociation"]] = relationship(
primaryjoin=(
lambda: HistoryDatasetCollectionAssociation.id # type: ignore[has-type]
lambda: HistoryDatasetCollectionAssociation.id
== ImplicitlyCreatedDatasetCollectionInput.input_dataset_collection_id
), # type: ignore[has-type]
),
)
def __init__(self, name, input_dataset_collection):
@@ -2578,7 +2576,7 @@ class PostJobAction(Base, RepresentById):
action_arguments: Mapped[Optional[bytes]] = mapped_column(MutableJSONType)
workflow_step: Mapped[Optional["WorkflowStep"]] = relationship(
back_populates="post_job_actions",
primaryjoin=(lambda: WorkflowStep.id == PostJobAction.workflow_step_id), # type: ignore[has-type]
primaryjoin=(lambda: WorkflowStep.id == PostJobAction.workflow_step_id),
)
def __init__(self, action_type, workflow_step=None, output_name=None, action_arguments=None):
@@ -3073,12 +3071,12 @@ class History(Base, HasTags, Dictifiable, UsesAnnotations, HasName, Serializable
primaryjoin=(
lambda: (
and_(
HistoryDatasetCollectionAssociation.history_id == History.id, # type: ignore[has-type]
not_(HistoryDatasetCollectionAssociation.deleted), # type: ignore[has-type, arg-type]
HistoryDatasetCollectionAssociation.history_id == History.id,
not_(HistoryDatasetCollectionAssociation.deleted), # type: ignore[arg-type]
)
)
),
order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid), # type: ignore[has-type]
order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid),
viewonly=True,
)
visible_datasets: Mapped[List["HistoryDatasetAssociation"]] = relationship(
@@ -3095,12 +3093,12 @@ class History(Base, HasTags, Dictifiable, UsesAnnotations, HasName, Serializable
visible_dataset_collections: Mapped[List["HistoryDatasetCollectionAssociation"]] = relationship(
primaryjoin=(
lambda: and_(
HistoryDatasetCollectionAssociation.history_id == History.id, # type: ignore[has-type]
not_(HistoryDatasetCollectionAssociation.deleted), # type: ignore[has-type, arg-type]
HistoryDatasetCollectionAssociation.visible, # type: ignore[has-type, arg-type]
HistoryDatasetCollectionAssociation.history_id == History.id,
not_(HistoryDatasetCollectionAssociation.deleted), # type: ignore[arg-type]
HistoryDatasetCollectionAssociation.visible, # type: ignore[arg-type]
)
),
order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid), # type: ignore[has-type]
order_by=lambda: asc(HistoryDatasetCollectionAssociation.hid),
viewonly=True,
)
tags: Mapped[List["HistoryTagAssociation"]] = relationship(
@@ -3110,7 +3108,7 @@ class History(Base, HasTags, Dictifiable, UsesAnnotations, HasName, Serializable
order_by=lambda: HistoryAnnotationAssociation.id, back_populates="history"
)
ratings: Mapped[List["HistoryRatingAssociation"]] = relationship(
order_by=lambda: HistoryRatingAssociation.id, # type: ignore[has-type]
order_by=lambda: HistoryRatingAssociation.id,
back_populates="history",
)
default_permissions: Mapped[List["DefaultHistoryPermissions"]] = relationship(back_populates="history")
@@ -4005,7 +4003,7 @@ class Dataset(Base, StorableObject, Serializable):
lambda: and_(
Dataset.id == HistoryDatasetAssociation.dataset_id, # type: ignore[attr-defined]
HistoryDatasetAssociation.deleted == false(), # type: ignore[has-type]
HistoryDatasetAssociation.purged == false(), # type: ignore[attr-defined, arg-type]
HistoryDatasetAssociation.purged == false(), # type: ignore[arg-type]
)
),
viewonly=True,
@@ -4014,7 +4012,7 @@ class Dataset(Base, StorableObject, Serializable):
primaryjoin=(
lambda: and_(
Dataset.id == HistoryDatasetAssociation.dataset_id, # type: ignore[attr-defined]
HistoryDatasetAssociation.purged == true(), # type: ignore[attr-defined, arg-type]
HistoryDatasetAssociation.purged == true(), # type: ignore[arg-type]
)
),
viewonly=True,
@@ -6113,7 +6111,7 @@ class LibraryInfoAssociation(Base, RepresentById):
primaryjoin=lambda: LibraryInfoAssociation.form_definition_id == FormDefinition.id
)
info: Mapped[Optional["FormValues"]] = relationship(
primaryjoin=lambda: LibraryInfoAssociation.form_values_id == FormValues.id # type: ignore[has-type]
primaryjoin=lambda: LibraryInfoAssociation.form_values_id == FormValues.id
)
def __init__(self, library, form_definition, info, inheritable=False):
@@ -6143,7 +6141,7 @@ class LibraryFolderInfoAssociation(Base, RepresentById):
primaryjoin=(lambda: LibraryFolderInfoAssociation.form_definition_id == FormDefinition.id)
)
info: Mapped[Optional["FormValues"]] = relationship(
primaryjoin=(lambda: LibraryFolderInfoAssociation.form_values_id == FormValues.id) # type: ignore[has-type]
primaryjoin=(lambda: LibraryFolderInfoAssociation.form_values_id == FormValues.id)
)
def __init__(self, folder, form_definition, info, inheritable=False):
@@ -6177,7 +6175,7 @@ class LibraryDatasetDatasetInfoAssociation(Base, RepresentById):
primaryjoin=(lambda: LibraryDatasetDatasetInfoAssociation.form_definition_id == FormDefinition.id),
)
info: Mapped[Optional["FormValues"]] = relationship(
primaryjoin=(lambda: LibraryDatasetDatasetInfoAssociation.form_values_id == FormValues.id) # type: ignore[has-type]
primaryjoin=(lambda: LibraryDatasetDatasetInfoAssociation.form_values_id == FormValues.id)
)
def __init__(self, library_dataset_dataset_association, form_definition, info):
@@ -6311,9 +6309,9 @@ class DatasetCollection(Base, Dictifiable, UsesAnnotations, Serializable):
update_time: Mapped[datetime] = mapped_column(default=now, onupdate=now, nullable=True)
elements: Mapped[List["DatasetCollectionElement"]] = relationship(
primaryjoin=(lambda: DatasetCollection.id == DatasetCollectionElement.dataset_collection_id), # type: ignore[has-type]
primaryjoin=(lambda: DatasetCollection.id == DatasetCollectionElement.dataset_collection_id),
back_populates="collection",
order_by=lambda: DatasetCollectionElement.element_index, # type: ignore[has-type]
order_by=lambda: DatasetCollectionElement.element_index,
)
dict_collection_visible_keys = ["id", "collection_type"]
@@ -6811,7 +6809,7 @@ class HistoryDatasetCollectionAssociation(
back_populates="history_dataset_collection",
)
ratings: Mapped[List["HistoryDatasetCollectionRatingAssociation"]] = relationship(
order_by=lambda: HistoryDatasetCollectionRatingAssociation.id, # type: ignore[has-type]
order_by=lambda: HistoryDatasetCollectionRatingAssociation.id,
back_populates="dataset_collection",
)
creating_job_associations: Mapped[List["JobToOutputDatasetCollectionAssociation"]] = relationship(viewonly=True)
@@ -7166,7 +7164,7 @@ class LibraryDatasetCollectionAssociation(Base, DatasetCollectionInstance, Repre
back_populates="dataset_collection",
)
ratings: Mapped[List["LibraryDatasetCollectionRatingAssociation"]] = relationship(
order_by=lambda: LibraryDatasetCollectionRatingAssociation.id, # type: ignore[has-type]
order_by=lambda: LibraryDatasetCollectionRatingAssociation.id,
back_populates="dataset_collection",
)
@@ -7489,14 +7487,14 @@ class StoredWorkflow(Base, HasTags, Dictifiable, RepresentById):
workflows: Mapped[List["Workflow"]] = relationship(
back_populates="stored_workflow",
cascade="all, delete-orphan",
primaryjoin=(lambda: StoredWorkflow.id == Workflow.stored_workflow_id), # type: ignore[has-type]
order_by=lambda: -Workflow.id, # type: ignore[has-type]
primaryjoin=(lambda: StoredWorkflow.id == Workflow.stored_workflow_id),
order_by=lambda: -Workflow.id,
cascade_backrefs=False,
)
latest_workflow = relationship(
"Workflow",
post_update=True,
primaryjoin=(lambda: StoredWorkflow.latest_workflow_id == Workflow.id), # type: ignore[has-type]
primaryjoin=(lambda: StoredWorkflow.latest_workflow_id == Workflow.id),
lazy=False,
)
tags: Mapped[List["StoredWorkflowTagAssociation"]] = relationship(
@@ -7518,7 +7516,7 @@ class StoredWorkflow(Base, HasTags, Dictifiable, RepresentById):
back_populates="stored_workflow",
)
ratings: Mapped[List["StoredWorkflowRatingAssociation"]] = relationship(
order_by=lambda: StoredWorkflowRatingAssociation.id, # type: ignore[has-type]
order_by=lambda: StoredWorkflowRatingAssociation.id,
back_populates="stored_workflow",
)
users_shared_with: Mapped[List["StoredWorkflowUserShareAssociation"]] = relationship(
@@ -7657,20 +7655,20 @@ class Workflow(Base, Dictifiable, RepresentById):
steps = relationship(
"WorkflowStep",
back_populates="workflow",
primaryjoin=(lambda: Workflow.id == WorkflowStep.workflow_id), # type: ignore[has-type]
order_by=lambda: asc(WorkflowStep.order_index), # type: ignore[has-type]
primaryjoin=(lambda: Workflow.id == WorkflowStep.workflow_id),
order_by=lambda: asc(WorkflowStep.order_index),
cascade="all, delete-orphan",
lazy=False,
)
comments: Mapped[List["WorkflowComment"]] = relationship(
back_populates="workflow",
primaryjoin=(lambda: Workflow.id == WorkflowComment.workflow_id), # type: ignore[has-type]
primaryjoin=(lambda: Workflow.id == WorkflowComment.workflow_id),
cascade="all, delete-orphan",
lazy=False,
)
parent_workflow_steps = relationship(
"WorkflowStep",
primaryjoin=(lambda: Workflow.id == WorkflowStep.subworkflow_id), # type: ignore[has-type]
primaryjoin=(lambda: Workflow.id == WorkflowStep.subworkflow_id),
back_populates="subworkflow",
cascade_backrefs=False,
)
@@ -9064,8 +9062,6 @@ class WorkflowInvocationStep(Base, Dictifiable, Serializable):
select(WorkflowStep.order_index).where(WorkflowStep.id == workflow_step_id).scalar_subquery()
)
subworkflow_invocation_id = None
dict_collection_visible_keys = [
"id",
"update_time",
@@ -9607,7 +9603,7 @@ class FormDefinition(Base, Dictifiable, RepresentById):
layout: Mapped[Optional[bytes]] = mapped_column(MutableJSONType)
form_definition_current: Mapped["FormDefinitionCurrent"] = relationship(
back_populates="forms",
primaryjoin=(lambda: FormDefinitionCurrent.id == FormDefinition.form_definition_current_id), # type: ignore[has-type]
primaryjoin=(lambda: FormDefinitionCurrent.id == FormDefinition.form_definition_current_id),
)
# The following form_builder classes are supported by the FormDefinition class.
@@ -10145,12 +10141,12 @@ class Page(Base, HasTags, Dictifiable, RepresentById):
user: Mapped["User"] = relationship()
revisions: Mapped[List["PageRevision"]] = relationship(
cascade="all, delete-orphan",
primaryjoin=(lambda: Page.id == PageRevision.page_id), # type: ignore[has-type]
primaryjoin=(lambda: Page.id == PageRevision.page_id),
back_populates="page",
)
latest_revision: Mapped[Optional["PageRevision"]] = relationship(
post_update=True,
primaryjoin=(lambda: Page.latest_revision_id == PageRevision.id), # type: ignore[has-type]
primaryjoin=(lambda: Page.latest_revision_id == PageRevision.id),
lazy=False,
)
tags: Mapped[List["PageTagAssociation"]] = relationship(
@@ -10160,13 +10156,11 @@ class Page(Base, HasTags, Dictifiable, RepresentById):
order_by=lambda: PageAnnotationAssociation.id, back_populates="page"
)
ratings: Mapped[List["PageRatingAssociation"]] = relationship(
order_by=lambda: PageRatingAssociation.id, # type: ignore[has-type]
order_by=lambda: PageRatingAssociation.id,
back_populates="page",
)
users_shared_with: Mapped[List["PageUserShareAssociation"]] = relationship(back_populates="page")
average_rating = None
# Set up proxy so that
# Page.users_shared_with
# returns a list of users that page is shared with.
@@ -10282,7 +10276,7 @@ class Visualization(Base, HasTags, Dictifiable, RepresentById):
back_populates="visualization",
)
ratings: Mapped[List["VisualizationRatingAssociation"]] = relationship(
order_by=lambda: VisualizationRatingAssociation.id, # type: ignore[has-type]
order_by=lambda: VisualizationRatingAssociation.id,
back_populates="visualization",
)
users_shared_with: Mapped[List["VisualizationUserShareAssociation"]] = relationship(back_populates="visualization")
@@ -11317,7 +11311,7 @@ History.users_shared_with_count = column_property( # type:ignore[assignment]
deferred=True,
)
Page.average_rating = column_property( # type:ignore[assignment]
Page.average_rating = column_property(
select(func.avg(PageRatingAssociation.rating)).where(PageRatingAssociation.page_id == Page.id).scalar_subquery(),
deferred=True,
)
@@ -11340,7 +11334,7 @@ Workflow.step_count = column_property( # type:ignore[assignment]
select(func.count(WorkflowStep.id)).where(Workflow.id == WorkflowStep.workflow_id).scalar_subquery(), deferred=True
)
WorkflowInvocationStep.subworkflow_invocation_id = column_property( # type:ignore[assignment]
WorkflowInvocationStep.subworkflow_invocation_id = column_property(
select(WorkflowInvocationToSubworkflowInvocationAssociation.subworkflow_invocation_id)
.where(
and_(
+1 -1
View File
@@ -58,7 +58,7 @@ def _run_migrations_invoked_via_script(run_migrations: Callable[[str], None]) ->
if revision_str:
if len(revision_str) > 1:
log.error("Please run the commmand for one revision at a time")
revision_str = revision_str[0] # type: ignore[union-attr]
revision_str = revision_str[0]
if revision_str.startswith(f"{GXY}@"):
url = urls[GXY]
+2 -2
View File
@@ -2175,7 +2175,7 @@ class DirectoryModelExportStore(ModelExportStore):
# Write collections' attributes (including datasets list) to file.
stmt_hdca = (
select(model.HistoryDatasetCollectionAssociation)
.where(model.HistoryDatasetCollectionAssociation.history == history) # type:ignore[arg-type]
.where(model.HistoryDatasetCollectionAssociation.history == history)
.where(model.HistoryDatasetCollectionAssociation.deleted == expression.false())
)
collections = sa_session.scalars(stmt_hdca)
@@ -2190,7 +2190,7 @@ class DirectoryModelExportStore(ModelExportStore):
self.export_collection(collection, include_deleted=include_deleted)
# Write datasets' attributes to file.
actions_backref = model.Dataset.actions # type: ignore[attr-defined]
actions_backref = model.Dataset.actions
stmt_hda = (
select(model.HistoryDatasetAssociation)
+13 -15
View File
@@ -1,21 +1,8 @@
import hashlib
from typing import Optional
from .caching import (
CacheTarget,
enable_cache_monitor,
InProcessCacheMonitor,
parse_caching_config_dict_from_xml,
)
try:
from ..authnz.util import provider_name_to_backend
except ImportError:
provider_name_to_backend = None # type: ignore[misc,assignment]
import logging
import os
import shutil
from typing import Optional
try:
import rucio.common
@@ -30,6 +17,11 @@ try:
except ImportError:
Client = None
try:
from galaxy.authnz.util import provider_name_to_backend
except ImportError:
provider_name_to_backend = None # type: ignore[assignment, unused-ignore]
from galaxy.exceptions import (
ObjectInvalid,
ObjectNotFound,
@@ -41,7 +33,13 @@ from galaxy.util import (
unlink,
)
from galaxy.util.path import safe_relpath
from ..objectstore import ConcreteObjectStore
from . import ConcreteObjectStore
from .caching import (
CacheTarget,
enable_cache_monitor,
InProcessCacheMonitor,
parse_caching_config_dict_from_xml,
)
log = logging.getLogger(__name__)
@@ -1,11 +1,10 @@
import copy
import logging
import time
from abc import ABC
try:
from rucio.client.uploadclient import UploadClient
from rucio.common.exception import ( # type: ignore
from rucio.common.exception import (
InputValidationError,
NoFilesUploaded,
NotAllFilesUploaded,
@@ -14,7 +13,7 @@ try:
from rucio.common.utils import generate_uuid
from rucio.rse import rsemanager as rsemgr
except ImportError:
UploadClient = ABC
UploadClient = object
class DeleteClient(UploadClient):
+1 -1
View File
@@ -269,4 +269,4 @@ class FetchDataPayload(BaseDataPayload):
class FetchDataFormPayload(BaseDataPayload):
targets: Union[Json[Targets], Targets] # type: ignore[type-arg] # https://github.com/samuelcolvin/pydantic/issues/2990
targets: Union[Json[Targets], Targets]
@@ -101,7 +101,7 @@ class BaseMetadataGenerator:
repo_path = self.repository.repo_path(self.app)
if hasattr(self.repository, "repo_files_directory"):
# Galaxy Side.
repo_files_directory = self.repository.repo_files_directory(self.app) # type: ignore[attr-defined]
repo_files_directory = self.repository.repo_files_directory(self.app)
repo_dir = repo_files_directory
else:
# Tool Shed side.
@@ -11,7 +11,7 @@ from galaxy import util
try:
from galaxy.util.template import fill_template
except ImportError:
fill_template = None # type: ignore[assignment]
fill_template = None # type: ignore[assignment, unused-ignore]
log = logging.getLogger(__name__)
@@ -324,7 +324,7 @@ class MetadataToolOutputAction(ToolOutputAction):
else:
# fallback when Cheetah not available, equivalent to how this was handled prior 23.0
# definitely not needed for CWL tool parsing
log.warning("Cheetah not installed, falling back to legacy 'apply_action' behavior.") # type: ignore[unreachable]
log.warning("Cheetah not installed, falling back to legacy 'apply_action' behavior.") # type: ignore[unreachable, unused-ignore]
value = self.default
if value is not None:
setattr(output_dataset.metadata, self.name, value)
+1 -8
View File
@@ -4,15 +4,8 @@ import threading
try:
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver
can_watch = True
except ImportError:
Observer = None # type:ignore[assignment, misc]
FileSystemEventHandler = object # type:ignore[assignment, misc]
PollingObserver = None # type:ignore[assignment, misc]
can_watch = False
FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore]
from galaxy.util.hash_util import md5_hash_file
from galaxy.util.watcher import (
+2 -2
View File
@@ -31,11 +31,11 @@ except ImportError:
try:
from PIL import Image
except ImportError:
Image = None # type: ignore[assignment]
Image = None # type: ignore[assignment, unused-ignore]
try:
import tifffile
except ImportError:
tifffile = None # type: ignore[assignment]
tifffile = None # type: ignore[assignment, unused-ignore]
from galaxy.tool_util.parser.util import (
+1 -1
View File
@@ -2178,7 +2178,7 @@ class DataToolParameter(BaseDataToolParameter):
elif isinstance(value, HistoryDatasetCollectionAssociation) or isinstance(value, DatasetCollectionElement):
rval.append(value)
else:
rval.append(session.get(HistoryDatasetAssociation, int(value))) # type:ignore[arg-type]
rval.append(session.get(HistoryDatasetAssociation, int(value)))
dataset_matcher_factory = get_dataset_matcher_factory(trans)
dataset_matcher = dataset_matcher_factory.dataset_matcher(self, other_values)
for v in rval:
+7 -6
View File
@@ -62,7 +62,7 @@ from boltons.iterutils import (
remap,
)
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry # type: ignore[import-untyped]
from requests.packages.urllib3.util.retry import Retry # type: ignore[import-untyped, unused-ignore]
from typing_extensions import (
Literal,
Self,
@@ -117,7 +117,7 @@ try:
except ImportError:
LXML_AVAILABLE = False
import xml.etree.ElementTree as etree # type: ignore[assignment,no-redef]
import xml.etree.ElementTree as etree # type: ignore[no-redef]
from xml.etree.ElementTree import ( # type: ignore[assignment] # noqa: F401
Element,
ElementTree,
@@ -135,7 +135,7 @@ from .path import ( # noqa: F401
from .rst_to_html import rst_to_html # noqa: F401
try:
shlex_join = shlex.join # type: ignore[attr-defined]
shlex_join = shlex.join # type: ignore[attr-defined, unused-ignore]
except AttributeError:
# Python < 3.8
def shlex_join(split_command):
@@ -179,9 +179,10 @@ def str_removeprefix(s: str, prefix: str):
"""
if sys.version_info >= (3, 9):
return s.removeprefix(prefix)
if s.startswith(prefix): # type: ignore[unreachable]
elif s.startswith(prefix):
return s[len(prefix) :]
return s
else:
return s
def remove_protocol_from_url(url):
@@ -1133,7 +1134,7 @@ def commaify(amount):
@overload
def unicodify( # type: ignore[misc]
def unicodify( # type: ignore[overload-overlap]
value: Literal[None],
encoding: str = DEFAULT_ENCODING,
error: str = "replace",
+1 -1
View File
@@ -81,7 +81,7 @@ class BoolBinaryOperation:
return f"({sep.join(map(str, self.args))})"
def __bool__(self):
return self.evalop(bool(a) for a in self.args) # type: ignore[misc,call-arg]
return self.evalop(bool(a) for a in self.args)
__nonzero__ = __bool__
+1 -1
View File
@@ -10,7 +10,7 @@ from typing import (
try:
from PIL import Image
except ImportError:
Image = None # type: ignore[assignment]
Image = None # type: ignore[assignment, unused-ignore]
log = logging.getLogger(__name__)
+3 -3
View File
@@ -13,9 +13,9 @@ try:
can_watch = True
except ImportError:
Observer = None # type:ignore[assignment]
FileSystemEventHandler = object # type:ignore[assignment, misc]
PollingObserver = None # type:ignore[assignment, misc]
Observer = None # type:ignore[assignment, unused-ignore]
FileSystemEventHandler = object # type:ignore[assignment,misc, unused-ignore]
PollingObserver = None # type:ignore[assignment, misc, unused-ignore]
can_watch = False
from galaxy.util.hash_util import md5_hash_file
+1 -1
View File
@@ -8,7 +8,7 @@ from yaml.constructor import ConstructorError
try:
from yaml import CSafeLoader as SafeLoader
except ImportError:
from yaml import SafeLoader # type: ignore[misc, assignment]
from yaml import SafeLoader # type: ignore[assignment]
log = logging.getLogger(__name__)
+2 -2
View File
@@ -269,8 +269,8 @@ class Genomes:
dbkeys = []
# Add user's custom keys to dbkeys.
if user and user.preferences and "dbkeys" in user.preferences: # type:ignore[unreachable]
user_keys_dict = loads(user.preferences["dbkeys"]) # type:ignore[unreachable]
if user and user.preferences and "dbkeys" in user.preferences:
user_keys_dict = loads(user.preferences["dbkeys"])
dbkeys.extend([(attributes["name"], key) for key, attributes in user_keys_dict.items()])
# Add app keys to dbkeys.
+1 -1
View File
@@ -2,4 +2,4 @@
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__) # type: ignore[has-type]
__path__ = extend_path(__path__, __name__)
+1 -1
View File
@@ -345,7 +345,7 @@ class GalaxyWebTransaction(base.DefaultWebTransaction, context.ProvidesHistoryCo
self._ensure_valid_session(session_cookie)
if hasattr(self.app, "authnz_manager") and self.app.authnz_manager:
self.app.authnz_manager.refresh_expiring_oidc_tokens(self) # type: ignore[attr-defined]
self.app.authnz_manager.refresh_expiring_oidc_tokens(self)
if self.galaxy_session:
# When we've authenticated by session, we have to check the
+1 -1
View File
@@ -117,4 +117,4 @@ def get_openapi(
output["webhooks"] = webhook_paths
if tags:
output["tags"] = tags
return jsonable_encoder(OpenAPI(**output), by_alias=True, exclude_none=True) # type: ignore
return jsonable_encoder(OpenAPI(**output), by_alias=True, exclude_none=True)
+3 -3
View File
@@ -1385,14 +1385,14 @@ class InputParameterModule(WorkflowModule):
def restrict_options(self, step, connections: Iterable[WorkflowStepConnection], default_value):
try:
static_options = [] # type:ignore[var-annotated]
static_options = []
# Retrieve possible runtime options for 'select' type inputs
for connection in connections:
# Well this isn't a great assumption...
assert connection.input_step
module = connection.input_step.module
assert isinstance(module, (ToolModule, SubWorkflowModule))
if isinstance(module, ToolModule): # type:ignore[unreachable]
if isinstance(module, ToolModule):
assert module.tool
tool_inputs = module.tool.inputs # may not be set, but we're catching the Exception below.
@@ -2551,7 +2551,7 @@ class WorkflowModuleInjector:
def compute_runtime_state(self, step: WorkflowStep, step_args=None):
assert step.module, "module must be injected before computing runtime state"
state, step_errors = step.module.compute_runtime_state(self.trans, step, step_args) # type:ignore[unreachable]
state, step_errors = step.module.compute_runtime_state(self.trans, step, step_args)
step.state = state
# Fix any missing parameters
+1 -1
View File
@@ -17,7 +17,7 @@ try:
except ImportError:
# Galaxy libraries and galaxy test driver not available, just assume we're
# targetting a remote Galaxy.
GalaxyTestDriver = None # type: ignore[misc,assignment]
GalaxyTestDriver = None # type: ignore[assignment, misc, unused-ignore]
class ApiTestCase(FunctionalTestCase, UsesApiTestCaseMixin, UsesCeleryTasks):
+3 -3
View File
@@ -536,7 +536,7 @@ else:
NavigatesGalaxyMixin = object
class UsesLibraryAssertions(NavigatesGalaxyMixin): # type:ignore[valid-type, misc]
class UsesLibraryAssertions(NavigatesGalaxyMixin):
@retry_assertion_during_transitions
def assert_num_displayed_items_is(self, n):
num_displayed = self.num_displayed_items()
@@ -546,7 +546,7 @@ class UsesLibraryAssertions(NavigatesGalaxyMixin): # type:ignore[valid-type, mi
return len(self.libraries_table_elements())
class UsesHistoryItemAssertions(NavigatesGalaxyMixin): # type:ignore[valid-type, misc]
class UsesHistoryItemAssertions(NavigatesGalaxyMixin):
def assert_item_peek_includes(self, hid, expected):
item_body = self.history_panel_item_component(hid=hid)
peek_text = item_body.peek.wait_for_text()
@@ -584,7 +584,7 @@ EXAMPLE_WORKFLOW_URL_1 = (
)
class UsesWorkflowAssertions(NavigatesGalaxyMixin): # type:ignore[valid-type, misc]
class UsesWorkflowAssertions(NavigatesGalaxyMixin):
@retry_assertion_during_transitions
def _assert_showing_n_workflows(self, n):
if (actual_count := len(self.workflow_card_elements())) != n:
+3 -3
View File
@@ -132,7 +132,7 @@ class PlaywrightShedBrowser(ShedBrowser):
input_s = form.locator(f"select[name='{control_name}']")
if input_i.count():
if control_name in ["redirect"]:
input_i.input_value = value # type:ignore[method-assign, assignment]
input_i.input_value = value # type:ignore[assignment, unused-ignore]
else:
if isinstance(value, bool):
if value and not input_i.is_checked():
@@ -142,9 +142,9 @@ class PlaywrightShedBrowser(ShedBrowser):
else:
input_i.fill(value)
if input_t.count():
input_t.fill(value) # type:ignore[arg-type]
input_t.fill(value) # type:ignore[arg-type, unused-ignore]
if input_s.count():
input_s.select_option(value) # type:ignore[arg-type]
input_s.select_option(value) # type:ignore[arg-type, unused-ignore]
def edit_repository_categories(self, categories_to_add: List[str], categories_to_remove: List[str]) -> None:
multi_select = "form[name='categories'] select[name='category_id']"
+3 -3
View File
@@ -5,7 +5,7 @@ from typing import (
)
import twill.commands as tc
from twill.browser import FormElement # type:ignore[attr-defined]
from twill.browser import FormElement # type:ignore[attr-defined, unused-ignore]
from galaxy.util import smart_str
from .browser import (
@@ -19,13 +19,13 @@ tc.timeout(240)
def visit_url(url: str, allowed_codes: List[int]) -> str:
new_url = tc.go(url) # type:ignore[func-returns-value]
tc.go(url)
return_code = tc.browser.code
assert return_code in allowed_codes, "Invalid HTTP return code {}, allowed codes: {}".format(
return_code,
", ".join(str(code) for code in allowed_codes),
)
return new_url
return url
def page_content() -> str:
+7 -7
View File
@@ -115,12 +115,12 @@ class User(Base, Dictifiable):
purged: Mapped[Optional[bool]] = mapped_column(Boolean, index=True, default=False)
active_repositories = relationship(
"Repository",
primaryjoin=(lambda: (Repository.user_id == User.id) & (not_(Repository.deleted))), # type: ignore[has-type]
primaryjoin=(lambda: (Repository.user_id == User.id) & (not_(Repository.deleted))),
back_populates="user",
order_by=lambda: desc(Repository.name), # type: ignore[has-type]
order_by=lambda: desc(Repository.name),
)
galaxy_sessions = relationship(
"GalaxySession", back_populates="user", order_by=lambda: desc(GalaxySession.update_time) # type: ignore[has-type]
"GalaxySession", back_populates="user", order_by=lambda: desc(GalaxySession.update_time)
)
api_keys = relationship("APIKeys", back_populates="user", order_by=lambda: desc(APIKeys.create_time))
reset_tokens = relationship("PasswordResetToken", back_populates="user")
@@ -134,9 +134,9 @@ class User(Base, Dictifiable):
"UserRoleAssociation",
viewonly=True,
primaryjoin=(
lambda: (User.id == UserRoleAssociation.user_id) # type: ignore[has-type]
& (UserRoleAssociation.role_id == Role.id) # type: ignore[has-type]
& not_(Role.name == User.email) # type: ignore[has-type]
lambda: (User.id == UserRoleAssociation.user_id)
& (UserRoleAssociation.role_id == Role.id)
& not_(Role.name == User.email)
),
)
@@ -379,7 +379,7 @@ class Repository(Base, Dictifiable):
user = relationship("User", back_populates="active_repositories")
downloadable_revisions = relationship(
"RepositoryMetadata",
primaryjoin=lambda: (Repository.id == RepositoryMetadata.repository_id) & (RepositoryMetadata.downloadable == true()), # type: ignore[attr-defined,has-type]
primaryjoin=lambda: (Repository.id == RepositoryMetadata.repository_id) & (RepositoryMetadata.downloadable == true()), # type: ignore[has-type]
viewonly=True,
order_by=lambda: desc(RepositoryMetadata.update_time), # type: ignore[attr-defined]
)
+1
View File
@@ -14,6 +14,7 @@ no_implicit_reexport = True
no_implicit_optional = True
strict_equality = True
warn_unreachable = True
warn_unused_ignores = True
platform = linux
# green list - work on growing these please!
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
+3
View File
@@ -0,0 +1,3 @@
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__) # noqa: F821
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
-1
View File
@@ -1 +0,0 @@
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore[has-type]
+1
View File
@@ -0,0 +1 @@
../../package.__init__.py
@@ -89,7 +89,7 @@ class TestCeleryUserRateLimitIntegration(IntegrationTestCase):
results: Dict[int, List[AsyncResult]] = {}
for user in users:
user_results: List[AsyncResult] = []
for _ in range(num_calls): # type: ignore
for _ in range(num_calls):
user_results.append(mock_user_id_task.delay(task_user_id=user))
results[user] = user_results
# Collect results of each call
+1 -1
View File
@@ -66,7 +66,7 @@ class AbstractTestCases:
@contextmanager
def _prepared_wrapper(self):
wrapper = self._wrapper()
wrapper._get_tool_evaluator = lambda *args, **kwargs: MockEvaluator(wrapper.app, wrapper.tool, wrapper.get_job(), wrapper.working_directory) # type: ignore[assignment]
wrapper._get_tool_evaluator = lambda *args, **kwargs: MockEvaluator(wrapper.app, wrapper.tool, wrapper.get_job(), wrapper.working_directory) # type: ignore[method-assign]
wrapper.prepare()
yield wrapper
@@ -88,7 +88,7 @@ class TestHistoryManager(BaseTestCase):
name_first_then_time = (
model.History.name,
sqlalchemy.desc(model.History.create_time),
) # type:ignore[var-annotated]
)
assert self.history_manager.list(order_by=name_first_then_time) == [history2, history1, history3]
def test_copy(self):
+10 -10
View File
@@ -46,15 +46,15 @@ class BaseExportTestCase(BaseTestCase):
@contextmanager
def _expect_get_history(self, history):
self.app.history_manager.get_accessible.return_value = history # type: ignore[attr-defined,union-attr]
self.app.history_manager.get_accessible.return_value = history
yield
self.app.history_manager.get_accessible.assert_called_once_with(history.id, self.trans.user) # type: ignore[attr-defined,union-attr]
self.app.history_manager.get_accessible.assert_called_once_with(history.id, self.trans.user)
@contextmanager
def _expect_get_hda(self, hda, hda_id=1):
self.app.hda_manager.get_accessible.return_value = hda # type: ignore[attr-defined,union-attr]
self.app.hda_manager.get_accessible.return_value = hda
yield
self.app.hda_manager.get_accessible.assert_called_once_with(hda.id, self.trans.user) # type: ignore[attr-defined,union-attr]
self.app.hda_manager.get_accessible.assert_called_once_with(hda.id, self.trans.user)
def _new_pair_collection(self):
hda_forward = self._new_hda(contents="Forward dataset.")
@@ -222,7 +222,7 @@ history_dataset_type(history_dataset_id=1)
hdca.collection = self._new_pair_collection()
hdca.id = 1
self.trans.app.dataset_collection_manager.get_dataset_collection_instance.return_value = hdca # type: ignore[attr-defined,union-attr]
self.trans.app.dataset_collection_manager.get_dataset_collection_instance.return_value = hdca
example = """# Example
```galaxy
history_dataset_collection_display(history_dataset_collection_id=1)
@@ -243,7 +243,7 @@ history_dataset_collection_display(history_dataset_collection_id=1)
stored_workflow.latest_workflow = workflow
workflow_step_0 = model.WorkflowStep()
workflow.steps = [workflow_step_0]
self.trans.app.workflow_manager.get_stored_accessible_workflow.return_value = stored_workflow # type: ignore[attr-defined,union-attr]
self.trans.app.workflow_manager.get_stored_accessible_workflow.return_value = stored_workflow
example = """# Example
```galaxy
workflow_display(workflow_id=1)
@@ -278,7 +278,7 @@ invocation_time(invocation_id=1)
```
"""
invocation = self._new_invocation()
self.app.workflow_manager.get_invocation.side_effect = [invocation] # type: ignore[attr-defined,union-attr]
self.app.workflow_manager.get_invocation.side_effect = [invocation]
result = self._to_basic(example)
expectedtime = invocation.create_time.strftime("%Y-%m-%d, %H:%M:%S")
assert f"\n {expectedtime}" in result
@@ -356,7 +356,7 @@ history_dataset_display(history_dataset_id=1)
history_dataset_display(history_dataset_id=2)
```
"""
self.app.hda_manager.get_accessible.side_effect = [hda, hda2] # type: ignore[attr-defined,union-attr]
self.app.hda_manager.get_accessible.side_effect = [hda, hda2]
export_markdown, extra_data = self._ready_export(example)
assert "history_datasets" in extra_data
assert len(extra_data["history_datasets"]) == 2
@@ -369,7 +369,7 @@ history_dataset_display(history_dataset_id=2)
hdca.history_id = 1
hdca.collection_id = hdca.collection.id
self.trans.app.dataset_collection_manager.get_dataset_collection_instance.return_value = hdca # type: ignore[attr-defined,union-attr]
self.trans.app.dataset_collection_manager.get_dataset_collection_instance.return_value = hdca
example = """# Example
```galaxy
history_dataset_collection_display(history_dataset_collection_id=1)
@@ -404,7 +404,7 @@ generate_time()
def test_get_invocation_time(self):
invocation = self._new_invocation()
self.app.workflow_manager.get_invocation.side_effect = [invocation] # type: ignore[attr-defined,union-attr]
self.app.workflow_manager.get_invocation.side_effect = [invocation]
example = """# Example
```galaxy
invocation_time(invocation_id=1)
+1 -1
View File
@@ -7,7 +7,7 @@ import pytest
try:
import psycopg
except ImportError:
psycopg = None # type: ignore[assignment]
psycopg = None # type: ignore[assignment, unused-ignore]
try:
import psycopg2
+8 -8
View File
@@ -32,23 +32,23 @@ class AbstractTestCases:
def test_read_write_secret(self):
self.vault.write_secret("my/test/secret", "hello world")
assert self.vault.read_secret("my/test/secret") == "hello world" # type: ignore
assert self.vault.read_secret("my/test/secret") == "hello world"
def test_overwrite_secret(self):
self.vault.write_secret("my/new/secret", "hello world")
self.vault.write_secret("my/new/secret", "hello overwritten")
assert self.vault.read_secret("my/new/secret") == "hello overwritten" # type: ignore
assert self.vault.read_secret("my/new/secret") == "hello overwritten"
def test_valid_paths(self):
with self.assertRaises(InvalidVaultKeyException): # type: ignore
with self.assertRaises(InvalidVaultKeyException):
self.vault.write_secret("", "hello world")
with self.assertRaises(InvalidVaultKeyException): # type: ignore
with self.assertRaises(InvalidVaultKeyException):
self.vault.write_secret("my//new/secret", "hello world")
with self.assertRaises(InvalidVaultKeyException): # type: ignore
with self.assertRaises(InvalidVaultKeyException):
self.vault.write_secret("my/ /new/secret", "hello world")
# leading and trailing slashes should be ignored
self.vault.write_secret("/my/new/secret with space/", "hello overwritten")
assert self.vault.read_secret("my/new/secret with space") == "hello overwritten" # type: ignore
assert self.vault.read_secret("my/new/secret with space") == "hello overwritten"
VAULT_CONF_HASHICORP = os.path.join(os.path.dirname(__file__), "fixtures/vault_conf_hashicorp.yml")
@@ -94,7 +94,7 @@ class TestDatabaseVault(AbstractTestCases.VaultTestBase):
vault.write_secret("my/rotated/secret", "hello rotated")
# should succeed after rotation
app.config.vault_config_file = VAULT_CONF_DATABASE_ROTATED # type: ignore
app.config.vault_config_file = VAULT_CONF_DATABASE_ROTATED # type: ignore[attr-defined]
vault = VaultFactory.from_app(app)
assert vault.read_secret("my/rotated/secret") == "hello rotated"
@@ -105,7 +105,7 @@ class TestDatabaseVault(AbstractTestCases.VaultTestBase):
vault.write_secret("my/incorrect/secret", "hello incorrect")
# should fail because decryption keys are the wrong
app.config.vault_config_file = VAULT_CONF_DATABASE_INVALID # type: ignore
app.config.vault_config_file = VAULT_CONF_DATABASE_INVALID # type: ignore[attr-defined]
vault = VaultFactory.from_app(app)
with self.assertRaises(InvalidToken):
vault.read_secret("my/incorrect/secret")
+1 -1
View File
@@ -29,7 +29,7 @@ USER_CONTEXT = {
class FileSourcesMockApp(GalaxyDataTestApp):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.file_sources = ConfiguredFileSources(ConfiguredFileSourcesConfig.from_app_config(self.config)) # type: ignore[assignment]
self.file_sources = ConfiguredFileSources(ConfiguredFileSourcesConfig.from_app_config(self.config))
@pytest.fixture
+3 -2
View File
@@ -8,9 +8,10 @@ import pytest
from galaxy.tool_util.toolbox import watcher
from galaxy.util import bunch
from galaxy.util.watcher import can_watch
@pytest.mark.skipif(not watcher.can_watch, reason="watchdog not available")
@pytest.mark.skipif(not can_watch, reason="watchdog not available")
def test_watcher():
with __test_directory() as t:
tool_path = path.join(t, "test.xml")
@@ -29,7 +30,7 @@ def test_watcher():
assert tool_watcher.observer is None
@pytest.mark.skipif(not watcher.can_watch, reason="watchdog not available")
@pytest.mark.skipif(not can_watch, reason="watchdog not available")
def test_tool_conf_watcher():
callback = CallbackRecorder()
conf_watcher = watcher.get_tool_conf_watcher(callback.call)
+1 -1
View File
@@ -170,7 +170,7 @@ def check_expression(text):
statements = module.body
if not len(statements) == 1:
return False # type: ignore[unreachable]
return False
expression = statements[0]
if expression.__class__.__name__ != "Expr":
return False