diff --git a/lib/galaxy/schema/fields.py b/lib/galaxy/schema/fields.py index 687785e6eff8..f5ff399a3995 100644 --- a/lib/galaxy/schema/fields.py +++ b/lib/galaxy/schema/fields.py @@ -1,13 +1,11 @@ import re +import typing from pydantic import Field from typing_extensions import get_args -try: +if typing.TYPE_CHECKING: from galaxy.security.idencoding import IdEncodingHelper -except ImportError: - IdEncodingHelper = object # type: ignore[assignment,misc] - ENCODED_DATABASE_ID_PATTERN = re.compile("f?[0-9a-f]+") ENCODED_ID_LENGTH_MULTIPLE = 16 @@ -18,7 +16,7 @@ class BaseDatabaseIdField: Database ID validation. """ - security: IdEncodingHelper + security: "IdEncodingHelper" @classmethod def __get_validators__(cls): diff --git a/lib/tool_shed/managers/repositories.py b/lib/tool_shed/managers/repositories.py index 9d83144c258e..2323183bd178 100644 --- a/lib/tool_shed/managers/repositories.py +++ b/lib/tool_shed/managers/repositories.py @@ -33,6 +33,7 @@ ) from galaxy.tool_shed.util import dependency_display from galaxy.util import listify +from galaxy.util.tool_shed.encoding_util import tool_shed_encode from tool_shed.context import ( ProvidesRepositoriesContext, ProvidesUserContext, @@ -40,10 +41,7 @@ from tool_shed.metadata import repository_metadata_manager from tool_shed.repository_types import util as rt_util from tool_shed.structured_app import ToolShedApp -from tool_shed.util import ( - encoding_util, - hg_util, -) +from tool_shed.util import hg_util from tool_shed.util.metadata_util import ( get_all_dependencies, get_current_repository_metadata_for_changeset_revision, @@ -195,9 +193,9 @@ def check_updates(app: ToolShedApp, request: UpdatesRequest) -> Union[str, Dict[ tool_shed_status_dict["revision_upgrade"] = "False" break return ( - encoding_util.tool_shed_encode(tool_shed_status_dict) if hexlify_this else json.dumps(tool_shed_status_dict) + tool_shed_encode(tool_shed_status_dict) if hexlify_this else json.dumps(tool_shed_status_dict) ) - return encoding_util.tool_shed_encode({}) if hexlify_this else json.dumps({}) + return tool_shed_encode({}) if hexlify_this else json.dumps({}) def guid_to_repository(app: ToolShedApp, tool_id: str) -> "Repository": diff --git a/lib/tool_shed/test/functional/conftest.py b/lib/tool_shed/test/functional/conftest.py index 2b547bfe4b51..37bcabc6d661 100644 --- a/lib/tool_shed/test/functional/conftest.py +++ b/lib/tool_shed/test/functional/conftest.py @@ -1,6 +1,7 @@ import os from typing import ( Any, + Callable, Dict, Generator, ) @@ -29,7 +30,7 @@ def playwright_browser(class_context: BrowserContext) -> Generator[ShedBrowser, test_browser = os.environ.get("TOOL_SHED_TEST_BROWSER", DEFAULT_BROWSER) if test_browser == "twill": - shed_browser = pytest.fixture(scope="class")(twill_browser) + shed_browser: Callable[..., Generator[ShedBrowser, None, None]] = pytest.fixture(scope="class")(twill_browser) elif test_browser == "playwright": shed_browser = pytest.fixture(scope="class")(playwright_browser) else: diff --git a/lib/tool_shed/webapp/controllers/repository.py b/lib/tool_shed/webapp/controllers/repository.py index baee2f6123ba..688e2397525b 100644 --- a/lib/tool_shed/webapp/controllers/repository.py +++ b/lib/tool_shed/webapp/controllers/repository.py @@ -28,6 +28,7 @@ from galaxy.model.base import transaction from galaxy.tool_shed.util import dependency_display from galaxy.tools.repositories import ValidationContext +from galaxy.util.tool_shed import encoding_util from galaxy.web.form_builder import ( CheckboxField, SelectField, @@ -44,7 +45,6 @@ from tool_shed.util import ( basic_util, common_util, - encoding_util, hg_util, metadata_util, readme_util, diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/common.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/common.mako index 1da62ed987fc..e775470d39bb 100644 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/common.mako +++ b/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/common.mako @@ -820,7 +820,7 @@ <%def name="render_repository_items( metadata, containers_dict, can_set_metadata=False, render_repository_actions_for='tool_shed' )"> <% - from tool_shed.util.encoding_util import tool_shed_encode + from galaxy.util.tool_shed.encoding_util import tool_shed_encode has_datatypes = metadata and 'datatypes' in metadata has_readme_files = metadata and 'readme_files' in metadata diff --git a/packages/packages_by_dep_dag.txt b/packages/packages_by_dep_dag.txt index 3d9bc1f307aa..6c2547ff9fac 100644 --- a/packages/packages_by_dep_dag.txt +++ b/packages/packages_by_dep_dag.txt @@ -1,21 +1,27 @@ util -schema + config files job_metrics navigation objectstore +schema tool_util + data selenium tours +test_base + auth job_execution -web_stack +test_api web_framework +web_stack + app + web_apps -test_base + test_driver -test_api -tool_shed \ No newline at end of file +tool_shed diff --git a/packages/test.sh b/packages/test.sh index 87497a561e4f..2850a258e1bd 100755 --- a/packages/test.sh +++ b/packages/test.sh @@ -13,7 +13,9 @@ for arg in "$@"; do done # Don't display the pip progress bar when running under CI -[ "$CI" = 'true' ] && export PIP_PROGRESS_BAR=off +if [ "$CI" = 'true' ]; then + export PIP_PROGRESS_BAR=off +fi # Change to packages directory. cd "$(dirname "$0")" @@ -30,7 +32,11 @@ if [ $FOR_PULSAR -eq 0 ]; then fi # ensure ordered by dependency DAG -while read -r package_dir; do +while read -r package_dir || [ -n "$package_dir" ]; do # https://stackoverflow.com/questions/12916352/shell-script-read-missing-last-line + if [ -z "$package_dir" ]; then + # Skip empty lines + continue + fi printf "\n========= TESTING PACKAGE ${package_dir} =========\n\n" cd "$package_dir" diff --git a/templates/webapps/tool_shed/repository/common.mako b/templates/webapps/tool_shed/repository/common.mako index 88761598d423..d3fff587b61d 100644 --- a/templates/webapps/tool_shed/repository/common.mako +++ b/templates/webapps/tool_shed/repository/common.mako @@ -1046,7 +1046,7 @@ <%def name="render_repository_items( metadata, containers_dict, can_set_metadata=False, render_repository_actions_for='tool_shed' )"> <% - from tool_shed.util.encoding_util import tool_shed_encode + from galaxy.util.tool_shed.encoding_util import tool_shed_encode has_datatypes = metadata and 'datatypes' in metadata has_readme_files = metadata and 'readme_files' in metadata