From 528bd5df5a2c2810e06a991921cbdd71eb9b66c7 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 13 Sep 2022 12:39:04 -0400 Subject: [PATCH] Refactor galaxy.tool_shed.tool_shed_registry -> galaxy.util.tool_shed. common_util makes heavy use of this implicitly so typing and designwise this will be better. --- lib/galaxy/app.py | 2 +- lib/galaxy/structured_app.py | 1 + lib/galaxy/{ => util}/tool_shed/tool_shed_registry.py | 6 +++--- lib/galaxy/webapps/galaxy/services/workflows.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) rename lib/galaxy/{ => util}/tool_shed/tool_shed_registry.py (92%) diff --git a/lib/galaxy/app.py b/lib/galaxy/app.py index ba065d78c59..c96d5c764e2 100644 --- a/lib/galaxy/app.py +++ b/lib/galaxy/app.py @@ -91,7 +91,6 @@ from galaxy.security.vault import ( Vault, VaultFactory, ) -from galaxy.tool_shed import tool_shed_registry from galaxy.tool_shed.galaxy_install.installed_repository_manager import InstalledRepositoryManager from galaxy.tool_shed.galaxy_install.update_repository_manager import UpdateRepositoryManager from galaxy.tool_util.deps import containers @@ -120,6 +119,7 @@ from galaxy.util import ( ) from galaxy.util.dbkeys import GenomeBuilds from galaxy.util.task import IntervalTask +from galaxy.util.tool_shed import tool_shed_registry from galaxy.visualization.data_providers.registry import DataProviderRegistry from galaxy.visualization.genomes import Genomes from galaxy.visualization.plugins.registry import VisualizationsRegistry diff --git a/lib/galaxy/structured_app.py b/lib/galaxy/structured_app.py index 4303cd85055..4dccde505e0 100644 --- a/lib/galaxy/structured_app.py +++ b/lib/galaxy/structured_app.py @@ -30,6 +30,7 @@ from galaxy.security.vault import Vault from galaxy.tool_util.deps.views import DependencyResolversView from galaxy.tool_util.verify import test_data from galaxy.util.dbkeys import GenomeBuilds +from galaxy.util.tool_shed.tool_shed_registry import Registry as ToolShedRegistry from galaxy.web_stack import ApplicationStack from galaxy.webhooks import WebhooksRegistry from galaxy.workflow.trs_proxy import TrsProxy diff --git a/lib/galaxy/tool_shed/tool_shed_registry.py b/lib/galaxy/util/tool_shed/tool_shed_registry.py similarity index 92% rename from lib/galaxy/tool_shed/tool_shed_registry.py rename to lib/galaxy/util/tool_shed/tool_shed_registry.py index a413a9d8312..37314e5bb8a 100644 --- a/lib/galaxy/tool_shed/tool_shed_registry.py +++ b/lib/galaxy/util/tool_shed/tool_shed_registry.py @@ -7,7 +7,7 @@ from typing import ( from galaxy.util import parse_xml_string from galaxy.util.path import StrPath -from galaxy.util.tool_shed.common_util import remove_protocol_from_tool_shed_url +from galaxy.util.tool_shed import common_util from galaxy.util.tool_shed.xml_util import parse_xml log = logging.getLogger(__name__) @@ -68,9 +68,9 @@ class Registry: Following more what galaxy.demo_sequencer.controllers.common does might be more appropriate at some stage... """ - url_sans_protocol = remove_protocol_from_tool_shed_url(url) + url_sans_protocol = common_util.remove_protocol_from_tool_shed_url(url) for shed_name, shed_url in self.tool_sheds.items(): - shed_url_sans_protocol = remove_protocol_from_tool_shed_url(shed_url) + shed_url_sans_protocol = common_util.remove_protocol_from_tool_shed_url(shed_url) if url_sans_protocol.startswith(shed_url_sans_protocol): return self.tool_sheds_auth[shed_name] log.debug(f"Invalid url '{str(url)}' received by tool shed registry's url_auth method.") diff --git a/lib/galaxy/webapps/galaxy/services/workflows.py b/lib/galaxy/webapps/galaxy/services/workflows.py index 52cf83c8145..8758110155e 100644 --- a/lib/galaxy/webapps/galaxy/services/workflows.py +++ b/lib/galaxy/webapps/galaxy/services/workflows.py @@ -15,7 +15,7 @@ from galaxy.managers.workflows import ( WorkflowsManager, ) from galaxy.schema.schema import WorkflowIndexQueryPayload -from galaxy.tool_shed.tool_shed_registry import Registry +from galaxy.util.tool_shed.tool_shed_registry import Registry from galaxy.webapps.galaxy.services.base import ServiceBase from galaxy.webapps.galaxy.services.sharable import ShareableService