From 0e89124a13cb8a95db4d74fdc9e6780d7abc0e6e Mon Sep 17 00:00:00 2001 From: galaxybot Date: Sat, 27 Apr 2024 03:26:22 +0000 Subject: [PATCH 1/3] Update Python dependencies --- lib/galaxy/dependencies/dev-requirements.txt | 16 ++++++++-------- .../dependencies/pinned-lint-requirements.txt | 4 ++-- lib/galaxy/dependencies/pinned-requirements.txt | 8 ++++---- .../pinned-typecheck-requirements.txt | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/galaxy/dependencies/dev-requirements.txt b/lib/galaxy/dependencies/dev-requirements.txt index f963631db7b0..59178ed6dc9d 100644 --- a/lib/galaxy/dependencies/dev-requirements.txt +++ b/lib/galaxy/dependencies/dev-requirements.txt @@ -9,7 +9,7 @@ axe-selenium-python==2.1.6 ; python_version >= "3.8" and python_version < "3.13" babel==2.14.0 ; python_version >= "3.8" and python_version < "3.13" backports-tarfile==1.1.1 ; python_version >= "3.8" and python_version < "3.12" backports-zoneinfo==0.2.1 ; python_version >= "3.8" and python_version < "3.9" -black==24.4.0 ; python_version >= "3.8" and python_version < "3.13" +black==24.4.2 ; python_version >= "3.8" and python_version < "3.13" build==1.2.1 ; python_version >= "3.8" and python_version < "3.13" cachecontrol[filecache]==0.14.0 ; python_version >= "3.8" and python_version < "3.13" certifi==2024.2.2 ; python_version >= "3.8" and python_version < "3.13" @@ -19,9 +19,9 @@ click==8.1.7 ; python_version >= "3.8" and python_version < "3.13" codespell==2.2.6 ; python_version >= "3.8" and python_version < "3.13" colorama==0.4.6 ; python_version >= "3.8" and python_version < "3.13" and (sys_platform == "win32" or platform_system == "Windows" or os_name == "nt") contourpy==1.1.1 ; python_version >= "3.8" and python_version < "3.13" -coverage[toml]==7.4.4 ; python_version >= "3.8" and python_version < "3.13" +coverage[toml]==7.5.0 ; python_version >= "3.8" and python_version < "3.13" cryptography==42.0.5 ; python_version >= "3.8" and python_version < "3.13" -cwltest==2.5.20240304113812 ; python_version >= "3.8" and python_version < "3.13" +cwltest==2.5.20240425111257 ; python_version >= "3.8" and python_version < "3.13" cycler==0.12.1 ; python_version >= "3.8" and python_version < "3.13" darker==2.1.1 ; python_version >= "3.8" and python_version < "3.13" darkgraylib==1.2.1 ; python_version >= "3.8" and python_version < "3.13" @@ -56,7 +56,7 @@ jinja2==3.1.3 ; python_version >= "3.8" and python_version < "3.13" jsonschema-specifications==2023.12.1 ; python_version >= "3.9" and python_version < "3.13" jsonschema==4.20.0 ; python_version >= "3.9" and python_version < "3.13" junit-xml==1.9 ; python_version >= "3.8" and python_version < "3.13" -keyring==25.1.0 ; python_version >= "3.8" and python_version < "3.13" +keyring==25.2.0 ; python_version >= "3.8" and python_version < "3.13" kiwisolver==1.4.5 ; python_version >= "3.8" and python_version < "3.13" lxml==4.9.4 ; python_version >= "3.8" and python_version < "3.13" markdown-it-py==3.0.0 ; python_version >= "3.8" and python_version < "3.13" @@ -83,7 +83,7 @@ pbr==6.0.0 ; python_version >= "3.9" and python_version < "3.13" pillow==10.3.0 ; python_version >= "3.8" and python_version < "3.13" pkce==1.0.3 ; python_version >= "3.8" and python_version < "3.13" pkginfo==1.10.0 ; python_version >= "3.8" and python_version < "3.13" -platformdirs==4.2.0 ; python_version >= "3.8" and python_version < "3.13" +platformdirs==4.2.1 ; python_version >= "3.8" and python_version < "3.13" playwright==1.43.0 ; python_version >= "3.8" and python_version < "3.13" pluggy==1.5.0 ; python_version >= "3.8" and python_version < "3.13" port-for==0.7.2 ; python_version >= "3.8" and python_version < "3.13" @@ -119,7 +119,7 @@ pywin32-ctypes==0.2.2 ; python_version >= "3.8" and python_version < "3.13" and pyyaml==6.0.1 ; python_version >= "3.8" and python_version < "3.13" rdflib==6.3.2 ; python_version >= "3.8" and python_version < "3.13" readme-renderer==43.0 ; python_version >= "3.8" and python_version < "3.13" -referencing==0.34.0 ; python_version >= "3.9" and python_version < "3.13" +referencing==0.35.0 ; python_version >= "3.9" and python_version < "3.13" requests-toolbelt==1.0.0 ; python_version >= "3.8" and python_version < "3.13" requests==2.31.0 ; python_version >= "3.8" and python_version < "3.13" responses==0.25.0 ; python_version >= "3.8" and python_version < "3.13" @@ -133,7 +133,7 @@ schema-salad==8.5.20240410123758 ; python_version >= "3.8" and python_version < scipy==1.10.1 ; python_version >= "3.8" and python_version < "3.9" scipy==1.13.0 ; python_version >= "3.9" and python_version < "3.13" secretstorage==3.3.3 ; python_version >= "3.8" and python_version < "3.13" and sys_platform == "linux" -selenium==4.19.0 ; python_version >= "3.8" and python_version < "3.13" +selenium==4.20.0 ; python_version >= "3.8" and python_version < "3.13" seletools==1.4.0 ; python_version >= "3.8" and python_version < "3.13" setuptools==69.5.1 ; python_version >= "3.8" and python_version < "3.13" six==1.16.0 ; python_version >= "3.8" and python_version < "3.13" @@ -160,7 +160,7 @@ tomli==2.0.1 ; python_version >= "3.8" and python_full_version <= "3.11.0a6" trio-websocket==0.11.1 ; python_version >= "3.8" and python_version < "3.13" trio==0.25.0 ; python_version >= "3.8" and python_version < "3.13" tuspy==1.0.3 ; python_version >= "3.8" and python_version < "3.13" -twill==3.2.3 ; python_version >= "3.8" and python_version < "3.13" +twill==3.2.4 ; python_version >= "3.8" and python_version < "3.13" twine==5.0.0 ; python_version >= "3.8" and python_version < "3.13" typing-extensions==4.11.0 ; python_version >= "3.8" and python_version < "3.13" tzdata==2024.1 ; python_version >= "3.8" and python_version < "3.13" and sys_platform == "win32" diff --git a/lib/galaxy/dependencies/pinned-lint-requirements.txt b/lib/galaxy/dependencies/pinned-lint-requirements.txt index fea2eeeb9fa8..951a6bf4792f 100644 --- a/lib/galaxy/dependencies/pinned-lint-requirements.txt +++ b/lib/galaxy/dependencies/pinned-lint-requirements.txt @@ -1,7 +1,7 @@ attrs==23.2.0 flake8==7.0.0 -flake8-bugbear==24.4.21 +flake8-bugbear==24.4.26 mccabe==0.7.0 pycodestyle==2.11.1 pyflakes==3.2.0 -ruff==0.4.1 +ruff==0.4.2 diff --git a/lib/galaxy/dependencies/pinned-requirements.txt b/lib/galaxy/dependencies/pinned-requirements.txt index 37b51a528176..007384ec0854 100644 --- a/lib/galaxy/dependencies/pinned-requirements.txt +++ b/lib/galaxy/dependencies/pinned-requirements.txt @@ -122,7 +122,7 @@ oyaml==1.0 ; python_version >= "3.8" and python_version < "3.13" packaging==24.0 ; python_version >= "3.8" and python_version < "3.13" paramiko==3.4.0 ; python_version >= "3.8" and python_version < "3.13" parsley==1.3 ; python_version >= "3.8" and python_version < "3.13" -paste==3.9.0 ; python_version >= "3.8" and python_version < "3.13" +paste==3.10.0 ; python_version >= "3.8" and python_version < "3.13" pastedeploy==3.1.0 ; python_version >= "3.8" and python_version < "3.13" pebble==5.0.7 ; python_version >= "3.8" and python_version < "3.13" pillow==10.3.0 ; python_version >= "3.8" and python_version < "3.13" @@ -148,7 +148,7 @@ pylibmagic==0.5.0 ; python_version >= "3.8" and python_version < "3.13" pynacl==1.5.0 ; python_version >= "3.8" and python_version < "3.13" pyparsing==3.1.2 ; python_version >= "3.8" and python_version < "3.13" pyreadline3==3.4.1 ; sys_platform == "win32" and python_version >= "3.8" and python_version < "3.13" -pysam==0.22.0 ; python_version >= "3.8" and python_version < "3.13" +pysam==0.22.1 ; python_version >= "3.8" and python_version < "3.13" python-dateutil==2.9.0.post0 ; python_version >= "3.8" and python_version < "3.13" python-magic==0.4.27 ; python_version >= "3.8" and python_version < "3.13" python-multipart==0.0.9 ; python_version >= "3.8" and python_version < "3.13" @@ -157,7 +157,7 @@ pytz==2024.1 ; python_version >= "3.8" and python_version < "3.13" pyyaml==6.0.1 ; python_version >= "3.8" and python_version < "3.13" pyzmq==26.0.2 ; python_version >= "3.8" and python_version < "3.13" rdflib==6.3.2 ; python_version >= "3.8" and python_version < "3.13" -referencing==0.34.0 ; python_version >= "3.8" and python_version < "3.13" +referencing==0.35.0 ; python_version >= "3.8" and python_version < "3.13" refgenconf==0.12.2 ; python_version >= "3.8" and python_version < "3.13" regex==2024.4.16 ; python_version >= "3.8" and python_version < "3.13" repoze-lru==0.7 ; python_version >= "3.8" and python_version < "3.13" @@ -178,7 +178,7 @@ setuptools==69.5.1 ; python_version >= "3.8" and python_version < "3.13" shellescape==3.8.1 ; python_version >= "3.8" and python_version < "3.13" six==1.16.0 ; python_version >= "3.8" and python_version < "3.13" sniffio==1.3.1 ; python_version >= "3.8" and python_version < "3.13" -social-auth-core==4.5.3 ; python_version >= "3.8" and python_version < "3.13" +social-auth-core==4.5.4 ; python_version >= "3.8" and python_version < "3.13" sortedcontainers==2.4.0 ; python_version >= "3.8" and python_version < "3.13" spython==0.3.13 ; python_version >= "3.8" and python_version < "3.13" sqlalchemy==2.0.29 ; python_version >= "3.8" and python_version < "3.13" diff --git a/lib/galaxy/dependencies/pinned-typecheck-requirements.txt b/lib/galaxy/dependencies/pinned-typecheck-requirements.txt index 014e6a3a3cb5..99e1264d74fd 100644 --- a/lib/galaxy/dependencies/pinned-typecheck-requirements.txt +++ b/lib/galaxy/dependencies/pinned-typecheck-requirements.txt @@ -3,7 +3,7 @@ cffi==1.16.0 ; python_version >= "3.8" and python_version < "3.13" and platform_ cryptography==42.0.5 ; python_version >= "3.8" and python_version < "3.13" lxml-stubs==0.5.1 ; python_version >= "3.8" and python_version < "3.13" mypy-extensions==1.0.0 ; python_version >= "3.8" and python_version < "3.13" -mypy==1.9.0 ; python_version >= "3.8" and python_version < "3.13" +mypy==1.10.0 ; python_version >= "3.8" and python_version < "3.13" pycparser==2.22 ; python_version >= "3.8" and python_version < "3.13" and platform_python_implementation != "PyPy" pydantic-core==2.18.2 ; python_version >= "3.8" and python_version < "3.13" pydantic==2.7.1 ; python_version >= "3.8" and python_version < "3.13" @@ -20,6 +20,6 @@ types-pkg-resources==0.1.3 ; python_version >= "3.8" and python_version < "3.13" types-python-dateutil==2.9.0.20240316 ; python_version >= "3.8" and python_version < "3.13" types-pyyaml==6.0.12.20240311 ; python_version >= "3.8" and python_version < "3.13" types-requests==2.31.0.6 ; python_version >= "3.8" and python_version < "3.13" -types-six==1.16.21.20240311 ; python_version >= "3.8" and python_version < "3.13" +types-six==1.16.21.20240425 ; python_version >= "3.8" and python_version < "3.13" types-urllib3==1.26.25.14 ; python_version >= "3.8" and python_version < "3.13" typing-extensions==4.11.0 ; python_version >= "3.8" and python_version < "3.13" From 0629908541043d93063df8832c8f94d6d41bb3ca Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Sat, 27 Apr 2024 16:03:22 +0100 Subject: [PATCH 2/3] Fix new UP031 errors from ruff 0.4.2 --- .../webhooks/demo/tour_generator/__init__.py | 28 ++++----- doc/parse_gx_xsd.py | 32 +++++----- lib/galaxy/actions/library.py | 2 +- lib/galaxy/auth/providers/ldap_ad.py | 4 +- lib/galaxy/config/__init__.py | 5 +- lib/galaxy/datatypes/binary.py | 14 ++--- .../interval_to_bedstrict_converter.py | 2 +- .../converters/maf_to_fasta_converter.py | 11 ++-- .../converters/wiggle_to_simple_converter.py | 2 +- lib/galaxy/datatypes/interval.py | 6 +- lib/galaxy/datatypes/neo4j.py | 3 +- lib/galaxy/datatypes/proteomics.py | 2 +- lib/galaxy/datatypes/qiime2.py | 4 +- lib/galaxy/datatypes/registry.py | 5 +- lib/galaxy/datatypes/tabular.py | 2 +- lib/galaxy/datatypes/tracks.py | 3 +- lib/galaxy/datatypes/xml.py | 2 +- lib/galaxy/job_execution/actions/post.py | 4 +- lib/galaxy/jobs/__init__.py | 3 +- lib/galaxy/jobs/runners/__init__.py | 2 +- lib/galaxy/jobs/runners/aws.py | 2 +- lib/galaxy/jobs/runners/pbs.py | 4 +- .../jobs/runners/state_handlers/resubmit.py | 4 +- lib/galaxy/jobs/runners/util/cli/job/lsf.py | 2 +- lib/galaxy/jobs/runners/util/pykube_util.py | 2 +- lib/galaxy/managers/interactivetool.py | 9 +-- lib/galaxy/managers/markdown_parse.py | 4 +- lib/galaxy/managers/markdown_util.py | 10 +-- lib/galaxy/managers/users.py | 2 +- lib/galaxy/model/__init__.py | 7 +-- lib/galaxy/model/deferred.py | 4 +- lib/galaxy/model/store/__init__.py | 2 +- lib/galaxy/objectstore/__init__.py | 4 +- lib/galaxy/objectstore/rucio_extra_clients.py | 14 ++--- lib/galaxy/selenium/sizzle.py | 13 ++-- lib/galaxy/tool_shed/tools/tool_validator.py | 7 +-- lib/galaxy/tool_shed/util/shed_util_common.py | 2 +- lib/galaxy/tool_util/deps/brew_exts.py | 4 +- .../tool_util/deps/mulled/mulled_build.py | 2 +- lib/galaxy/tool_util/parser/xml.py | 3 +- lib/galaxy/tools/__init__.py | 6 +- .../tools/error_reports/plugins/gitlab.py | 2 +- lib/galaxy/util/markdown.py | 2 +- lib/galaxy/util/topsort.py | 2 +- .../web/framework/middleware/profile.py | 2 +- lib/galaxy/webapps/base/webapp.py | 2 +- .../webapps/galaxy/controllers/admin.py | 6 +- .../webapps/galaxy/controllers/dataset.py | 2 +- .../webapps/galaxy/controllers/history.py | 8 +-- lib/galaxy/webapps/galaxy/controllers/page.py | 4 +- .../webapps/galaxy/controllers/tool_runner.py | 4 +- .../galaxy/controllers/visualization.py | 2 +- lib/galaxy/workflow/modules.py | 4 +- lib/galaxy/workflow/refactor/execute.py | 4 +- lib/galaxy_test/api/test_libraries.py | 2 +- .../dependencies/attribute_handlers.py | 4 +- .../metadata/repository_metadata_manager.py | 6 +- lib/tool_shed/repository_types/util.py | 22 +++---- lib/tool_shed/test/base/twilltestcase.py | 10 ++- ...st_0440_deleting_dependency_definitions.py | 44 +++++++------ lib/tool_shed/util/shed_util_common.py | 10 +-- lib/tool_shed/webapp/controllers/user.py | 13 ++-- scripts/api/common.py | 10 +-- scripts/api/data_manager_example_execute.py | 4 +- scripts/api/display.py | 2 +- scripts/api/example_watch_folder.py | 8 +-- .../filter_failed_datasets_from_collection.py | 3 +- scripts/api/history_create_history.py | 2 +- scripts/api/history_delete_history.py | 2 +- .../api/import_library_dataset_to_history.py | 2 +- scripts/api/library_create_folder.py | 2 +- scripts/api/library_create_library.py | 2 +- scripts/api/library_upload_from_import_dir.py | 2 +- scripts/api/load_data_with_metadata.py | 4 +- ...eset_metadata_on_installed_repositories.py | 2 +- scripts/api/workflow_delete.py | 2 +- scripts/api/workflow_execute.py | 2 +- scripts/api/workflow_execute_parameters.py | 2 +- scripts/api/workflow_import.py | 4 +- .../api/workflow_import_from_file_rpark.py | 2 +- scripts/apply_tags.py | 6 +- scripts/build_toolbox.py | 2 +- scripts/check_python.py | 7 ++- .../admin_cleanup_datasets.py | 10 +-- scripts/cleanup_datasets/pgcleanup.py | 18 +++--- scripts/config_sample_to_kwalify.py | 8 +-- scripts/db_shell.py | 6 +- scripts/drmaa_external_killer.py | 2 +- scripts/drmaa_external_runner.py | 6 +- scripts/dump_library_paths.py | 4 +- scripts/external_chown_script.py | 6 +- scripts/grt/export.py | 2 +- scripts/loc_files/create_all_fasta_loc.py | 61 ++++++++----------- scripts/microbes/create_bacteria_loc_file.py | 14 ++--- scripts/microbes/create_nib_seq_loc_file.py | 4 +- scripts/microbes/harvest_bacteria.py | 36 +++++------ scripts/pages_identifier_conversion.py | 4 +- scripts/runtime_stats.py | 24 ++++---- scripts/set_user_disk_usage.py | 4 +- scripts/tests_markdown.py | 4 +- scripts/tool_shed/api/common.py | 6 +- scripts/tool_shed/api/create_categories.py | 4 +- scripts/tool_shed/api/create_users.py | 6 +- ...deprecate_repositories_without_metadata.py | 8 +-- scripts/tools/re_escape_output.py | 2 +- scripts/update_shed_config_path.py | 4 +- .../chained_dyndest_rules/module2/rules.py | 2 +- .../chained_dyndest_rules/module3/rules.py | 2 +- .../integration/test_repository_operations.py | 4 +- test/integration/test_structured_dataset.py | 10 +-- .../gen_history_export_test_artifacts.py | 2 +- test/manual/workflows_scaling.py | 6 +- test/unit/app/queue_worker/conftest.py | 2 +- test/unit/app/test_markdown_validate.py | 2 +- test/unit/app/tools/conftest.py | 2 +- test/unit/app/tools/test_wrappers.py | 13 ++-- test/unit/config/test_path_resolves_to.py | 6 +- test/unit/data/test_model_copy.py | 4 +- test/unit/data/test_quota.py | 2 +- test/unit/files/test_posix.py | 2 +- test/unit/objectstore/test_objectstore.py | 2 +- test/unit/tool_shed/test_shed_index.py | 2 +- .../unit/tool_util/mulled/test_mulled_list.py | 4 +- test/unit/tool_util/test_tool_deps.py | 16 +++-- test/unit/util/test_lazy_process.py | 2 +- test/unit/util/test_rule_utils.py | 4 +- test/unit/util/test_sqlite_utils.py | 4 +- 127 files changed, 381 insertions(+), 425 deletions(-) diff --git a/config/plugins/webhooks/demo/tour_generator/__init__.py b/config/plugins/webhooks/demo/tour_generator/__init__.py index 16219c91b402..3e5e39bb1d18 100644 --- a/config/plugins/webhooks/demo/tour_generator/__init__.py +++ b/config/plugins/webhooks/demo/tour_generator/__init__.py @@ -59,7 +59,7 @@ def _upload_test_data(self): filename = test_datasets[input_name] input_path = self._tool.test_data_path(filename) if not input_path: - raise ValueError('Test dataset "%s" doesn\'t exist.' % input_name) + raise ValueError(f'Test dataset "{input_name}" doesn\'t exist.') upload_tool = self._trans.app.toolbox.get_tool("upload1") filename = os.path.basename(input_path) with open(input_path, "rb") as f: @@ -92,12 +92,12 @@ def _upload_test_data(self): def _generate_tour(self): """Generate a tour.""" - tour_name = self._tool.name + " Tour" + tour_name = f"{self._tool.name} Tour" test_inputs = self._test.inputs.keys() steps = [ { "title": tour_name, - "content": "This short tour will guide you through the " + self._tool.name + " tool.", + "content": f"This short tour will guide you through the {self._tool.name} tool.", "orphan": True, } ] @@ -107,26 +107,26 @@ def _generate_tour(self): continue step = { "title": input.label, - "element": "[id='form-element-%s']" % name, + "element": f"[id='form-element-{name}']", "placement": "right", "content": "", } if input.type == "text": if name in test_inputs: param = self._test.inputs[name] - step["content"] = "Enter value(s): %s" % param + step["content"] = f"Enter value(s): {param}" else: step["content"] = "Enter a value" elif input.type == "integer" or input.type == "float": if name in test_inputs: num_param = self._test.inputs[name][0] - step["content"] = "Enter number: %s" % num_param + step["content"] = f"Enter number: {num_param}" else: step["content"] = "Enter a number" elif input.type == "boolean": if name in test_inputs: choice = "Yes" if self._test.inputs[name][0] is True else "No" - step["content"] = "Choose %s" % choice + step["content"] = f"Choose {choice}" else: step["content"] = "Choose Yes/No" elif input.type == "select": @@ -138,7 +138,7 @@ def _generate_tour(self): params.append(option[0]) if params: select_param = ", ".join(params) - step["content"] = "Select parameter(s): %s" % select_param + step["content"] = f"Select parameter(s): {select_param}" else: step["content"] = "Select a parameter" elif input.type == "data": @@ -151,7 +151,7 @@ def _generate_tour(self): elif input.type == "conditional": param_id = f"{input.name}|{input.test_param.name}" step["title"] = input.test_param.label - step["element"] = "[id='form-element-%s']" % param_id + step["element"] = f"[id='form-element-{param_id}']" params = [] if param_id in self._test.inputs.keys(): for option in input.test_param.static_options: @@ -173,24 +173,24 @@ def _generate_tour(self): step_msg = f"Select dataset: {hid}: {dataset}" else: case_params = ", ".join(self._test.inputs[tour_id]) - step_msg = "Select parameter(s): " + "%s" % case_params + step_msg = f"Select parameter(s): {case_params}" cond_case_steps.append( { "title": case_title, - "element": "[id='form-element-%s']" % tour_id, + "element": f"[id='form-element-{tour_id}']", "placement": "right", "content": step_msg, } ) if params: cond_param = ", ".join(params) - step["content"] = "Select parameter(s): %s" % cond_param + step["content"] = f"Select parameter(s): {cond_param}" else: step["content"] = "Select a parameter" elif input.type == "data_column": if name in test_inputs: column_param = self._test.inputs[name][0] - step["content"] = "Select Column: %s" % column_param + step["content"] = f"Select Column: {column_param}" else: step["content"] = "Select a column" else: @@ -210,7 +210,7 @@ def _generate_tour(self): self._tour = { "title_default": tour_name, "name": tour_name, - "description": self._tool.name + " " + self._tool.description, + "description": f"{self._tool.name} {self._tool.description}", "steps": steps, } diff --git a/doc/parse_gx_xsd.py b/doc/parse_gx_xsd.py index d1453f86870b..e34a9ba89afd 100644 --- a/doc/parse_gx_xsd.py +++ b/doc/parse_gx_xsd.py @@ -34,7 +34,7 @@ def main(): class Tag: - def __init__(self, line): + def __init__(self, line: str): assert line.startswith("$tag:") line_parts = line.split(" ") first_part = line_parts[0] @@ -52,12 +52,12 @@ def __init__(self, line): @property def _pretty_title(self): - return " > ".join("``%s``" % p for p in self.title.split("|")) + return " > ".join(f"``{p}``" for p in self.title.split("|")) def build_help(self): tag = xmlschema_doc.find(self.xpath) if tag is None: - raise Exception("Could not find xpath for %s" % self.xpath) + raise Exception(f"Could not find xpath for {self.xpath}") tag_help = StringIO() tag_help.write("## " + self._pretty_title) @@ -98,7 +98,7 @@ def _build_tag(tag, hide_attributes): doc = _doc_or_none(element) if doc is None: doc = _doc_or_none(_type_el(element)) - assert doc is not None, "Documentation for %s is empty" % element.attrib["name"] + assert doc is not None, f"Documentation for {element.attrib['name']} is empty" doc = doc.strip() element_el = _find_tag_el(element) @@ -110,10 +110,9 @@ def _build_tag(tag, hide_attributes): if best_practices := _get_bp_link(annotation_el): tag_help.write("\n\n### Best Practices\n") tag_help.write( - """ -Find the Intergalactic Utilities Commision suggested best practices for this -element [here](%s).""" - % best_practices + f""" +Find the Intergalactic Utilities Commission suggested best practices for this +element [here]({best_practices}).""" ) tag_help.write(_build_attributes_table(tag, attributes, hide_attributes)) @@ -140,7 +139,7 @@ def _get_bp_link(annotation_el): anchor = annotation_el.attrib.get("{http://galaxyproject.org/xml/1.0}best_practices", None) link = None if anchor: - link = "https://galaxy-iuc-standards.readthedocs.io/en/latest/best_practices/tool_xml.html#%s" % anchor + link = f"https://galaxy-iuc-standards.readthedocs.io/en/latest/best_practices/tool_xml.html#{anchor}" return link @@ -149,7 +148,7 @@ def _build_attributes_table(tag, attributes, hide_attributes=False, attribute_na attribute_table.write("\n\n") if attributes and not hide_attributes: header_prefix = "#" * header_level - attribute_table.write("\n%s Attributes\n\n" % header_prefix) + attribute_table.write(f"\n{header_prefix} Attributes\n\n") attribute_table.write("Attribute | Details | Required\n") attribute_table.write("--- | --- | ---\n") for attribute in attributes: @@ -159,7 +158,7 @@ def _build_attributes_table(tag, attributes, hide_attributes=False, attribute_na details = _doc_or_none(attribute) if details is None: type_el = _type_el(attribute) - assert type_el is not None, "No details or type found for %s" % name + assert type_el is not None, f"No details or type found for {name}" details = _doc_or_none(type_el) annotation_el = type_el.find("{http://www.w3.org/2001/XMLSchema}annotation") else: @@ -170,10 +169,7 @@ def _build_attributes_table(tag, attributes, hide_attributes=False, attribute_na details = details.replace("|", "\\|").strip() best_practices = _get_bp_link(annotation_el) if best_practices: - details += ( - """ Find the Intergalactic Utilities Commision suggested best practices for this element [here](%s).""" - % best_practices - ) + details += f""" Find the Intergalactic Utilities Commission suggested best practices for this element [here]({best_practices}).""" attribute_table.write(f"``{name}`` | {details} | {use}\n") return attribute_table.getvalue() @@ -204,7 +200,7 @@ def _find_attributes(tag): for attribute_group in attribute_groups: attribute_group_name = attribute_group.get("ref") attribute_group_def = xmlschema_doc.find( - "//{http://www.w3.org/2001/XMLSchema}attributeGroup/[@name='%s']" % attribute_group_name + f"//{{http://www.w3.org/2001/XMLSchema}}attributeGroup/[@name='{attribute_group_name}']" ) attributes.extend(_find_attributes(attribute_group_def)) return attributes @@ -219,9 +215,9 @@ def _find_tag_el(tag): def _type_el(tag): element_type = tag.attrib["type"] - type_el = xmlschema_doc.find("//{http://www.w3.org/2001/XMLSchema}complexType/[@name='%s']" % element_type) + type_el = xmlschema_doc.find(f"//{{http://www.w3.org/2001/XMLSchema}}complexType/[@name='{element_type}']") if type_el is None: - type_el = xmlschema_doc.find("//{http://www.w3.org/2001/XMLSchema}simpleType/[@name='%s']" % element_type) + type_el = xmlschema_doc.find(f"//{{http://www.w3.org/2001/XMLSchema}}simpleType/[@name='{element_type}']") return type_el diff --git a/lib/galaxy/actions/library.py b/lib/galaxy/actions/library.py index 5962474bbf20..72b651e1869a 100644 --- a/lib/galaxy/actions/library.py +++ b/lib/galaxy/actions/library.py @@ -265,7 +265,7 @@ def _check_path_paste_params(self, params): if not os.path.exists(path): bad_paths.append(path) if bad_paths: - message = 'Invalid paths: "%s".' % '", "'.join(bad_paths) + message = 'Invalid paths: "{}".'.format('", "'.join(bad_paths)) response_code = 400 return None, response_code, message return None diff --git a/lib/galaxy/auth/providers/ldap_ad.py b/lib/galaxy/auth/providers/ldap_ad.py index 180f925556c5..5c7e5974100a 100644 --- a/lib/galaxy/auth/providers/ldap_ad.py +++ b/lib/galaxy/auth/providers/ldap_ad.py @@ -135,8 +135,8 @@ def check_config(self, username, email, options): self.role_search_attribute = options.get(self.role_search_option) if self.auto_create_roles_or_groups and self.role_search_attribute is None: raise ConfigurationError( - "If 'auto-create-roles' or 'auto-create-groups' is True, a '%s' attribute has to" - " be provided." % self.role_search_option + f"If 'auto-create-roles' or 'auto-create-groups' is True, a '{self.role_search_option}' attribute has to" + " be provided." ) return ok, failure_mode diff --git a/lib/galaxy/config/__init__.py b/lib/galaxy/config/__init__.py index c69009d47315..e3da3e743e55 100644 --- a/lib/galaxy/config/__init__.py +++ b/lib/galaxy/config/__init__.py @@ -944,7 +944,8 @@ def _process_config(self, kwargs: Dict[str, Any]) -> None: log.warning( "The path '%s' for the 'sanitize_allowlist_file' config option is " "deprecated and will be no longer checked in a future release. Please consult " - "the latest version of the sample configuration file." % deprecated + "the latest version of the sample configuration file.", + deprecated, ) _sanitize_allowlist_path = deprecated break @@ -965,7 +966,7 @@ def _process_config(self, kwargs: Dict[str, Any]) -> None: ) # Searching data libraries self.ftp_upload_dir_template = kwargs.get( - "ftp_upload_dir_template", "${ftp_upload_dir}%s${ftp_upload_dir_identifier}" % os.path.sep + "ftp_upload_dir_template", f"${{ftp_upload_dir}}{os.path.sep}${{ftp_upload_dir_identifier}}" ) # Support older library-specific path paste option but just default to the new # allow_path_paste value. diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 679cc6da19db..6e6a5d570177 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -2089,7 +2089,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str: try: return dataset.peek except Exception: - return "HDF5 Model (%s)" % (nice_size(dataset.get_size())) + return f"HDF5 Model ({nice_size(dataset.get_size())})" def display_data( self, @@ -4258,7 +4258,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str: try: return dataset.peek except Exception: - return "Binary pretext file (%s)" % (nice_size(dataset.get_size())) + return f"Binary pretext file ({nice_size(dataset.get_size())})" class JP2(Binary): @@ -4302,7 +4302,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str: try: return dataset.peek except Exception: - return "Binary JPEG 2000 file (%s)" % (nice_size(dataset.get_size())) + return f"Binary JPEG 2000 file ({nice_size(dataset.get_size())})" class Npz(CompressedArchive): @@ -4356,7 +4356,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str: try: return dataset.peek except Exception: - return "Binary Numpy npz file (%s)" % (nice_size(dataset.get_size())) + return f"Binary Numpy npz file ({nice_size(dataset.get_size())})" class HexrdImagesNpz(Npz): @@ -4433,7 +4433,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str: try: return dataset.peek except Exception: - return "Binary Numpy npz file (%s)" % (nice_size(dataset.get_size())) + return f"Binary Numpy npz file ({nice_size(dataset.get_size())})" class HexrdEtaOmeNpz(Npz): @@ -4495,7 +4495,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str: try: return dataset.peek except Exception: - return "Binary Numpy npz file (%s)" % (nice_size(dataset.get_size())) + return f"Binary Numpy npz file ({nice_size(dataset.get_size())})" class FITS(Binary): @@ -4624,4 +4624,4 @@ def display_peek(self, dataset: DatasetProtocol) -> str: try: return dataset.peek except Exception: - return "Binary numpy file (%s)" % (nice_size(dataset.get_size())) + return f"Binary numpy file ({nice_size(dataset.get_size())})" diff --git a/lib/galaxy/datatypes/converters/interval_to_bedstrict_converter.py b/lib/galaxy/datatypes/converters/interval_to_bedstrict_converter.py index ea2d1b013138..1e343d32ae8b 100644 --- a/lib/galaxy/datatypes/converters/interval_to_bedstrict_converter.py +++ b/lib/galaxy/datatypes/converters/interval_to_bedstrict_converter.py @@ -181,7 +181,7 @@ def __main__(): fields = [str(item) for item in (region.chrom, region.start, region.end, name, 0, region.strand)] if force_num_columns is not None and len(fields) != force_num_columns: fields = force_bed_field_count(fields, count, force_num_columns) - out.write("%s\n" % "\t".join(fields)) + out.write("{}\n".format("\t".join(fields))) except Exception: skipped_lines += 1 if first_skipped_line is None: diff --git a/lib/galaxy/datatypes/converters/maf_to_fasta_converter.py b/lib/galaxy/datatypes/converters/maf_to_fasta_converter.py index 0b968f3c7537..aa7252ba1128 100644 --- a/lib/galaxy/datatypes/converters/maf_to_fasta_converter.py +++ b/lib/galaxy/datatypes/converters/maf_to_fasta_converter.py @@ -24,11 +24,12 @@ def __main__(): else: spec_counts[spec] += 1 out.write( - "%s\n" - % maf_utilities.get_fasta_header( - c, - {"block_index": count, "species": spec, "sequence_index": spec_counts[spec]}, - suffix="%s_%i_%i" % (spec, count, spec_counts[spec]), + "{}\n".format( + maf_utilities.get_fasta_header( + c, + {"block_index": count, "species": spec, "sequence_index": spec_counts[spec]}, + suffix="%s_%i_%i" % (spec, count, spec_counts[spec]), + ) ) ) out.write(f"{c.text}\n") diff --git a/lib/galaxy/datatypes/converters/wiggle_to_simple_converter.py b/lib/galaxy/datatypes/converters/wiggle_to_simple_converter.py index 853d57e0172c..66aa9028e58d 100644 --- a/lib/galaxy/datatypes/converters/wiggle_to_simple_converter.py +++ b/lib/galaxy/datatypes/converters/wiggle_to_simple_converter.py @@ -20,7 +20,7 @@ def main(): with open(sys.argv[1]) as in_file, open(sys.argv[2], "w") as out_file: try: for fields in bx.wiggle.IntervalReader(UCSCOutWrapper(in_file)): - out_file.write("%s\n" % "\t".join(map(str, fields))) + out_file.write("{}\n".format("\t".join(map(str, fields)))) except UCSCLimitException: # Wiggle data was truncated, at the very least need to warn the user. sys.stderr.write( diff --git a/lib/galaxy/datatypes/interval.py b/lib/galaxy/datatypes/interval.py index 2fbac3ff7abe..ee323163c885 100644 --- a/lib/galaxy/datatypes/interval.py +++ b/lib/galaxy/datatypes/interval.py @@ -289,18 +289,18 @@ def as_ucsc_display_file(self, dataset: DatasetProtocol, **kwd) -> Union[FileObj if t < len(elems): strand = cast(str, elems[t]) tmp = [elems[c], elems[s], elems[e], name, "0", strand] - fh.write("%s\n" % "\t".join(tmp)) + fh.write("{}\n".format("\t".join(tmp))) elif n >= 0: # name column (should) exists for i, elems in enumerate(compression_utils.file_iter(dataset.get_file_name())): name = "region_%i" % i if n >= 0 and n < len(elems): name = cast(str, elems[n]) tmp = [elems[c], elems[s], elems[e], name] - fh.write("%s\n" % "\t".join(tmp)) + fh.write("{}\n".format("\t".join(tmp))) else: for elems in compression_utils.file_iter(dataset.get_file_name()): tmp = [elems[c], elems[s], elems[e]] - fh.write("%s\n" % "\t".join(tmp)) + fh.write("{}\n".format("\t".join(tmp))) return compression_utils.get_fileobj(fh.name, mode="rb") def display_peek(self, dataset: DatasetProtocol) -> str: diff --git a/lib/galaxy/datatypes/neo4j.py b/lib/galaxy/datatypes/neo4j.py index 608b19c0d9c5..0d6fec174dee 100644 --- a/lib/galaxy/datatypes/neo4j.py +++ b/lib/galaxy/datatypes/neo4j.py @@ -30,9 +30,8 @@ def generate_primary_file(self, dataset: HasExtraFilesAndMetadata) -> str: """ # self.regenerate_primary_file(dataset) rval = [ - "Files for Composite Dataset (%s)

\ + f"Files for Composite Dataset ({self.file_ext})

\ This composite dataset is composed of the following files: