From 93a2fcb84c2a9dbe0f85e999cc1d3eb445ab484a Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 30 Jan 2024 16:49:31 +0000 Subject: [PATCH] Update to black 2024 stable style --- .flake8 | 3 +- .github/workflows/lint.yaml | 2 - lib/galaxy/actions/library.py | 1 + lib/galaxy/app_unittest_utils/galaxy_mock.py | 1 + lib/galaxy/auth/__init__.py | 1 + lib/galaxy/auth/providers/__init__.py | 1 + lib/galaxy/auth/providers/alwaysreject.py | 1 + lib/galaxy/auth/providers/ldap_ad.py | 1 - lib/galaxy/auth/providers/localdb.py | 1 + lib/galaxy/auth/providers/pam_auth.py | 1 + lib/galaxy/config/__init__.py | 7 ++-- lib/galaxy/datatypes/anvio.py | 1 + lib/galaxy/datatypes/checkers.py | 1 + .../datatypes/constructive_solid_geometry.py | 1 + .../datatypes/converters/interval_to_fli.py | 1 + lib/galaxy/datatypes/data.py | 12 +++--- lib/galaxy/datatypes/dataproviders/base.py | 1 + lib/galaxy/datatypes/dataproviders/chunk.py | 1 + lib/galaxy/datatypes/dataproviders/column.py | 1 + lib/galaxy/datatypes/dataproviders/dataset.py | 1 + .../datatypes/dataproviders/external.py | 1 + .../datatypes/dataproviders/hierarchy.py | 1 + lib/galaxy/datatypes/dataproviders/line.py | 1 + lib/galaxy/datatypes/genetics.py | 1 + lib/galaxy/datatypes/gis.py | 1 + lib/galaxy/datatypes/goldenpath.py | 2 - lib/galaxy/datatypes/graph.py | 1 + lib/galaxy/datatypes/hdf5.py | 1 + lib/galaxy/datatypes/images.py | 1 + lib/galaxy/datatypes/interval.py | 1 + lib/galaxy/datatypes/media.py | 1 + lib/galaxy/datatypes/mothur.py | 1 + lib/galaxy/datatypes/neo4j.py | 1 + lib/galaxy/datatypes/ngsindex.py | 1 + lib/galaxy/datatypes/phylip.py | 1 + lib/galaxy/datatypes/proteomics.py | 1 + lib/galaxy/datatypes/protocols.py | 40 +++++++------------ lib/galaxy/datatypes/qualityscore.py | 1 + lib/galaxy/datatypes/registry.py | 6 +-- lib/galaxy/datatypes/sniff.py | 3 +- lib/galaxy/datatypes/tracks.py | 1 + lib/galaxy/datatypes/triples.py | 1 + lib/galaxy/datatypes/util/gff_util.py | 1 + lib/galaxy/datatypes/xml.py | 1 + lib/galaxy/dependencies/dev-requirements.txt | 2 +- lib/galaxy/di.py | 1 + lib/galaxy/exceptions/error_codes.py | 1 + lib/galaxy/forms/forms.py | 1 + lib/galaxy/job_execution/actions/post.py | 1 + lib/galaxy/job_execution/datasets.py | 1 + lib/galaxy/job_execution/output_collect.py | 1 + lib/galaxy/job_execution/setup.py | 1 + lib/galaxy/job_metrics/__init__.py | 1 + lib/galaxy/job_metrics/formatting.py | 1 + .../job_metrics/instrumenters/__init__.py | 1 + .../job_metrics/instrumenters/cgroup.py | 1 + lib/galaxy/job_metrics/instrumenters/core.py | 1 + .../job_metrics/instrumenters/cpuinfo.py | 1 + lib/galaxy/job_metrics/instrumenters/env.py | 1 + .../job_metrics/instrumenters/hostname.py | 1 + .../job_metrics/instrumenters/meminfo.py | 1 + lib/galaxy/job_metrics/instrumenters/uname.py | 1 + lib/galaxy/jobs/__init__.py | 1 + lib/galaxy/jobs/handler.py | 1 + lib/galaxy/jobs/manager.py | 1 + lib/galaxy/jobs/runners/__init__.py | 1 + lib/galaxy/jobs/runners/aws.py | 1 + lib/galaxy/jobs/runners/condor.py | 1 + lib/galaxy/jobs/runners/local.py | 1 + lib/galaxy/jobs/runners/pulsar.py | 1 + lib/galaxy/jobs/runners/slurm.py | 1 + lib/galaxy/jobs/runners/univa.py | 1 + lib/galaxy/jobs/runners/util/__init__.py | 1 + lib/galaxy/jobs/runners/util/cli/__init__.py | 1 + .../jobs/runners/util/cli/job/__init__.py | 1 + .../jobs/runners/util/cli/shell/__init__.py | 1 + .../jobs/runners/util/condor/__init__.py | 1 + lib/galaxy/jobs/runners/util/pykube_util.py | 1 + lib/galaxy/main_config.py | 1 + lib/galaxy/managers/annotatable.py | 3 +- lib/galaxy/managers/base.py | 7 ++-- lib/galaxy/managers/cloudauthzs.py | 6 +-- lib/galaxy/managers/collections.py | 6 +-- lib/galaxy/managers/configuration.py | 1 + lib/galaxy/managers/context.py | 1 + lib/galaxy/managers/datasets.py | 1 + lib/galaxy/managers/dbkeys.py | 1 + lib/galaxy/managers/deletable.py | 7 ++-- lib/galaxy/managers/executables.py | 1 + lib/galaxy/managers/folders.py | 1 + lib/galaxy/managers/hdas.py | 1 + lib/galaxy/managers/hdcas.py | 1 + lib/galaxy/managers/histories.py | 7 ++-- lib/galaxy/managers/history_contents.py | 1 + lib/galaxy/managers/libraries.py | 1 + lib/galaxy/managers/library_datasets.py | 1 + lib/galaxy/managers/markdown_parse.py | 1 + lib/galaxy/managers/markdown_util.py | 1 + lib/galaxy/managers/pages.py | 1 + lib/galaxy/managers/quotas.py | 1 + lib/galaxy/managers/ratable.py | 1 + lib/galaxy/managers/roles.py | 1 + lib/galaxy/managers/secured.py | 7 ++-- lib/galaxy/managers/sharable.py | 1 + lib/galaxy/managers/users.py | 1 + lib/galaxy/managers/visualizations.py | 1 + lib/galaxy/managers/workflows.py | 6 +-- lib/galaxy/metadata/__init__.py | 8 ++-- lib/galaxy/metadata/set_metadata.py | 1 + lib/galaxy/model/__init__.py | 25 ++++++------ lib/galaxy/model/base.py | 1 + lib/galaxy/model/database_object_names.py | 1 + .../model/dataset_collections/structure.py | 1 + lib/galaxy/model/index_filter_util.py | 1 + ...87b_drop_job_state_history_update_time_.py | 1 + ...9563e1fe_add_notification_system_tables.py | 1 + ...0_add_workflow_invocation_message_table.py | 1 + .../versions_gxy/3356bc2ecfc4_drop_view.py | 1 + ...dd_index_wf_r_s_s__workflow_invocation_.py | 1 + ...518c8438a91b_add_when_expression_column.py | 1 + ...e024ceaca1_add_export_association_table.py | 1 + .../6a67bf27e6a6_deferred_data_tables.py | 1 + ..._columns_to_interactivetool_entry_point.py | 1 + ...9540a051226e_preferred_object_store_ids.py | 1 + ...ecb_create_celery_user_rate_limit_table.py | 1 + ...05f_add_workflow_source_metadata_column.py | 1 + ...e8b8_make_api_keys_deleted_non_nullable.py | 1 + ...04_add_skipped_state_to_collection_job_.py | 1 + ...dd_index_wf_r_i_p__workflow_invocation_.py | 1 + .../d0583094c8cd_add_quota_source_labels.py | 1 + ...ddbdbc40bdc1_add_workflow_comment_table.py | 1 + ...d5fc8c7_add_archived_columns_to_history.py | 1 + ...bb173ee6_add_column_deleted_to_api_keys.py | 1 + .../e7b6dcb09efd_create_gxy_branch.py | 1 - ...c5d0b47a9_alter_column_external_user_id.py | 1 + .../d4a650f47a3c_create_tsi_branch.py | 1 - lib/galaxy/model/migrations/base.py | 19 ++++----- lib/galaxy/model/migrations/util.py | 15 +++---- lib/galaxy/model/orm/scripts.py | 1 + lib/galaxy/model/scoped_session.py | 1 + lib/galaxy/model/store/__init__.py | 18 +++------ lib/galaxy/model/store/discover.py | 1 + .../model/tool_shed_install/__init__.py | 6 +-- lib/galaxy/model/unittest_utils/__init__.py | 1 + lib/galaxy/model/unittest_utils/data_app.py | 1 + .../model/unittest_utils/store_fixtures.py | 1 + lib/galaxy/objectstore/__init__.py | 3 -- lib/galaxy/objectstore/caching.py | 1 + lib/galaxy/objectstore/irods.py | 1 + lib/galaxy/objectstore/s3.py | 1 + .../objectstore/unittest_utils/__init__.py | 1 + lib/galaxy/queues.py | 1 + lib/galaxy/quota/__init__.py | 1 + lib/galaxy/schema/bco/util.py | 1 + lib/galaxy/security/__init__.py | 1 + lib/galaxy/security/validate_user_input.py | 1 + lib/galaxy/selenium/cli.py | 1 - lib/galaxy/selenium/has_driver.py | 4 +- lib/galaxy/structured_app.py | 7 ++-- lib/galaxy/tool_shed/galaxy_install/client.py | 21 ++++------ .../installed_repository_manager.py | 7 ++-- .../repository_dependency_manager.py | 1 + .../update_repository_manager.py | 1 + .../tool_shed/metadata/metadata_generator.py | 3 +- lib/galaxy/tool_util/client/staging.py | 1 + lib/galaxy/tool_util/cwl/cwltool_deps.py | 1 + lib/galaxy/tool_util/cwl/parser.py | 6 +-- lib/galaxy/tool_util/cwl/runnable.py | 1 + lib/galaxy/tool_util/cwl/schema.py | 1 + lib/galaxy/tool_util/cwl/util.py | 1 + lib/galaxy/tool_util/data/__init__.py | 9 ++--- lib/galaxy/tool_util/deps/brew_util.py | 1 + lib/galaxy/tool_util/deps/conda_compat.py | 1 + .../tool_util/deps/container_classes.py | 9 ++--- .../deps/container_resolvers/__init__.py | 1 + .../deps/container_resolvers/explicit.py | 1 + lib/galaxy/tool_util/deps/docker_util.py | 1 + .../tool_util/deps/resolvers/__init__.py | 1 + .../resolvers/brewed_tool_shed_packages.py | 1 + lib/galaxy/tool_util/deps/resolvers/lmod.py | 1 + .../tool_util/deps/resolvers/modules.py | 1 + .../resolvers/unlinked_tool_shed_packages.py | 1 + lib/galaxy/tool_util/linters/general.py | 1 + lib/galaxy/tool_util/linters/inputs.py | 1 + lib/galaxy/tool_util/linters/outputs.py | 1 + lib/galaxy/tool_util/linters/stdio.py | 1 + lib/galaxy/tool_util/linters/tests.py | 1 + lib/galaxy/tool_util/loader_directory.py | 1 + lib/galaxy/tool_util/parser/__init__.py | 1 + .../tool_util/parser/output_collection_def.py | 1 + lib/galaxy/tool_util/toolbox/base.py | 3 +- lib/galaxy/tool_util/toolbox/parser.py | 1 + lib/galaxy/tool_util/verify/interactor.py | 3 +- lib/galaxy/tools/__init__.py | 1 + lib/galaxy/tools/actions/__init__.py | 12 +++--- lib/galaxy/tools/error_reports/__init__.py | 1 + .../tools/error_reports/plugins/__init__.py | 1 + .../tools/error_reports/plugins/base_git.py | 1 - .../tools/error_reports/plugins/sentry.py | 1 + .../tools/error_reports/plugins/slack.py | 1 + lib/galaxy/tools/errors.py | 1 + lib/galaxy/tools/evaluation.py | 12 +++--- lib/galaxy/tools/execute.py | 1 + lib/galaxy/tools/parameters/basic.py | 10 ++--- .../tools/parameters/dynamic_options.py | 1 + lib/galaxy/tools/parameters/grouping.py | 1 + lib/galaxy/tools/parameters/sanitize.py | 1 + lib/galaxy/tools/parameters/validation.py | 1 + lib/galaxy/tools/repositories.py | 1 + lib/galaxy/tools/search/__init__.py | 1 + lib/galaxy/tours/_impl.py | 1 + lib/galaxy/util/__init__.py | 18 +++------ lib/galaxy/util/checkers.py | 3 +- lib/galaxy/util/commands.py | 1 + lib/galaxy/util/compression_utils.py | 28 ++++++------- lib/galaxy/util/config_parsers.py | 8 ++-- lib/galaxy/util/facts.py | 1 + lib/galaxy/util/filelock.py | 1 + lib/galaxy/util/oset.py | 1 + lib/galaxy/util/permutations.py | 1 + lib/galaxy/util/properties.py | 1 + lib/galaxy/util/renamed_temporary_file.py | 1 + lib/galaxy/util/resources.py | 1 + lib/galaxy/util/sanitize_html.py | 1 + lib/galaxy/util/script.py | 1 + lib/galaxy/util/simplegraph.py | 1 + .../visualization/data_providers/genome.py | 3 +- .../data_providers/phyloviz/__init__.py | 1 + lib/galaxy/visualization/plugins/plugin.py | 1 + lib/galaxy/visualization/plugins/registry.py | 1 + .../visualization/plugins/resource_parser.py | 1 + lib/galaxy/web/framework/base.py | 7 ++-- lib/galaxy/web/framework/helpers/__init__.py | 1 + lib/galaxy/web/framework/middleware/error.py | 3 -- .../web/framework/middleware/profile.py | 2 +- .../web/framework/middleware/remoteuser.py | 1 + .../web/framework/middleware/sqldebug.py | 1 + lib/galaxy/web_stack/gunicorn_config.py | 1 + lib/galaxy/webapps/base/controller.py | 1 + lib/galaxy/webapps/base/webapp.py | 1 + lib/galaxy/webapps/galaxy/api/__init__.py | 1 + lib/galaxy/webapps/galaxy/api/annotations.py | 1 + lib/galaxy/webapps/galaxy/api/authenticate.py | 1 + lib/galaxy/webapps/galaxy/api/cbv.py | 1 + lib/galaxy/webapps/galaxy/api/common.py | 1 + .../webapps/galaxy/api/configuration.py | 1 + .../galaxy/api/container_resolution.py | 1 + lib/galaxy/webapps/galaxy/api/datasets.py | 1 + lib/galaxy/webapps/galaxy/api/datatypes.py | 1 + .../galaxy/api/display_applications.py | 1 + lib/galaxy/webapps/galaxy/api/drs.py | 1 + .../webapps/galaxy/api/extended_metadata.py | 4 +- .../webapps/galaxy/api/folder_contents.py | 1 + lib/galaxy/webapps/galaxy/api/folders.py | 1 + lib/galaxy/webapps/galaxy/api/forms.py | 1 + lib/galaxy/webapps/galaxy/api/group_users.py | 1 + lib/galaxy/webapps/galaxy/api/groups.py | 1 + lib/galaxy/webapps/galaxy/api/histories.py | 1 + .../webapps/galaxy/api/history_contents.py | 1 + lib/galaxy/webapps/galaxy/api/item_tags.py | 1 + lib/galaxy/webapps/galaxy/api/job_files.py | 1 + lib/galaxy/webapps/galaxy/api/job_ports.py | 1 + lib/galaxy/webapps/galaxy/api/job_tokens.py | 1 + lib/galaxy/webapps/galaxy/api/libraries.py | 1 + .../webapps/galaxy/api/library_contents.py | 1 + .../webapps/galaxy/api/library_datasets.py | 1 + lib/galaxy/webapps/galaxy/api/metrics.py | 1 + lib/galaxy/webapps/galaxy/api/object_store.py | 1 + .../webapps/galaxy/api/page_revisions.py | 1 + lib/galaxy/webapps/galaxy/api/pages.py | 1 + lib/galaxy/webapps/galaxy/api/plugins.py | 1 + lib/galaxy/webapps/galaxy/api/provenance.py | 1 + lib/galaxy/webapps/galaxy/api/quotas.py | 1 + lib/galaxy/webapps/galaxy/api/remote_files.py | 1 + lib/galaxy/webapps/galaxy/api/roles.py | 1 + .../webapps/galaxy/api/sanitize_allow.py | 1 + .../webapps/galaxy/api/short_term_storage.py | 1 + .../webapps/galaxy/api/storage_cleaner.py | 1 + lib/galaxy/webapps/galaxy/api/tags.py | 1 + lib/galaxy/webapps/galaxy/api/tasks.py | 1 + .../webapps/galaxy/api/tool_dependencies.py | 1 + .../webapps/galaxy/api/tool_entry_points.py | 1 + lib/galaxy/webapps/galaxy/api/tours.py | 1 + lib/galaxy/webapps/galaxy/api/trs_consumer.py | 1 + lib/galaxy/webapps/galaxy/api/trs_search.py | 1 + lib/galaxy/webapps/galaxy/api/uploads.py | 1 + lib/galaxy/webapps/galaxy/api/users.py | 1 + .../webapps/galaxy/api/visualizations.py | 3 +- lib/galaxy/webapps/galaxy/api/webhooks.py | 1 + lib/galaxy/webapps/galaxy/api/workflows.py | 20 ++++++---- lib/galaxy/webapps/galaxy/buildapp.py | 1 + .../webapps/galaxy/controllers/authnz.py | 1 - lib/galaxy/webapps/galaxy/controllers/tag.py | 1 + .../webapps/galaxy/controllers/tool_runner.py | 1 + .../webapps/galaxy/services/datasets.py | 1 + .../webapps/galaxy/services/histories.py | 6 +-- .../galaxy/services/history_contents.py | 3 +- lib/galaxy/webapps/openapi/utils.py | 1 + lib/galaxy/webapps/reports/buildapp.py | 1 + lib/galaxy/webapps/reports/config.py | 1 + .../webapps/reports/controllers/jobs.py | 1 - .../webapps/reports/controllers/query.py | 1 + lib/galaxy/webhooks/__init__.py | 1 + lib/galaxy/workflow/extract.py | 1 + lib/galaxy/workflow/modules.py | 1 + .../workflow/reports/generators/__init__.py | 1 + .../workflow/reports/generators/markdown.py | 1 + lib/galaxy/workflow/resources/__init__.py | 1 + lib/galaxy/workflow/schedulers/__init__.py | 1 + lib/galaxy/workflow/schedulers/core.py | 1 + lib/galaxy/workflow/steps.py | 3 +- lib/galaxy_ext/expressions/handle_job.py | 1 + lib/galaxy_test/api/test_workflows_cwl.py | 1 + lib/galaxy_test/base/api_asserts.py | 1 + lib/galaxy_test/base/decorators.py | 1 + lib/galaxy_test/base/env.py | 1 + lib/galaxy_test/base/populators.py | 4 +- lib/galaxy_test/base/uses_shed_api.py | 3 +- lib/galaxy_test/driver/driver_util.py | 6 +-- lib/galaxy_test/driver/integration_setup.py | 1 + lib/galaxy_test/driver/integration_util.py | 1 + lib/galaxy_test/driver/uses_shed.py | 3 +- lib/galaxy_test/selenium/framework.py | 3 -- lib/galaxy_test/selenium/jupyter_context.py | 1 + lib/tool_shed/context.py | 18 +++------ lib/tool_shed/managers/groups.py | 1 + lib/tool_shed/managers/repositories.py | 1 + lib/tool_shed/repository_types/registry.py | 12 +++--- lib/tool_shed/webapp/api/authenticate.py | 1 + lib/tool_shed/webapp/api/configuration.py | 1 + lib/tool_shed/webapp/api/repositories.py | 18 ++++----- lib/tool_shed/webapp/buildapp.py | 1 + lib/tool_shed/webapp/config.py | 1 + .../webapp/controllers/repository.py | 26 ++++++------ .../webapp/framework/middleware/remoteuser.py | 1 + lib/tool_shed/webapp/model/mapping.py | 1 + lib/tool_shed/webapp/search/repo_search.py | 1 + lib/tool_shed/webapp/search/tool_search.py | 1 + lib/tool_shed/webapp/security/__init__.py | 1 + scripts/celery_shell.py | 1 + scripts/check_model.py | 1 + scripts/dump_library_paths.py | 1 + scripts/extract_dataset_part.py | 1 + scripts/manage_db.py | 1 + .../test_objectstore_datatype_upload.py | 1 + test/integration/oidc/test_auth_oidc.py | 1 + test/integration/test_cli_runners.py | 1 + test/integration/test_coexecution.py | 1 + test/integration/test_container_resolvers.py | 3 +- test/integration/test_data_manager.py | 1 - .../integration/test_data_manager_refgenie.py | 1 - test/integration/test_display_applications.py | 6 +-- test/integration/test_extended_metadata.py | 1 + test/integration/test_flush_per_n_datasets.py | 1 + test/integration/test_interactivetools_api.py | 1 + test/integration/test_job_files.py | 1 + test/integration/test_kubernetes_runner.py | 7 ++-- test/integration/test_max_discovered_files.py | 1 + .../test_remote_files_histories.py | 1 + .../integration/test_repository_operations.py | 1 - test/integration/test_resolvers.py | 2 +- test/integration/test_shed_tool_tests.py | 1 - test/integration/test_web_framework_config.py | 1 + test/integration/test_workflow_tasks.py | 1 + .../app/managers/test_CollectionManager.py | 2 +- test/unit/app/managers/test_DatasetManager.py | 1 + .../managers/test_HistoryContentsManager.py | 1 + test/unit/app/managers/test_UserManager.py | 1 + .../app/managers/test_markdown_to_html.py | 1 + test/unit/app/test_dbscript.py | 1 + test/unit/app/test_galaxy_install.py | 1 + .../tools/test_collect_primary_datasets.py | 12 +++--- test/unit/app/tools/test_column_parameters.py | 1 + test/unit/app/tools/test_execution.py | 1 + .../app/tools/test_tool_external_files.py | 1 + .../plugins/test_VisualizationPlugin.py | 1 + .../plugins/test_VisualizationsRegistry.py | 1 + .../dataproviders/test_base_dataproviders.py | 1 + .../dataproviders/test_line_dataproviders.py | 1 + test/unit/data/datatypes/test_data.py | 1 + ...e8a580bc79a_drop_sqlachemymigrate_table.py | 1 + .../62695fac6cc0_create_gxy_test_branch.py | 1 - .../db1/e02cef55763c_add_gxy_table3.py | 1 + .../db2/0e28bf2fb7b5_add_tsi_table3.py | 1 + .../1bceec30363a_create_tsi_test_branch.py | 1 - ...364ef1cab05_drop_sqlachemymigrate_table.py | 1 + .../data/model/test_mapping_testing_utils.py | 1 + test/unit/data/model/test_model_store.py | 1 + test/unit/files/_util.py | 1 + test/unit/util/test_lazy_process.py | 1 + test/unit/webapps/api/test_cbv.py | 1 + test/unit/webapps/test_webapp_base.py | 1 + tools/filters/sorter.py | 1 + 393 files changed, 553 insertions(+), 336 deletions(-) diff --git a/.flake8 b/.flake8 index 3e086e9d1287..d73f6bbb8412 100644 --- a/.flake8 +++ b/.flake8 @@ -4,7 +4,8 @@ # E203 is whitespace before ':'; we follow black's formatting here. See https://black.readthedocs.io/en/stable/faq.html#why-are-flake8-s-e203-and-w503-violated # E402 module level import not at top of file # TODO, we would like to improve this. # E501 is line length (delegated to black) +# E701,E704 are multiple statements on one line; we follow black's formatting here. See https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#configuration # W503 is line breaks before binary operators, which has been reversed in PEP 8. # D** are docstring linting - which we mostly ignore except D302. (Hopefully we will solve more over time). -ignore = B008,E203,E402,E501,W503,D100,D101,D102,D103,D104,D105,D106,D107,D200,D201,D202,D204,D205,D206,D207,D208,D209,D210,D211,D300,D301,D400,D401,D402,D403,D412,D413 +ignore = B008,E203,E402,E501,E701,E704,W503,D100,D101,D102,D103,D104,D105,D106,D107,D200,D201,D202,D204,D205,D206,D207,D208,D209,D210,D211,D300,D301,D400,D401,D402,D403,D412,D413 exclude = lib/tool_shed/test/test_data/repos diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 2d300c18a3cc..3174f6ceb5d7 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -55,6 +55,4 @@ jobs: - name: Run mypy checks run: tox -e mypy - uses: psf/black@stable - with: - version: "23.3.0" - uses: isort/isort-action@master diff --git a/lib/galaxy/actions/library.py b/lib/galaxy/actions/library.py index 32d555700166..5962474bbf20 100644 --- a/lib/galaxy/actions/library.py +++ b/lib/galaxy/actions/library.py @@ -1,6 +1,7 @@ """ Contains library functions """ + import json import logging import os.path diff --git a/lib/galaxy/app_unittest_utils/galaxy_mock.py b/lib/galaxy/app_unittest_utils/galaxy_mock.py index 9a9e21cbddcb..c33e3b433326 100644 --- a/lib/galaxy/app_unittest_utils/galaxy_mock.py +++ b/lib/galaxy/app_unittest_utils/galaxy_mock.py @@ -1,6 +1,7 @@ """ Mock infrastructure for testing ModelManagers. """ + import os import shutil import tempfile diff --git a/lib/galaxy/auth/__init__.py b/lib/galaxy/auth/__init__.py index 388e4ac2beb1..87bc7a43da20 100644 --- a/lib/galaxy/auth/__init__.py +++ b/lib/galaxy/auth/__init__.py @@ -1,6 +1,7 @@ """ Contains implementations of the authentication logic. """ + import logging from galaxy.auth.util import ( diff --git a/lib/galaxy/auth/providers/__init__.py b/lib/galaxy/auth/providers/__init__.py index 7e885fb07757..491a253c051f 100644 --- a/lib/galaxy/auth/providers/__init__.py +++ b/lib/galaxy/auth/providers/__init__.py @@ -3,6 +3,7 @@ @author: Andrew Robinson """ + import abc diff --git a/lib/galaxy/auth/providers/alwaysreject.py b/lib/galaxy/auth/providers/alwaysreject.py index 1c21adc834f7..e30d703d3b5c 100644 --- a/lib/galaxy/auth/providers/alwaysreject.py +++ b/lib/galaxy/auth/providers/alwaysreject.py @@ -3,6 +3,7 @@ @author: Andrew Robinson """ + import logging from . import AuthProvider diff --git a/lib/galaxy/auth/providers/ldap_ad.py b/lib/galaxy/auth/providers/ldap_ad.py index 9f540e489d90..259f30df9678 100644 --- a/lib/galaxy/auth/providers/ldap_ad.py +++ b/lib/galaxy/auth/providers/ldap_ad.py @@ -89,7 +89,6 @@ def _parse_ldap_options(options_unparsed): class LDAP(AuthProvider): - """ Attempts to authenticate users against an LDAP server. diff --git a/lib/galaxy/auth/providers/localdb.py b/lib/galaxy/auth/providers/localdb.py index bd5c765af20f..7e3e02bf2d1d 100644 --- a/lib/galaxy/auth/providers/localdb.py +++ b/lib/galaxy/auth/providers/localdb.py @@ -3,6 +3,7 @@ @author: Andrew Robinson """ + import logging from . import AuthProvider diff --git a/lib/galaxy/auth/providers/pam_auth.py b/lib/galaxy/auth/providers/pam_auth.py index 46819eaae30d..349d291d36dc 100644 --- a/lib/galaxy/auth/providers/pam_auth.py +++ b/lib/galaxy/auth/providers/pam_auth.py @@ -3,6 +3,7 @@ Author Peter van Heusden (pvh@sanbi.ac.za) """ + import logging import shlex diff --git a/lib/galaxy/config/__init__.py b/lib/galaxy/config/__init__.py index 18c920b92695..ff3ea85a5ae1 100644 --- a/lib/galaxy/config/__init__.py +++ b/lib/galaxy/config/__init__.py @@ -1,6 +1,7 @@ """ Universe configuration builder. """ + # absolute_import needed for tool_shed package. import configparser @@ -231,9 +232,9 @@ class BaseAppConfiguration(HasDynamicProperties): # If VALUE == first directory in a user-supplied path that resolves to KEY, it will be stripped from that path renamed_options: Optional[Dict[str, str]] = None deprecated_dirs: Dict[str, str] = {} - paths_to_check_against_root: Set[ - str - ] = set() # backward compatibility: if resolved path doesn't exist, try resolving w.r.t root + paths_to_check_against_root: Set[str] = ( + set() + ) # backward compatibility: if resolved path doesn't exist, try resolving w.r.t root add_sample_file_to_defaults: Set[str] = set() # for these options, add sample config files to their defaults listify_options: Set[str] = set() # values for these options are processed as lists of values object_store_store_by: str diff --git a/lib/galaxy/datatypes/anvio.py b/lib/galaxy/datatypes/anvio.py index f36cb6a96b57..a6feff14af5c 100644 --- a/lib/galaxy/datatypes/anvio.py +++ b/lib/galaxy/datatypes/anvio.py @@ -2,6 +2,7 @@ Datatypes for Anvi'o https://github.com/merenlab/anvio """ + import glob import logging import os diff --git a/lib/galaxy/datatypes/checkers.py b/lib/galaxy/datatypes/checkers.py index 600fecd8f18f..79b786c0cf57 100644 --- a/lib/galaxy/datatypes/checkers.py +++ b/lib/galaxy/datatypes/checkers.py @@ -2,6 +2,7 @@ External datatypes may make use of these functions. """ + from galaxy.util.checkers import ( check_binary, check_bz2, diff --git a/lib/galaxy/datatypes/constructive_solid_geometry.py b/lib/galaxy/datatypes/constructive_solid_geometry.py index e55c232dee34..da87ae493802 100644 --- a/lib/galaxy/datatypes/constructive_solid_geometry.py +++ b/lib/galaxy/datatypes/constructive_solid_geometry.py @@ -193,6 +193,7 @@ class Vtk: TODO: only legacy formats are currently supported and support for XML formats should be added. """ + subtype = "" # Add metadata elements. MetadataElement(name="vtk_version", default=None, desc="Vtk version", readonly=True, optional=True, visible=True) diff --git a/lib/galaxy/datatypes/converters/interval_to_fli.py b/lib/galaxy/datatypes/converters/interval_to_fli.py index fb2d13514606..c79dd9799955 100644 --- a/lib/galaxy/datatypes/converters/interval_to_fli.py +++ b/lib/galaxy/datatypes/converters/interval_to_fli.py @@ -13,6 +13,7 @@ and symbols are sorted in lexigraphical order. """ + import optparse from bx.tabular.io import ( diff --git a/lib/galaxy/datatypes/data.py b/lib/galaxy/datatypes/data.py index 5b4d92ed11cf..e169064d89b5 100644 --- a/lib/galaxy/datatypes/data.py +++ b/lib/galaxy/datatypes/data.py @@ -425,9 +425,9 @@ def _serve_raw( self, dataset: DatasetHasHidProtocol, to_ext: Optional[str], headers: Headers, **kwd ) -> Tuple[IO, Headers]: headers["Content-Length"] = str(os.stat(dataset.get_file_name()).st_size) - headers[ - "content-type" - ] = "application/octet-stream" # force octet-stream so Safari doesn't append mime extensions to filename + headers["content-type"] = ( + "application/octet-stream" # force octet-stream so Safari doesn't append mime extensions to filename + ) filename = self._download_filename( dataset, to_ext, @@ -476,9 +476,9 @@ def _serve_file_download(self, headers, data, trans, to_ext, file_size, **kwd): element_identifier=kwd.get("element_identifier"), filename_pattern=kwd.get("filename_pattern"), ) - headers[ - "content-type" - ] = "application/octet-stream" # force octet-stream so Safari doesn't append mime extensions to filename + headers["content-type"] = ( + "application/octet-stream" # force octet-stream so Safari doesn't append mime extensions to filename + ) headers["Content-Disposition"] = f'attachment; filename="{filename}"' return open(data.get_file_name(), "rb"), headers diff --git a/lib/galaxy/datatypes/dataproviders/base.py b/lib/galaxy/datatypes/dataproviders/base.py index 6b4949111f31..30f02eea525c 100644 --- a/lib/galaxy/datatypes/dataproviders/base.py +++ b/lib/galaxy/datatypes/dataproviders/base.py @@ -1,6 +1,7 @@ """ Base class(es) for all DataProviders. """ + # there's a blurry line between functionality here and functionality in datatypes module # attempting to keep parsing to a minimum here and focus on chopping/pagination/reformat(/filtering-maybe?) # and using as much pre-computed info/metadata from the datatypes module as possible diff --git a/lib/galaxy/datatypes/dataproviders/chunk.py b/lib/galaxy/datatypes/dataproviders/chunk.py index 66cd3540ac03..1ee5c54bcdbc 100644 --- a/lib/galaxy/datatypes/dataproviders/chunk.py +++ b/lib/galaxy/datatypes/dataproviders/chunk.py @@ -4,6 +4,7 @@ Primarily for file sources but usable by any iterator that has both seek and read( N ). """ + import base64 import logging import os diff --git a/lib/galaxy/datatypes/dataproviders/column.py b/lib/galaxy/datatypes/dataproviders/column.py index 34cee4b8d762..28ebffa4b014 100644 --- a/lib/galaxy/datatypes/dataproviders/column.py +++ b/lib/galaxy/datatypes/dataproviders/column.py @@ -2,6 +2,7 @@ Providers that provide lists of lists generally where each line of a source is further subdivided into multiple data (e.g. columns from a line). """ + import logging import re from urllib.parse import unquote_plus diff --git a/lib/galaxy/datatypes/dataproviders/dataset.py b/lib/galaxy/datatypes/dataproviders/dataset.py index ef235e168ea2..dfce2edef527 100644 --- a/lib/galaxy/datatypes/dataproviders/dataset.py +++ b/lib/galaxy/datatypes/dataproviders/dataset.py @@ -5,6 +5,7 @@ - or provide data in some way relevant to bioinformatic data (e.g. parsing genomic regions from their source) """ + import logging import sys diff --git a/lib/galaxy/datatypes/dataproviders/external.py b/lib/galaxy/datatypes/dataproviders/external.py index 412a3446c7e1..49d37236fd03 100644 --- a/lib/galaxy/datatypes/dataproviders/external.py +++ b/lib/galaxy/datatypes/dataproviders/external.py @@ -2,6 +2,7 @@ Data providers that iterate over a source that is not in memory or not in a file. """ + import gzip import logging import subprocess diff --git a/lib/galaxy/datatypes/dataproviders/hierarchy.py b/lib/galaxy/datatypes/dataproviders/hierarchy.py index 6ee9d5b992c4..215d67c38d96 100644 --- a/lib/galaxy/datatypes/dataproviders/hierarchy.py +++ b/lib/galaxy/datatypes/dataproviders/hierarchy.py @@ -1,6 +1,7 @@ """ Dataproviders that iterate over lines from their sources. """ + import logging from galaxy.util import ( diff --git a/lib/galaxy/datatypes/dataproviders/line.py b/lib/galaxy/datatypes/dataproviders/line.py index 560be0e9e0c8..d47215b58382 100644 --- a/lib/galaxy/datatypes/dataproviders/line.py +++ b/lib/galaxy/datatypes/dataproviders/line.py @@ -1,6 +1,7 @@ """ Dataproviders that iterate over lines from their sources. """ + import collections import logging import re diff --git a/lib/galaxy/datatypes/genetics.py b/lib/galaxy/datatypes/genetics.py index 1f825accc101..82fc5772040c 100644 --- a/lib/galaxy/datatypes/genetics.py +++ b/lib/galaxy/datatypes/genetics.py @@ -11,6 +11,7 @@ ross lazarus for rgenetics august 20 2007 """ + import logging import os import re diff --git a/lib/galaxy/datatypes/gis.py b/lib/galaxy/datatypes/gis.py index 7e148e6bf3a2..8904bc8f581a 100644 --- a/lib/galaxy/datatypes/gis.py +++ b/lib/galaxy/datatypes/gis.py @@ -1,6 +1,7 @@ """ GIS classes """ + from galaxy.datatypes.binary import Binary from galaxy.datatypes.protocols import ( DatasetProtocol, diff --git a/lib/galaxy/datatypes/goldenpath.py b/lib/galaxy/datatypes/goldenpath.py index 1347f21f7406..94ce38b547bd 100644 --- a/lib/galaxy/datatypes/goldenpath.py +++ b/lib/galaxy/datatypes/goldenpath.py @@ -365,7 +365,6 @@ def _validate_line(self): class AGPSeqLine(AGPLine): - """ A subclass of AGPLine specifically for AGP lines that represent sequences. """ @@ -462,7 +461,6 @@ def _validate_line(self): class AGPGapLine(AGPLine): - """ A subclass of AGPLine specifically for AGP lines that represent sequence gaps. """ diff --git a/lib/galaxy/datatypes/graph.py b/lib/galaxy/datatypes/graph.py index a623daadf269..b7f8488383bd 100644 --- a/lib/galaxy/datatypes/graph.py +++ b/lib/galaxy/datatypes/graph.py @@ -1,6 +1,7 @@ """ Graph content classes. """ + import logging from typing import List diff --git a/lib/galaxy/datatypes/hdf5.py b/lib/galaxy/datatypes/hdf5.py index 87e8a70d82d1..3f40b2a496a5 100644 --- a/lib/galaxy/datatypes/hdf5.py +++ b/lib/galaxy/datatypes/hdf5.py @@ -2,6 +2,7 @@ This datatype was created for use with the iSEE interactive tool. """ + from typing import Optional from galaxy.datatypes.data import Data diff --git a/lib/galaxy/datatypes/images.py b/lib/galaxy/datatypes/images.py index 9471efb193f8..3420b1be183a 100644 --- a/lib/galaxy/datatypes/images.py +++ b/lib/galaxy/datatypes/images.py @@ -1,6 +1,7 @@ """ Image classes """ + import base64 import json import logging diff --git a/lib/galaxy/datatypes/interval.py b/lib/galaxy/datatypes/interval.py index 56672f40832f..c36a822ac397 100644 --- a/lib/galaxy/datatypes/interval.py +++ b/lib/galaxy/datatypes/interval.py @@ -1,6 +1,7 @@ """ Interval datatypes """ + import logging import sys import tempfile diff --git a/lib/galaxy/datatypes/media.py b/lib/galaxy/datatypes/media.py index 2dd2b1a6a119..53b743485de5 100644 --- a/lib/galaxy/datatypes/media.py +++ b/lib/galaxy/datatypes/media.py @@ -1,4 +1,5 @@ """Video classes""" + import json import subprocess import wave diff --git a/lib/galaxy/datatypes/mothur.py b/lib/galaxy/datatypes/mothur.py index b47f8a271b41..f025b16805a6 100644 --- a/lib/galaxy/datatypes/mothur.py +++ b/lib/galaxy/datatypes/mothur.py @@ -1,6 +1,7 @@ """ Mothur Metagenomics Datatypes """ + import logging import re from typing import ( diff --git a/lib/galaxy/datatypes/neo4j.py b/lib/galaxy/datatypes/neo4j.py index c414ceb8b2bb..608b19c0d9c5 100644 --- a/lib/galaxy/datatypes/neo4j.py +++ b/lib/galaxy/datatypes/neo4j.py @@ -1,6 +1,7 @@ """ Neo4j Composite Dataset """ + import logging from galaxy.datatypes.data import Data diff --git a/lib/galaxy/datatypes/ngsindex.py b/lib/galaxy/datatypes/ngsindex.py index a423f2371ab6..41d59432fbbd 100644 --- a/lib/galaxy/datatypes/ngsindex.py +++ b/lib/galaxy/datatypes/ngsindex.py @@ -1,6 +1,7 @@ """ NGS indexes """ + import logging import os diff --git a/lib/galaxy/datatypes/phylip.py b/lib/galaxy/datatypes/phylip.py index 7a903bb5e6bc..0ae1066113a5 100644 --- a/lib/galaxy/datatypes/phylip.py +++ b/lib/galaxy/datatypes/phylip.py @@ -7,6 +7,7 @@ @githuborganization: C3BI Phylip datatype sniffer """ + from typing import TYPE_CHECKING from galaxy import util diff --git a/lib/galaxy/datatypes/proteomics.py b/lib/galaxy/datatypes/proteomics.py index f65c2eb5f1ad..d691e98f0bfc 100644 --- a/lib/galaxy/datatypes/proteomics.py +++ b/lib/galaxy/datatypes/proteomics.py @@ -1,6 +1,7 @@ """ Proteomics Datatypes """ + import logging import re from typing import ( diff --git a/lib/galaxy/datatypes/protocols.py b/lib/galaxy/datatypes/protocols.py index 150866a8adae..bbd702538b74 100644 --- a/lib/galaxy/datatypes/protocols.py +++ b/lib/galaxy/datatypes/protocols.py @@ -1,37 +1,33 @@ """ Location of protocols used in datatypes """ + from typing import Any from typing_extensions import Protocol class HasClearAssociatedFiles(Protocol): - def clear_associated_files(self, metadata_safe: bool = False, purge: bool = False) -> None: - ... + def clear_associated_files(self, metadata_safe: bool = False, purge: bool = False) -> None: ... class HasCreatingJob(Protocol): @property - def creating_job(self): - ... + def creating_job(self): ... class HasExt(Protocol): @property - def ext(self): - ... + def ext(self): ... class HasExtraFilesPath(Protocol): @property - def extra_files_path(self): - ... + def extra_files_path(self): ... class HasFileName(Protocol): - def get_file_name(self, sync_cache=True) -> str: - ... + def get_file_name(self, sync_cache=True) -> str: ... class HasHid(Protocol): @@ -54,8 +50,7 @@ class HasName(Protocol): name: str -class HasExtraFilesAndMetadata(HasExtraFilesPath, HasMetadata, Protocol): - ... +class HasExtraFilesAndMetadata(HasExtraFilesPath, HasMetadata, Protocol): ... class DatasetProtocol( @@ -78,24 +73,17 @@ class DatasetProtocol( states: Any @property - def datatype(self): - ... + def datatype(self): ... - def get_converted_files_by_type(self, file_type): - ... + def get_converted_files_by_type(self, file_type): ... - def get_mime(self) -> str: - ... + def get_mime(self) -> str: ... - def get_size(self) -> int: - ... + def get_size(self) -> int: ... - def has_data(self) -> bool: - ... + def has_data(self) -> bool: ... - def set_peek(self) -> None: - ... + def set_peek(self) -> None: ... -class DatasetHasHidProtocol(DatasetProtocol, HasHid, Protocol): - ... +class DatasetHasHidProtocol(DatasetProtocol, HasHid, Protocol): ... diff --git a/lib/galaxy/datatypes/qualityscore.py b/lib/galaxy/datatypes/qualityscore.py index 8876b1c62c03..4393317a049a 100644 --- a/lib/galaxy/datatypes/qualityscore.py +++ b/lib/galaxy/datatypes/qualityscore.py @@ -1,6 +1,7 @@ """ Qualityscore class """ + import logging from galaxy.datatypes.protocols import DatasetProtocol diff --git a/lib/galaxy/datatypes/registry.py b/lib/galaxy/datatypes/registry.py index 3072cedea933..f91eada60a4b 100644 --- a/lib/galaxy/datatypes/registry.py +++ b/lib/galaxy/datatypes/registry.py @@ -356,9 +356,9 @@ def __import_module(full_path: str, datatype_module: str): compressed_datatype_instance = compressed_datatype_class() self.datatypes_by_extension[compressed_extension] = compressed_datatype_instance for suffix in infer_from_suffixes: - self.datatypes_by_suffix_inferences[ - f"{suffix}.{auto_compressed_type}" - ] = compressed_datatype_instance + self.datatypes_by_suffix_inferences[f"{suffix}.{auto_compressed_type}"] = ( + compressed_datatype_instance + ) if display_in_upload and compressed_extension not in self.upload_file_formats: self.upload_file_formats.append(compressed_extension) self.datatype_info_dicts.append( diff --git a/lib/galaxy/datatypes/sniff.py b/lib/galaxy/datatypes/sniff.py index 6d65f4c36919..8a20f40e9167 100644 --- a/lib/galaxy/datatypes/sniff.py +++ b/lib/galaxy/datatypes/sniff.py @@ -91,8 +91,7 @@ class ConvertResult(NamedTuple): class ConvertFunction(Protocol): def __call__( self, fname: str, in_place: bool = True, tmp_dir: Optional[str] = None, tmp_prefix: Optional[str] = "gxupload" - ) -> ConvertResult: - ... + ) -> ConvertResult: ... def convert_newlines( diff --git a/lib/galaxy/datatypes/tracks.py b/lib/galaxy/datatypes/tracks.py index 370b67e27085..0fccbba26d15 100644 --- a/lib/galaxy/datatypes/tracks.py +++ b/lib/galaxy/datatypes/tracks.py @@ -1,6 +1,7 @@ """ Datatype classes for tracks/track views within galaxy. """ + import logging from galaxy.datatypes.protocols import ( diff --git a/lib/galaxy/datatypes/triples.py b/lib/galaxy/datatypes/triples.py index 51a20a5065fb..5f14858066a3 100644 --- a/lib/galaxy/datatypes/triples.py +++ b/lib/galaxy/datatypes/triples.py @@ -1,6 +1,7 @@ """ Triple format classes """ + import logging import re diff --git a/lib/galaxy/datatypes/util/gff_util.py b/lib/galaxy/datatypes/util/gff_util.py index d026d955e9f9..cc574831be05 100644 --- a/lib/galaxy/datatypes/util/gff_util.py +++ b/lib/galaxy/datatypes/util/gff_util.py @@ -1,6 +1,7 @@ """ Provides utilities for working with GFF files. """ + import copy from bx.intervals.io import ( diff --git a/lib/galaxy/datatypes/xml.py b/lib/galaxy/datatypes/xml.py index 37af68cc2378..a5148336bf80 100644 --- a/lib/galaxy/datatypes/xml.py +++ b/lib/galaxy/datatypes/xml.py @@ -1,6 +1,7 @@ """ XML format classes """ + import logging import re from typing import List diff --git a/lib/galaxy/dependencies/dev-requirements.txt b/lib/galaxy/dependencies/dev-requirements.txt index 90869973f737..c14df4985702 100644 --- a/lib/galaxy/dependencies/dev-requirements.txt +++ b/lib/galaxy/dependencies/dev-requirements.txt @@ -11,7 +11,7 @@ babel==2.14.0 ; python_version >= "3.8" and python_version < "3.13" backports-zoneinfo==0.2.1 ; python_version >= "3.8" and python_version < "3.9" backports-zoneinfo[tzdata]==0.2.1 ; python_version >= "3.8" and python_version < "3.9" billiard==4.2.0 ; python_version >= "3.8" and python_version < "3.13" -black==23.12.1 ; python_version >= "3.8" and python_version < "3.13" +black==24.1.1 ; python_version >= "3.8" and python_version < "3.13" build==1.0.3 ; python_version >= "3.8" and python_version < "3.13" cachecontrol[filecache]==0.13.1 ; python_version >= "3.8" and python_version < "3.13" celery==5.3.6 ; python_version >= "3.8" and python_version < "3.13" diff --git a/lib/galaxy/di.py b/lib/galaxy/di.py index 5f27b4e87170..b7c60b46e09d 100644 --- a/lib/galaxy/di.py +++ b/lib/galaxy/di.py @@ -1,4 +1,5 @@ """Dependency injection framework for Galaxy-type apps.""" + from typing import ( Optional, Type, diff --git a/lib/galaxy/exceptions/error_codes.py b/lib/galaxy/exceptions/error_codes.py index e91739c09bbf..31a8de485de5 100644 --- a/lib/galaxy/exceptions/error_codes.py +++ b/lib/galaxy/exceptions/error_codes.py @@ -2,6 +2,7 @@ See the file error_codes.json for actual error code descriptions. """ + from json import loads from typing import Dict diff --git a/lib/galaxy/forms/forms.py b/lib/galaxy/forms/forms.py index ce8a1c2580fa..b01d5c34c73f 100644 --- a/lib/galaxy/forms/forms.py +++ b/lib/galaxy/forms/forms.py @@ -1,6 +1,7 @@ """ FormDefinition and field factories """ + # TODO: A FormDefinitionField is closely linked to a form_builder result. # Can this functionality be further abstracted and merged with form_builder? from galaxy.model import ( diff --git a/lib/galaxy/job_execution/actions/post.py b/lib/galaxy/job_execution/actions/post.py index 0ce006d35492..946123d674a9 100644 --- a/lib/galaxy/job_execution/actions/post.py +++ b/lib/galaxy/job_execution/actions/post.py @@ -2,6 +2,7 @@ Actions to be run at job completion (or output hda creation, as in the case of immediate_actions listed below. """ + import datetime from markupsafe import escape diff --git a/lib/galaxy/job_execution/datasets.py b/lib/galaxy/job_execution/datasets.py index 3199f63ce24a..69ed7a902246 100644 --- a/lib/galaxy/job_execution/datasets.py +++ b/lib/galaxy/job_execution/datasets.py @@ -1,6 +1,7 @@ """ Utility classes allowing Job interface to reason about datasets. """ + import os.path from abc import ( ABCMeta, diff --git a/lib/galaxy/job_execution/output_collect.py b/lib/galaxy/job_execution/output_collect.py index 41cbc394f9b9..aa502d4275e7 100644 --- a/lib/galaxy/job_execution/output_collect.py +++ b/lib/galaxy/job_execution/output_collect.py @@ -1,5 +1,6 @@ """ Code allowing tools to define extra files associated with an output datset. """ + import logging import operator import os diff --git a/lib/galaxy/job_execution/setup.py b/lib/galaxy/job_execution/setup.py index 1cff9c37c532..934dd528e74a 100644 --- a/lib/galaxy/job_execution/setup.py +++ b/lib/galaxy/job_execution/setup.py @@ -1,4 +1,5 @@ """Utilities to help job and tool code setup jobs.""" + import json import os import threading diff --git a/lib/galaxy/job_metrics/__init__.py b/lib/galaxy/job_metrics/__init__.py index 2b1c5399bd20..0a315ffdf31d 100644 --- a/lib/galaxy/job_metrics/__init__.py +++ b/lib/galaxy/job_metrics/__init__.py @@ -10,6 +10,7 @@ of shell code into a job scripts (before and after tool commands run) and then collect the output of these from a job directory. """ + import collections import logging import os diff --git a/lib/galaxy/job_metrics/formatting.py b/lib/galaxy/job_metrics/formatting.py index 1b89548ffa1a..b37de650f96f 100644 --- a/lib/galaxy/job_metrics/formatting.py +++ b/lib/galaxy/job_metrics/formatting.py @@ -1,4 +1,5 @@ """Utilities related to formatting job metrics for human consumption.""" + from typing import ( Any, NamedTuple, diff --git a/lib/galaxy/job_metrics/instrumenters/__init__.py b/lib/galaxy/job_metrics/instrumenters/__init__.py index cac587d60b4c..b546e38c16fc 100644 --- a/lib/galaxy/job_metrics/instrumenters/__init__.py +++ b/lib/galaxy/job_metrics/instrumenters/__init__.py @@ -2,6 +2,7 @@ These are responsible for collecting and formatting a coherent set of metrics. """ + import os.path from abc import ( ABCMeta, diff --git a/lib/galaxy/job_metrics/instrumenters/cgroup.py b/lib/galaxy/job_metrics/instrumenters/cgroup.py index f55f66a8a01a..62caef9c81dc 100644 --- a/lib/galaxy/job_metrics/instrumenters/cgroup.py +++ b/lib/galaxy/job_metrics/instrumenters/cgroup.py @@ -1,4 +1,5 @@ """The module describes the ``cgroup`` job metrics plugin.""" + import decimal import logging import numbers diff --git a/lib/galaxy/job_metrics/instrumenters/core.py b/lib/galaxy/job_metrics/instrumenters/core.py index f449c5b29a9f..a08ad8f8de5e 100644 --- a/lib/galaxy/job_metrics/instrumenters/core.py +++ b/lib/galaxy/job_metrics/instrumenters/core.py @@ -1,4 +1,5 @@ """The module describes the ``core`` job metrics plugin.""" + import logging import time from typing import ( diff --git a/lib/galaxy/job_metrics/instrumenters/cpuinfo.py b/lib/galaxy/job_metrics/instrumenters/cpuinfo.py index 5d806a4e9894..5d723ccf0588 100644 --- a/lib/galaxy/job_metrics/instrumenters/cpuinfo.py +++ b/lib/galaxy/job_metrics/instrumenters/cpuinfo.py @@ -1,4 +1,5 @@ """The module describes the ``cpuinfo`` job metrics plugin.""" + import logging import re from typing import Any diff --git a/lib/galaxy/job_metrics/instrumenters/env.py b/lib/galaxy/job_metrics/instrumenters/env.py index d08b5c90a784..04608833e83f 100644 --- a/lib/galaxy/job_metrics/instrumenters/env.py +++ b/lib/galaxy/job_metrics/instrumenters/env.py @@ -1,4 +1,5 @@ """The module describes the ``env`` job metrics plugin.""" + import logging import re from typing import ( diff --git a/lib/galaxy/job_metrics/instrumenters/hostname.py b/lib/galaxy/job_metrics/instrumenters/hostname.py index 813c44297acb..721fa1aca419 100644 --- a/lib/galaxy/job_metrics/instrumenters/hostname.py +++ b/lib/galaxy/job_metrics/instrumenters/hostname.py @@ -1,4 +1,5 @@ """The module describes the ``hostname`` job metrics plugin.""" + import logging from . import InstrumentPlugin diff --git a/lib/galaxy/job_metrics/instrumenters/meminfo.py b/lib/galaxy/job_metrics/instrumenters/meminfo.py index d6da041b0a80..80e523d97308 100644 --- a/lib/galaxy/job_metrics/instrumenters/meminfo.py +++ b/lib/galaxy/job_metrics/instrumenters/meminfo.py @@ -1,4 +1,5 @@ """The module describes the ``meminfo`` job metrics plugin.""" + import re from galaxy import util diff --git a/lib/galaxy/job_metrics/instrumenters/uname.py b/lib/galaxy/job_metrics/instrumenters/uname.py index b4f96434d6e4..2ca2854837c8 100644 --- a/lib/galaxy/job_metrics/instrumenters/uname.py +++ b/lib/galaxy/job_metrics/instrumenters/uname.py @@ -1,4 +1,5 @@ """The module describes the ``uname`` job metrics plugin.""" + from . import InstrumentPlugin from .. import formatting diff --git a/lib/galaxy/jobs/__init__.py b/lib/galaxy/jobs/__init__.py index 6ae85cb7e34f..63f700624efd 100644 --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -1,6 +1,7 @@ """ Support for running a tool in Galaxy via an internal job management system """ + import copy import datetime import errno diff --git a/lib/galaxy/jobs/handler.py b/lib/galaxy/jobs/handler.py index 644f1153809b..523b238d88e1 100644 --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -1,6 +1,7 @@ """ Galaxy job handler, prepares, runs, tracks, and finishes Galaxy jobs """ + import datetime import os import time diff --git a/lib/galaxy/jobs/manager.py b/lib/galaxy/jobs/manager.py index 614ea68d0547..569828a4dd48 100644 --- a/lib/galaxy/jobs/manager.py +++ b/lib/galaxy/jobs/manager.py @@ -1,6 +1,7 @@ """ Top-level Galaxy job manager, moves jobs to handler(s) """ + import logging from functools import partial diff --git a/lib/galaxy/jobs/runners/__init__.py b/lib/galaxy/jobs/runners/__init__.py index 1cecde7b7a08..27d122eb2b4a 100644 --- a/lib/galaxy/jobs/runners/__init__.py +++ b/lib/galaxy/jobs/runners/__init__.py @@ -1,6 +1,7 @@ """ Base classes for job runner plugins. """ + import datetime import os import string diff --git a/lib/galaxy/jobs/runners/aws.py b/lib/galaxy/jobs/runners/aws.py index fa24add37e45..ab42b38da0e8 100644 --- a/lib/galaxy/jobs/runners/aws.py +++ b/lib/galaxy/jobs/runners/aws.py @@ -1,5 +1,6 @@ """ Galaxy job runners to use Amazon AWS native compute resources, such as AWS Batch. """ + import bisect import hashlib import json diff --git a/lib/galaxy/jobs/runners/condor.py b/lib/galaxy/jobs/runners/condor.py index 31561b7b219d..629d165f5625 100644 --- a/lib/galaxy/jobs/runners/condor.py +++ b/lib/galaxy/jobs/runners/condor.py @@ -10,6 +10,7 @@ have been written to target that framework, but we don't have the bandwidth to rewrite it at this time. """ + import logging import os import subprocess diff --git a/lib/galaxy/jobs/runners/local.py b/lib/galaxy/jobs/runners/local.py index d70768f8b856..98438a155ef6 100644 --- a/lib/galaxy/jobs/runners/local.py +++ b/lib/galaxy/jobs/runners/local.py @@ -1,6 +1,7 @@ """ Job runner plugin for executing jobs on the local system via the command line. """ + import datetime import logging import os diff --git a/lib/galaxy/jobs/runners/pulsar.py b/lib/galaxy/jobs/runners/pulsar.py index 76284a5fb00f..45128847f55a 100644 --- a/lib/galaxy/jobs/runners/pulsar.py +++ b/lib/galaxy/jobs/runners/pulsar.py @@ -2,6 +2,7 @@ More information on Pulsar can be found at https://pulsar.readthedocs.io/ . """ + import copy import errno import logging diff --git a/lib/galaxy/jobs/runners/slurm.py b/lib/galaxy/jobs/runners/slurm.py index 6daa65512d52..2c0ab4af6b59 100644 --- a/lib/galaxy/jobs/runners/slurm.py +++ b/lib/galaxy/jobs/runners/slurm.py @@ -1,6 +1,7 @@ """ SLURM job control via the DRMAA API. """ + import os import time diff --git a/lib/galaxy/jobs/runners/univa.py b/lib/galaxy/jobs/runners/univa.py index 3e3455c75e52..12cf317db4f5 100644 --- a/lib/galaxy/jobs/runners/univa.py +++ b/lib/galaxy/jobs/runners/univa.py @@ -28,6 +28,7 @@ cases 10. * The sheduler logs contains quite useful information. """ + import logging import re import signal diff --git a/lib/galaxy/jobs/runners/util/__init__.py b/lib/galaxy/jobs/runners/util/__init__.py index 4aa4cce543e6..b8178a4aa5bd 100644 --- a/lib/galaxy/jobs/runners/util/__init__.py +++ b/lib/galaxy/jobs/runners/util/__init__.py @@ -3,6 +3,7 @@ processes and interfacing with job managers. This module should contain functionality shared between Galaxy and the Pulsar. """ + from galaxy.util.bunch import Bunch from .kill import kill_pid diff --git a/lib/galaxy/jobs/runners/util/cli/__init__.py b/lib/galaxy/jobs/runners/util/cli/__init__.py index 9b677bea0a8e..9919eccdd247 100644 --- a/lib/galaxy/jobs/runners/util/cli/__init__.py +++ b/lib/galaxy/jobs/runners/util/cli/__init__.py @@ -1,5 +1,6 @@ """ """ + import json from galaxy.util.plugin_config import plugins_dict diff --git a/lib/galaxy/jobs/runners/util/cli/job/__init__.py b/lib/galaxy/jobs/runners/util/cli/job/__init__.py index 2556df5d2aec..8dc7444fa23d 100644 --- a/lib/galaxy/jobs/runners/util/cli/job/__init__.py +++ b/lib/galaxy/jobs/runners/util/cli/job/__init__.py @@ -1,6 +1,7 @@ """ Abstract base class for cli job plugins. """ + from abc import ( ABCMeta, abstractmethod, diff --git a/lib/galaxy/jobs/runners/util/cli/shell/__init__.py b/lib/galaxy/jobs/runners/util/cli/shell/__init__.py index 4b7d3a3377c1..fe260ad01ac7 100644 --- a/lib/galaxy/jobs/runners/util/cli/shell/__init__.py +++ b/lib/galaxy/jobs/runners/util/cli/shell/__init__.py @@ -1,6 +1,7 @@ """ Abstract base class for runners which execute commands via a shell. """ + from abc import ( ABCMeta, abstractmethod, diff --git a/lib/galaxy/jobs/runners/util/condor/__init__.py b/lib/galaxy/jobs/runners/util/condor/__init__.py index c608d13e9caa..a60e2df92dab 100644 --- a/lib/galaxy/jobs/runners/util/condor/__init__.py +++ b/lib/galaxy/jobs/runners/util/condor/__init__.py @@ -1,6 +1,7 @@ """ Condor helper utilities. """ + from subprocess import ( CalledProcessError, check_call, diff --git a/lib/galaxy/jobs/runners/util/pykube_util.py b/lib/galaxy/jobs/runners/util/pykube_util.py index 28020a8c8dde..699df65398ac 100644 --- a/lib/galaxy/jobs/runners/util/pykube_util.py +++ b/lib/galaxy/jobs/runners/util/pykube_util.py @@ -1,4 +1,5 @@ """Interface layer for pykube library shared between Galaxy and Pulsar.""" + import logging import os import re diff --git a/lib/galaxy/main_config.py b/lib/galaxy/main_config.py index d0b3d949068c..1db053323223 100644 --- a/lib/galaxy/main_config.py +++ b/lib/galaxy/main_config.py @@ -2,6 +2,7 @@ This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py). """ + import os from typing import ( List, diff --git a/lib/galaxy/managers/annotatable.py b/lib/galaxy/managers/annotatable.py index 38552fe6bb86..4a0ad04ab2ea 100644 --- a/lib/galaxy/managers/annotatable.py +++ b/lib/galaxy/managers/annotatable.py @@ -39,8 +39,7 @@ class AnnotatableManagerMixin: annotation_assoc: type @abc.abstractmethod - def session(self) -> scoped_session: - ... + def session(self) -> scoped_session: ... def annotation(self, item) -> Optional[str]: """ diff --git a/lib/galaxy/managers/base.py b/lib/galaxy/managers/base.py index 3ac563cdafa7..c151852ee054 100644 --- a/lib/galaxy/managers/base.py +++ b/lib/galaxy/managers/base.py @@ -21,6 +21,7 @@ ModelDeserializers control how a model validates and process an incoming attribute change to a model object. """ + # TODO: it may be there's a better way to combine the above three classes # such as: a single flat class, serializers being singletons in the manager, etc. # instead of the three separate classes. With no 'apparent' perfect scheme @@ -594,8 +595,7 @@ class SkipAttribute(Exception): class Serializer(Protocol): - def __call__(self, item: Any, key: str, **context) -> Any: - ... + def __call__(self, item: Any, key: str, **context) -> Any: ... # TODO: eventually all urls should be generated by the url builder and this can be safely removed. @@ -883,8 +883,7 @@ def genome_build(key: str, val: Any) -> str: class Deserializer(Protocol): - def __call__(self, item: Any, key: Any, val: Any, **kwargs) -> Any: - ... + def __call__(self, item: Any, key: Any, val: Any, **kwargs) -> Any: ... class ModelDeserializer(HasAModelManager[T]): diff --git a/lib/galaxy/managers/cloudauthzs.py b/lib/galaxy/managers/cloudauthzs.py index 43696ea209ca..bf4e0aa4caa2 100644 --- a/lib/galaxy/managers/cloudauthzs.py +++ b/lib/galaxy/managers/cloudauthzs.py @@ -61,9 +61,9 @@ def add_serializers(self): "user_id": lambda item, key, **context: self.app.security.encode_id(item.user_id), "provider": lambda item, key, **context: str(item.provider), "config": lambda item, key, **context: item.config, - "authn_id": lambda item, key, **context: self.app.security.encode_id(item.authn_id) - if item.authn_id - else None, + "authn_id": lambda item, key, **context: ( + self.app.security.encode_id(item.authn_id) if item.authn_id else None + ), "last_update": lambda item, key, **context: str(item.last_update), "last_activity": lambda item, key, **context: str(item.last_activity), "create_time": lambda item, key, **context: item.create_time.isoformat(), diff --git a/lib/galaxy/managers/collections.py b/lib/galaxy/managers/collections.py index f4af990ffe9c..8db9037b55a5 100644 --- a/lib/galaxy/managers/collections.py +++ b/lib/galaxy/managers/collections.py @@ -671,14 +671,12 @@ def match_collections(self, collections_to_match): @overload def get_dataset_collection_instance( self, trans: ProvidesHistoryContext, instance_type: Literal["history"], id, **kwds: Any - ) -> model.HistoryDatasetCollectionAssociation: - ... + ) -> model.HistoryDatasetCollectionAssociation: ... @overload def get_dataset_collection_instance( self, trans: ProvidesHistoryContext, instance_type: Literal["library"], id, **kwds: Any - ) -> model.LibraryDatasetCollectionAssociation: - ... + ) -> model.LibraryDatasetCollectionAssociation: ... def get_dataset_collection_instance( self, trans: ProvidesHistoryContext, instance_type: DatasetCollectionInstanceType, id, **kwds: Any diff --git a/lib/galaxy/managers/configuration.py b/lib/galaxy/managers/configuration.py index 14fe088c376e..d15b2d941d75 100644 --- a/lib/galaxy/managers/configuration.py +++ b/lib/galaxy/managers/configuration.py @@ -4,6 +4,7 @@ Used by both the API and bootstrapped data. """ + import logging import sys from typing import ( diff --git a/lib/galaxy/managers/context.py b/lib/galaxy/managers/context.py index 23caedf81e66..24c29567a80b 100644 --- a/lib/galaxy/managers/context.py +++ b/lib/galaxy/managers/context.py @@ -28,6 +28,7 @@ A method that requires a user but not a history should declare its ``trans`` argument as requiring type :class:`galaxy.managers.context.ProvidesUserContext`. """ + # TODO: Refactor this class so that galaxy.managers depends on a package # containing this. # TODO: Provide different classes for real users and potentially bootstrapped diff --git a/lib/galaxy/managers/datasets.py b/lib/galaxy/managers/datasets.py index f97bbfbbbecd..78a43cff099b 100644 --- a/lib/galaxy/managers/datasets.py +++ b/lib/galaxy/managers/datasets.py @@ -1,6 +1,7 @@ """ Manager and Serializer for Datasets. """ + import glob import logging import os diff --git a/lib/galaxy/managers/dbkeys.py b/lib/galaxy/managers/dbkeys.py index 92726675fed2..8ec01e3d57bd 100644 --- a/lib/galaxy/managers/dbkeys.py +++ b/lib/galaxy/managers/dbkeys.py @@ -1,6 +1,7 @@ """ Functionality for dealing with dbkeys. """ + import logging import os.path import re diff --git a/lib/galaxy/managers/deletable.py b/lib/galaxy/managers/deletable.py index cbfa49eabece..113cfa22dc99 100644 --- a/lib/galaxy/managers/deletable.py +++ b/lib/galaxy/managers/deletable.py @@ -8,6 +8,7 @@ the supporting resources as well. These models also have the boolean attribute 'purged'. """ + from typing import ( Any, Dict, @@ -32,8 +33,7 @@ class DeletableManagerMixin: removed by an admin/script. """ - def _session_setattr(self, item: Base, attr: str, val: Any, flush: bool = True): - ... + def _session_setattr(self, item: Base, attr: str, val: Any, flush: bool = True): ... def delete(self, item, flush=True, **kwargs): """ @@ -91,8 +91,7 @@ class PurgableManagerMixin(DeletableManagerMixin): file). """ - def _session_setattr(self, item: Base, attr: str, val: Any, flush: bool = True): - ... + def _session_setattr(self, item: Base, attr: str, val: Any, flush: bool = True): ... def purge(self, item, flush=True, **kwargs): """ diff --git a/lib/galaxy/managers/executables.py b/lib/galaxy/managers/executables.py index 392c2a650e1e..0993b32856b1 100644 --- a/lib/galaxy/managers/executables.py +++ b/lib/galaxy/managers/executables.py @@ -1,4 +1,5 @@ """Utilities for loading tools and workflows from paths for admin user requests.""" + from typing import ( Any, Dict, diff --git a/lib/galaxy/managers/folders.py b/lib/galaxy/managers/folders.py index 66b92a4b6efc..97f0f3ad4cac 100644 --- a/lib/galaxy/managers/folders.py +++ b/lib/galaxy/managers/folders.py @@ -1,6 +1,7 @@ """ Manager and Serializer for Library Folders. """ + import logging from dataclasses import dataclass from typing import ( diff --git a/lib/galaxy/managers/hdas.py b/lib/galaxy/managers/hdas.py index 980cb75ec516..6f574b96ab60 100644 --- a/lib/galaxy/managers/hdas.py +++ b/lib/galaxy/managers/hdas.py @@ -4,6 +4,7 @@ HistoryDatasetAssociations (HDAs) are datasets contained or created in a history. """ + import gettext import logging import os diff --git a/lib/galaxy/managers/hdcas.py b/lib/galaxy/managers/hdcas.py index 9e38c053c77c..eca83e75c93e 100644 --- a/lib/galaxy/managers/hdcas.py +++ b/lib/galaxy/managers/hdcas.py @@ -4,6 +4,7 @@ HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a history. """ + import logging from typing import Dict diff --git a/lib/galaxy/managers/histories.py b/lib/galaxy/managers/histories.py index 11274e4580a4..289878d522e2 100644 --- a/lib/galaxy/managers/histories.py +++ b/lib/galaxy/managers/histories.py @@ -4,6 +4,7 @@ Histories are containers for datasets or dataset collections created (or copied) by users over the course of an analysis. """ + import logging from typing import ( Any, @@ -853,9 +854,9 @@ def add_serializers(self): "contents_active": self.serialize_contents_active, # TODO: Use base manager's serialize_id for user_id (and others) # after refactoring hierarchy here? - "user_id": lambda item, key, encode_id=True, **context: self.app.security.encode_id(item.user_id) - if item.user_id is not None and encode_id - else item.user_id, + "user_id": lambda item, key, encode_id=True, **context: ( + self.app.security.encode_id(item.user_id) if item.user_id is not None and encode_id else item.user_id + ), } self.serializers.update(serializers) diff --git a/lib/galaxy/managers/history_contents.py b/lib/galaxy/managers/history_contents.py index 5888dad41949..abd1a6508085 100644 --- a/lib/galaxy/managers/history_contents.py +++ b/lib/galaxy/managers/history_contents.py @@ -2,6 +2,7 @@ Heterogenous lists/contents are difficult to query properly since unions are not easily made. """ + import json import logging from typing import ( diff --git a/lib/galaxy/managers/libraries.py b/lib/galaxy/managers/libraries.py index 28d96aa3ca47..45c1c582a074 100644 --- a/lib/galaxy/managers/libraries.py +++ b/lib/galaxy/managers/libraries.py @@ -1,6 +1,7 @@ """ Manager and Serializer for libraries. """ + import logging from typing import ( Dict, diff --git a/lib/galaxy/managers/library_datasets.py b/lib/galaxy/managers/library_datasets.py index e91312c2792e..3666838b2bb0 100644 --- a/lib/galaxy/managers/library_datasets.py +++ b/lib/galaxy/managers/library_datasets.py @@ -1,4 +1,5 @@ """Manager and Serializer for library datasets.""" + import logging from sqlalchemy import select diff --git a/lib/galaxy/managers/markdown_parse.py b/lib/galaxy/managers/markdown_parse.py index a0931a73485a..ab52141fa4e2 100644 --- a/lib/galaxy/managers/markdown_parse.py +++ b/lib/galaxy/managers/markdown_parse.py @@ -5,6 +5,7 @@ Galaxy Markdown. Keeping things isolated to allow re-use of these utilities in other projects (e.g. gxformat2). """ + import re from typing import ( cast, diff --git a/lib/galaxy/managers/markdown_util.py b/lib/galaxy/managers/markdown_util.py index 8b5aac2fdf70..2827487de1f0 100644 --- a/lib/galaxy/managers/markdown_util.py +++ b/lib/galaxy/managers/markdown_util.py @@ -10,6 +10,7 @@ second idea is unimplemented, it is just an example of the general concept of context specific processing. """ + import abc import base64 import codecs diff --git a/lib/galaxy/managers/pages.py b/lib/galaxy/managers/pages.py index 72eb50fb6775..3157b026a4dd 100644 --- a/lib/galaxy/managers/pages.py +++ b/lib/galaxy/managers/pages.py @@ -5,6 +5,7 @@ (such as datasets) and are often used to describe or present an analysis from within Galaxy. """ + import logging import re from html.entities import name2codepoint diff --git a/lib/galaxy/managers/quotas.py b/lib/galaxy/managers/quotas.py index 72045d1cc513..31e7fcc48e6d 100644 --- a/lib/galaxy/managers/quotas.py +++ b/lib/galaxy/managers/quotas.py @@ -3,6 +3,7 @@ For more information about quotas: https://galaxyproject.org/admin/disk-quotas/ """ + import logging from typing import ( cast, diff --git a/lib/galaxy/managers/ratable.py b/lib/galaxy/managers/ratable.py index daf02c9a049f..2acc148a6b95 100644 --- a/lib/galaxy/managers/ratable.py +++ b/lib/galaxy/managers/ratable.py @@ -1,6 +1,7 @@ """ Mixins for Ratable model managers and serializers. """ + import logging from typing import Type diff --git a/lib/galaxy/managers/roles.py b/lib/galaxy/managers/roles.py index ecb221cc8044..a24f6d456ff2 100644 --- a/lib/galaxy/managers/roles.py +++ b/lib/galaxy/managers/roles.py @@ -1,6 +1,7 @@ """ Manager and Serializer for Roles. """ + import logging from typing import List diff --git a/lib/galaxy/managers/secured.py b/lib/galaxy/managers/secured.py index 27815feaa850..30958ceb8c92 100644 --- a/lib/galaxy/managers/secured.py +++ b/lib/galaxy/managers/secured.py @@ -3,6 +3,7 @@ Owned models can be modified and deleted. """ + from typing import ( Any, Optional, @@ -29,8 +30,7 @@ class AccessibleManagerMixin: # declare what we are using from base ModelManager model_class: Type[Any] - def by_id(self, id: int): - ... + def by_id(self, id: int): ... # don't want to override by_id since consumers will also want to fetch w/o any security checks def is_accessible(self, item: "Query", user: model.User, **kwargs: Any) -> bool: @@ -96,8 +96,7 @@ class OwnableManagerMixin: # declare what we are using from base ModelManager model_class: Type[Any] - def by_id(self, id: int): - ... + def by_id(self, id: int): ... def is_owner(self, item: model.Base, user: Optional[model.User], **kwargs: Any) -> bool: """ diff --git a/lib/galaxy/managers/sharable.py b/lib/galaxy/managers/sharable.py index e1a0f55d9973..0d106a9ae1b7 100644 --- a/lib/galaxy/managers/sharable.py +++ b/lib/galaxy/managers/sharable.py @@ -9,6 +9,7 @@ can be published effectively making it available to all other Users can be rated """ + import logging import re from typing import ( diff --git a/lib/galaxy/managers/users.py b/lib/galaxy/managers/users.py index 005cdb27fd67..f4786c41bce1 100644 --- a/lib/galaxy/managers/users.py +++ b/lib/galaxy/managers/users.py @@ -1,6 +1,7 @@ """ Manager and Serializer for Users. """ + import hashlib import logging import random diff --git a/lib/galaxy/managers/visualizations.py b/lib/galaxy/managers/visualizations.py index ef48eb383d7b..9aa2808f147f 100644 --- a/lib/galaxy/managers/visualizations.py +++ b/lib/galaxy/managers/visualizations.py @@ -4,6 +4,7 @@ Visualizations are saved configurations/variables used to reproduce a specific view in a Galaxy visualization. """ + import logging from typing import ( Dict, diff --git a/lib/galaxy/managers/workflows.py b/lib/galaxy/managers/workflows.py index 2bd7c95e6add..c8dc8c4699f1 100644 --- a/lib/galaxy/managers/workflows.py +++ b/lib/galaxy/managers/workflows.py @@ -1267,9 +1267,9 @@ def callback(input, prefixed_name, **kwargs): step_dict["workflow_outputs"] = outputs if len(output_label_duplicate) > 0: output_label_duplicate_string = ", ".join(output_label_duplicate) - upgrade_message_dict[ - "output_label_duplicate" - ] = f"Ignoring duplicate labels: {output_label_duplicate_string}." + upgrade_message_dict["output_label_duplicate"] = ( + f"Ignoring duplicate labels: {output_label_duplicate_string}." + ) if upgrade_message_dict: data["upgrade_messages"][step.order_index] = upgrade_message_dict diff --git a/lib/galaxy/metadata/__init__.py b/lib/galaxy/metadata/__init__.py index 5e6896e40402..8e6a9bb83fdd 100644 --- a/lib/galaxy/metadata/__init__.py +++ b/lib/galaxy/metadata/__init__.py @@ -190,9 +190,11 @@ def _metadata_path(what): "validate": validate_outputs, "object_store_store_by": dataset.dataset.store_by, "id": dataset.id, - "model_class": "LibraryDatasetDatasetAssociation" - if isinstance(dataset, galaxy.model.LibraryDatasetDatasetAssociation) - else "HistoryDatasetAssociation", + "model_class": ( + "LibraryDatasetDatasetAssociation" + if isinstance(dataset, galaxy.model.LibraryDatasetDatasetAssociation) + else "HistoryDatasetAssociation" + ), } metadata_params_path = os.path.join(metadata_dir, "params.json") diff --git a/lib/galaxy/metadata/set_metadata.py b/lib/galaxy/metadata/set_metadata.py index 90549c6ddf6b..8c36bf70a1d9 100644 --- a/lib/galaxy/metadata/set_metadata.py +++ b/lib/galaxy/metadata/set_metadata.py @@ -10,6 +10,7 @@ (output_filename_override could previously be left empty and the path would be constructed automatically). """ + import glob import json import logging diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 34af7c1d5e81..5f9465dbddd7 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -4,6 +4,7 @@ Naming: try to use class names that have a distinct plural form so that the relationship cardinalities are obvious (e.g. prefer Dataset to Data) """ + import abc import base64 import errno @@ -4091,12 +4092,10 @@ def _calculate_size(self) -> int: return self.object_store.size(self) @overload - def get_size(self, nice_size: Literal[False], calculate_size: bool = True) -> int: - ... + def get_size(self, nice_size: Literal[False], calculate_size: bool = True) -> int: ... @overload - def get_size(self, nice_size: Literal[True], calculate_size: bool = True) -> str: - ... + def get_size(self, nice_size: Literal[True], calculate_size: bool = True) -> str: ... def get_size(self, nice_size: bool = False, calculate_size: bool = True) -> Union[int, str]: """Returns the size of the data on disk""" @@ -6836,9 +6835,9 @@ def _serialize(self, id_encoder, serialization_options): copied_from_history_dataset_collection_association_chain.append( serialization_options.get_identifier(id_encoder, src_hdca) ) - rval[ - "copied_from_history_dataset_collection_association_id_chain" - ] = copied_from_history_dataset_collection_association_chain + rval["copied_from_history_dataset_collection_association_id_chain"] = ( + copied_from_history_dataset_collection_association_chain + ) serialization_options.attach_identifier(id_encoder, self, rval) return rval @@ -8654,9 +8653,7 @@ def to_dict(self, view="collection", value_mapper=None, step_details=False, lega for output_assoc in self.output_dataset_collections: label = output_assoc.workflow_output.label if not label: - label = ( - label - ) = f"{output_assoc.workflow_output.output_name} (Step {output_assoc.workflow_output.workflow_step.order_index + 1})" + label = f"{output_assoc.workflow_output.output_name} (Step {output_assoc.workflow_output.workflow_step.order_index + 1})" output_collections[label] = { "src": "hdca", @@ -9033,9 +9030,11 @@ def to_dict(self, view="collection", value_mapper=None): outputs[name] = { "src": "hda", "id": output_assoc.dataset.id, - "uuid": str(output_assoc.dataset.dataset.uuid) - if output_assoc.dataset.dataset.uuid is not None - else None, + "uuid": ( + str(output_assoc.dataset.dataset.uuid) + if output_assoc.dataset.dataset.uuid is not None + else None + ), } output_collections = {} diff --git a/lib/galaxy/model/base.py b/lib/galaxy/model/base.py index 249ddb4fde93..707dc486a734 100644 --- a/lib/galaxy/model/base.py +++ b/lib/galaxy/model/base.py @@ -2,6 +2,7 @@ Shared model and mapping code between Galaxy and Tool Shed, trying to generalize to generic database connections. """ + import contextlib import logging import os diff --git a/lib/galaxy/model/database_object_names.py b/lib/galaxy/model/database_object_names.py index 802f40c65e12..864f821e56a6 100644 --- a/lib/galaxy/model/database_object_names.py +++ b/lib/galaxy/model/database_object_names.py @@ -2,6 +2,7 @@ Naming convention and helper functions for generating names of database constraints and indexes. """ + from typing import ( List, Union, diff --git a/lib/galaxy/model/dataset_collections/structure.py b/lib/galaxy/model/dataset_collections/structure.py index 25c6257175f1..af6395054b27 100644 --- a/lib/galaxy/model/dataset_collections/structure.py +++ b/lib/galaxy/model/dataset_collections/structure.py @@ -1,5 +1,6 @@ """ Module for reasoning about structure of and matching hierarchical collections of data. """ + import logging log = logging.getLogger(__name__) diff --git a/lib/galaxy/model/index_filter_util.py b/lib/galaxy/model/index_filter_util.py index fc7693b9da09..0050d514dbc8 100644 --- a/lib/galaxy/model/index_filter_util.py +++ b/lib/galaxy/model/index_filter_util.py @@ -1,4 +1,5 @@ """Utility functions used to adapt galaxy.util.search to Galaxy model index queries.""" + from typing import ( List, Union, diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/186d4835587b_drop_job_state_history_update_time_.py b/lib/galaxy/model/migrations/alembic/versions_gxy/186d4835587b_drop_job_state_history_update_time_.py index 256b1baaa13d..79250a75c713 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/186d4835587b_drop_job_state_history_update_time_.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/186d4835587b_drop_job_state_history_update_time_.py @@ -5,6 +5,7 @@ Create Date: 2022-06-01 17:50:22.629894 """ + from sqlalchemy import ( Column, DateTime, diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/2d749563e1fe_add_notification_system_tables.py b/lib/galaxy/model/migrations/alembic/versions_gxy/2d749563e1fe_add_notification_system_tables.py index 2e74c2de4411..d54395921c8c 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/2d749563e1fe_add_notification_system_tables.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/2d749563e1fe_add_notification_system_tables.py @@ -5,6 +5,7 @@ Create Date: 2023-03-02 15:16:36.737075 """ + import sqlalchemy as sa from galaxy.model.custom_types import JSONType diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/3100452fa030_add_workflow_invocation_message_table.py b/lib/galaxy/model/migrations/alembic/versions_gxy/3100452fa030_add_workflow_invocation_message_table.py index fe2f6c0a751d..80076b91a3db 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/3100452fa030_add_workflow_invocation_message_table.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/3100452fa030_add_workflow_invocation_message_table.py @@ -5,6 +5,7 @@ Create Date: 2023-01-13 16:13:09.578391 """ + from sqlalchemy import ( Column, ForeignKey, diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/3356bc2ecfc4_drop_view.py b/lib/galaxy/model/migrations/alembic/versions_gxy/3356bc2ecfc4_drop_view.py index c5d8772baf41..e683512afa49 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/3356bc2ecfc4_drop_view.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/3356bc2ecfc4_drop_view.py @@ -5,6 +5,7 @@ Create Date: 2023-04-10 15:06:01.037416 """ + from alembic import op # revision identifiers, used by Alembic. diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/3a2914d703ca_add_index_wf_r_s_s__workflow_invocation_.py b/lib/galaxy/model/migrations/alembic/versions_gxy/3a2914d703ca_add_index_wf_r_s_s__workflow_invocation_.py index 60805a2b7b5e..bd5b9e2e189c 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/3a2914d703ca_add_index_wf_r_s_s__workflow_invocation_.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/3a2914d703ca_add_index_wf_r_s_s__workflow_invocation_.py @@ -5,6 +5,7 @@ Create Date: 2023-03-07 15:06:55.682273 """ + from galaxy.model.database_object_names import build_index_name from galaxy.model.migrations.util import ( create_index, diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/518c8438a91b_add_when_expression_column.py b/lib/galaxy/model/migrations/alembic/versions_gxy/518c8438a91b_add_when_expression_column.py index 112b8b8dfb75..b2feb579579b 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/518c8438a91b_add_when_expression_column.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/518c8438a91b_add_when_expression_column.py @@ -5,6 +5,7 @@ Create Date: 2022-10-24 16:43:39.565871 """ + from sqlalchemy import Column from galaxy.model.custom_types import JSONType diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/59e024ceaca1_add_export_association_table.py b/lib/galaxy/model/migrations/alembic/versions_gxy/59e024ceaca1_add_export_association_table.py index 34a393a1f057..7ce263304932 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/59e024ceaca1_add_export_association_table.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/59e024ceaca1_add_export_association_table.py @@ -5,6 +5,7 @@ Create Date: 2022-10-12 18:02:34.659770 """ + from sqlalchemy import ( Column, DateTime, diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/6a67bf27e6a6_deferred_data_tables.py b/lib/galaxy/model/migrations/alembic/versions_gxy/6a67bf27e6a6_deferred_data_tables.py index 4f5a4f0e38f7..8087cfb54382 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/6a67bf27e6a6_deferred_data_tables.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/6a67bf27e6a6_deferred_data_tables.py @@ -5,6 +5,7 @@ Create Date: 2022-03-14 12:17:55.313830 """ + from sqlalchemy import ( Boolean, Column, diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/8a19186a6ee7_add_columns_to_interactivetool_entry_point.py b/lib/galaxy/model/migrations/alembic/versions_gxy/8a19186a6ee7_add_columns_to_interactivetool_entry_point.py index e2876e5bdf6e..97e1db178579 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/8a19186a6ee7_add_columns_to_interactivetool_entry_point.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/8a19186a6ee7_add_columns_to_interactivetool_entry_point.py @@ -5,6 +5,7 @@ Create Date: 2023-11-15 12:53:32.888292 """ + from sqlalchemy import ( Boolean, Column, diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/9540a051226e_preferred_object_store_ids.py b/lib/galaxy/model/migrations/alembic/versions_gxy/9540a051226e_preferred_object_store_ids.py index 1656c6dae92c..ae1409527acf 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/9540a051226e_preferred_object_store_ids.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/9540a051226e_preferred_object_store_ids.py @@ -5,6 +5,7 @@ Create Date: 2022-06-10 10:38:25.212102 """ + from sqlalchemy import ( Column, String, diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/987ce9839ecb_create_celery_user_rate_limit_table.py b/lib/galaxy/model/migrations/alembic/versions_gxy/987ce9839ecb_create_celery_user_rate_limit_table.py index c43535e6d020..1e960b7845a0 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/987ce9839ecb_create_celery_user_rate_limit_table.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/987ce9839ecb_create_celery_user_rate_limit_table.py @@ -5,6 +5,7 @@ Create Date: 2023-05-17 15:08:28.467938 """ + import sqlalchemy as sa from galaxy.model.migrations.util import ( diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/b182f655505f_add_workflow_source_metadata_column.py b/lib/galaxy/model/migrations/alembic/versions_gxy/b182f655505f_add_workflow_source_metadata_column.py index 0798f2c42940..75ca85c604a1 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/b182f655505f_add_workflow_source_metadata_column.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/b182f655505f_add_workflow_source_metadata_column.py @@ -5,6 +5,7 @@ Create Date: 2022-03-14 12:56:57.067748 """ + from sqlalchemy import Column from galaxy.model.custom_types import JSONType diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/b855b714e8b8_make_api_keys_deleted_non_nullable.py b/lib/galaxy/model/migrations/alembic/versions_gxy/b855b714e8b8_make_api_keys_deleted_non_nullable.py index beb7655dc4c4..cf58b6381de8 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/b855b714e8b8_make_api_keys_deleted_non_nullable.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/b855b714e8b8_make_api_keys_deleted_non_nullable.py @@ -5,6 +5,7 @@ Create Date: 2023-04-19 18:41:13.500332 """ + import sqlalchemy as sa from alembic import op diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/c39f1de47a04_add_skipped_state_to_collection_job_.py b/lib/galaxy/model/migrations/alembic/versions_gxy/c39f1de47a04_add_skipped_state_to_collection_job_.py index 5cb2555104d5..35fc0f3640bc 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/c39f1de47a04_add_skipped_state_to_collection_job_.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/c39f1de47a04_add_skipped_state_to_collection_job_.py @@ -5,6 +5,7 @@ Create Date: 2023-01-16 11:53:59.783836 """ + from alembic import op from galaxy.model.migrations.util import transaction diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/caa7742f7bca_add_index_wf_r_i_p__workflow_invocation_.py b/lib/galaxy/model/migrations/alembic/versions_gxy/caa7742f7bca_add_index_wf_r_i_p__workflow_invocation_.py index 2081ba2c183c..d546769b3ecb 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/caa7742f7bca_add_index_wf_r_i_p__workflow_invocation_.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/caa7742f7bca_add_index_wf_r_i_p__workflow_invocation_.py @@ -5,6 +5,7 @@ Create Date: 2023-03-07 15:10:44.943542 """ + from galaxy.model.database_object_names import build_index_name from galaxy.model.migrations.util import ( create_index, diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/d0583094c8cd_add_quota_source_labels.py b/lib/galaxy/model/migrations/alembic/versions_gxy/d0583094c8cd_add_quota_source_labels.py index d7099bd36cdd..90bdb5c38244 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/d0583094c8cd_add_quota_source_labels.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/d0583094c8cd_add_quota_source_labels.py @@ -5,6 +5,7 @@ Create Date: 2022-06-09 12:24:44.329038 """ + from sqlalchemy import ( Column, ForeignKey, diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/ddbdbc40bdc1_add_workflow_comment_table.py b/lib/galaxy/model/migrations/alembic/versions_gxy/ddbdbc40bdc1_add_workflow_comment_table.py index 59e1e58f9960..b0cfac349b77 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/ddbdbc40bdc1_add_workflow_comment_table.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/ddbdbc40bdc1_add_workflow_comment_table.py @@ -3,6 +3,7 @@ Revises: 92fb564c7095 Create Date: 2023-08-14 13:41:59.442243 """ + import sqlalchemy as sa from galaxy.model.custom_types import ( diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/e0561d5fc8c7_add_archived_columns_to_history.py b/lib/galaxy/model/migrations/alembic/versions_gxy/e0561d5fc8c7_add_archived_columns_to_history.py index 9de6fae98ca9..68ea73861555 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/e0561d5fc8c7_add_archived_columns_to_history.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/e0561d5fc8c7_add_archived_columns_to_history.py @@ -5,6 +5,7 @@ Create Date: 2023-05-03 11:57:58.710098 """ + import sqlalchemy as sa from galaxy.model.database_object_names import ( diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/e0e3bb173ee6_add_column_deleted_to_api_keys.py b/lib/galaxy/model/migrations/alembic/versions_gxy/e0e3bb173ee6_add_column_deleted_to_api_keys.py index 4cba2792fe43..5183a4ec5f9d 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/e0e3bb173ee6_add_column_deleted_to_api_keys.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/e0e3bb173ee6_add_column_deleted_to_api_keys.py @@ -5,6 +5,7 @@ Create Date: 2022-09-27 14:09:05.890227 """ + from sqlalchemy import ( Boolean, Column, diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/e7b6dcb09efd_create_gxy_branch.py b/lib/galaxy/model/migrations/alembic/versions_gxy/e7b6dcb09efd_create_gxy_branch.py index e76c4d87e30d..79ec67ee9125 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/e7b6dcb09efd_create_gxy_branch.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/e7b6dcb09efd_create_gxy_branch.py @@ -6,7 +6,6 @@ """ - # revision identifiers, used by Alembic. revision = "e7b6dcb09efd" down_revision = None diff --git a/lib/galaxy/model/migrations/alembic/versions_gxy/e93c5d0b47a9_alter_column_external_user_id.py b/lib/galaxy/model/migrations/alembic/versions_gxy/e93c5d0b47a9_alter_column_external_user_id.py index ccd1bc33cbd5..96d46f63486a 100644 --- a/lib/galaxy/model/migrations/alembic/versions_gxy/e93c5d0b47a9_alter_column_external_user_id.py +++ b/lib/galaxy/model/migrations/alembic/versions_gxy/e93c5d0b47a9_alter_column_external_user_id.py @@ -5,6 +5,7 @@ Create Date: 2023-10-08 12:11:02.024669 """ + import sqlalchemy as sa from galaxy.model.migrations.util import alter_column diff --git a/lib/galaxy/model/migrations/alembic/versions_tsi/d4a650f47a3c_create_tsi_branch.py b/lib/galaxy/model/migrations/alembic/versions_tsi/d4a650f47a3c_create_tsi_branch.py index 87510a7e58a1..6a39369bf705 100644 --- a/lib/galaxy/model/migrations/alembic/versions_tsi/d4a650f47a3c_create_tsi_branch.py +++ b/lib/galaxy/model/migrations/alembic/versions_tsi/d4a650f47a3c_create_tsi_branch.py @@ -6,7 +6,6 @@ """ - # revision identifiers, used by Alembic. revision = "d4a650f47a3c" down_revision = None diff --git a/lib/galaxy/model/migrations/base.py b/lib/galaxy/model/migrations/base.py index 77f4d58370f2..973f12224936 100644 --- a/lib/galaxy/model/migrations/base.py +++ b/lib/galaxy/model/migrations/base.py @@ -1,6 +1,7 @@ """ Shared code for galaxy and tool shed migrations. """ + import abc import logging import os @@ -49,8 +50,7 @@ class BaseParserBuilder(abc.ABC): """ @abc.abstractmethod - def _get_command_object(self): - ... + def _get_command_object(self): ... def __init__(self, parser, subcommand_required=True): self._cmd = self._get_command_object() @@ -181,12 +181,10 @@ class BaseDbScript(abc.ABC): """Facade for common database schema migration operations.""" @abc.abstractmethod - def _set_dburl(self, config_file: Optional[str] = None) -> None: - ... + def _set_dburl(self, config_file: Optional[str] = None) -> None: ... @abc.abstractmethod - def _upgrade_to_head(self, is_sql_mode: bool): - ... + def _upgrade_to_head(self, is_sql_mode: bool): ... def __init__(self, config_file: Optional[str] = None) -> None: self.alembic_config = self._get_alembic_cfg() @@ -259,12 +257,10 @@ def _process_repair_arg(self, args: Namespace) -> None: class BaseCommand(abc.ABC): @abc.abstractmethod - def init(self, args: Namespace) -> None: - ... + def init(self, args: Namespace) -> None: ... @abc.abstractmethod - def _get_dbscript(self, config_file: str) -> BaseDbScript: - ... + def _get_dbscript(self, config_file: str) -> BaseDbScript: ... def upgrade(self, args: Namespace) -> None: self._exec_command("upgrade", args) @@ -307,8 +303,7 @@ class BaseAlembicManager(abc.ABC): """ @abc.abstractmethod - def _get_alembic_root(self): - ... + def _get_alembic_root(self): ... @staticmethod def is_at_revision(engine: Engine, revision: Union[str, Iterable[str]]) -> bool: diff --git a/lib/galaxy/model/migrations/util.py b/lib/galaxy/model/migrations/util.py index 012c3a2fc2b3..ab6e097c5524 100644 --- a/lib/galaxy/model/migrations/util.py +++ b/lib/galaxy/model/migrations/util.py @@ -35,16 +35,13 @@ def run(self) -> Optional[Any]: return None @abstractmethod - def execute(self) -> Optional[Any]: - ... + def execute(self) -> Optional[Any]: ... @abstractmethod - def pre_execute_check(self) -> bool: - ... + def pre_execute_check(self) -> bool: ... @abstractmethod - def log_check_not_passed(self) -> None: - ... + def log_check_not_passed(self) -> None: ... def _is_repair_mode(self) -> bool: """`--repair` option has been passed to the command.""" @@ -82,12 +79,10 @@ def execute(self) -> Optional[Any]: return self.non_batch_execute() # use regular op context for non-sqlite db @abstractmethod - def batch_execute(self, batch_op) -> Optional[Any]: - ... + def batch_execute(self, batch_op) -> Optional[Any]: ... @abstractmethod - def non_batch_execute(self) -> Optional[Any]: - ... + def non_batch_execute(self) -> Optional[Any]: ... class CreateTable(DDLOperation): diff --git a/lib/galaxy/model/orm/scripts.py b/lib/galaxy/model/orm/scripts.py index 42e3d612b890..e48d639e92f6 100644 --- a/lib/galaxy/model/orm/scripts.py +++ b/lib/galaxy/model/orm/scripts.py @@ -1,6 +1,7 @@ """ Code to support database helper scripts (create_toolshed_db.py, migrate_toolshed_db.py, etc...). """ + import argparse import logging import os diff --git a/lib/galaxy/model/scoped_session.py b/lib/galaxy/model/scoped_session.py index 49e0613b4e01..27b47b39f9c2 100644 --- a/lib/galaxy/model/scoped_session.py +++ b/lib/galaxy/model/scoped_session.py @@ -4,6 +4,7 @@ scoped_session objects that produce sessions that may have different binds (i.e., if the tool_shed_install model uses a different database). """ + from sqlalchemy.orm import scoped_session diff --git a/lib/galaxy/model/store/__init__.py b/lib/galaxy/model/store/__init__.py index e4eea7fdc03d..9cee078dfe59 100644 --- a/lib/galaxy/model/store/__init__.py +++ b/lib/galaxy/model/store/__init__.py @@ -272,8 +272,7 @@ def __init__( self.import_history_encoded_id = None @abc.abstractmethod - def workflow_paths(self) -> Iterator[Tuple[str, str]]: - ... + def workflow_paths(self) -> Iterator[Tuple[str, str]]: ... @abc.abstractmethod def defines_new_history(self) -> bool: @@ -292,8 +291,7 @@ def library_properties(self) -> List[Dict[str, Any]]: return [] @abc.abstractmethod - def invocations_properties(self) -> List[Dict[str, Any]]: - ... + def invocations_properties(self) -> List[Dict[str, Any]]: ... @abc.abstractmethod def collections_properties(self) -> List[Dict[str, Any]]: @@ -304,8 +302,7 @@ def jobs_properties(self) -> List[Dict[str, Any]]: """Return a list of jobs properties.""" @abc.abstractmethod - def implicit_collection_jobs_properties(self) -> List[Dict[str, Any]]: - ... + def implicit_collection_jobs_properties(self) -> List[Dict[str, Any]]: ... @property @abc.abstractmethod @@ -1459,8 +1456,7 @@ def _normalize_job_parameters( _find_hda: Callable, _find_hdca: Callable, _find_dce: Callable, - ) -> Dict[str, Any]: - ... + ) -> Dict[str, Any]: ... @abc.abstractmethod def _connect_job_io( @@ -1470,8 +1466,7 @@ def _connect_job_io( _find_hda: Callable, _find_hdca: Callable, _find_dce: Callable, - ) -> None: - ... + ) -> None: ... @property def file_source_root(self) -> str: @@ -2396,8 +2391,7 @@ class WriteCrates: @property @abc.abstractmethod - def workflows_directory(self) -> str: - ... + def workflows_directory(self) -> str: ... def _generate_markdown_readme(self) -> str: markdown_parts: List[str] = [] diff --git a/lib/galaxy/model/store/discover.py b/lib/galaxy/model/store/discover.py index ae7143a5ff47..236dcc024ba2 100644 --- a/lib/galaxy/model/store/discover.py +++ b/lib/galaxy/model/store/discover.py @@ -5,6 +5,7 @@ job output discovery or for persisting Galaxy model objects corresponding to files in other contexts. """ + import abc import logging import os diff --git a/lib/galaxy/model/tool_shed_install/__init__.py b/lib/galaxy/model/tool_shed_install/__init__.py index 1d41d5c3c677..ab5a7d9a41b8 100644 --- a/lib/galaxy/model/tool_shed_install/__init__.py +++ b/lib/galaxy/model/tool_shed_install/__init__.py @@ -55,12 +55,10 @@ class DeclarativeMeta(_DeclarativeMeta, type): class HasToolBox(common_util.HasToolShedRegistry, Protocol): @property - def tool_dependency_dir(self) -> Optional[str]: - ... + def tool_dependency_dir(self) -> Optional[str]: ... @property - def toolbox(self) -> AbstractToolBox: - ... + def toolbox(self) -> AbstractToolBox: ... class Base(metaclass=DeclarativeMeta): diff --git a/lib/galaxy/model/unittest_utils/__init__.py b/lib/galaxy/model/unittest_utils/__init__.py index 790e54ae1f4e..c297ab3c04f2 100644 --- a/lib/galaxy/model/unittest_utils/__init__.py +++ b/lib/galaxy/model/unittest_utils/__init__.py @@ -1,4 +1,5 @@ """Interface provided by galaxy-data modules for unittest utilities for reuse by other modules.""" + from .data_app import ( GalaxyDataTestApp, GalaxyDataTestConfig, diff --git a/lib/galaxy/model/unittest_utils/data_app.py b/lib/galaxy/model/unittest_utils/data_app.py index 288fa56c693a..8942af46a4d7 100644 --- a/lib/galaxy/model/unittest_utils/data_app.py +++ b/lib/galaxy/model/unittest_utils/data_app.py @@ -5,6 +5,7 @@ more appropriate for testing galaxy-data functionality and will be included with galaxy-data. """ + import os import shutil import tempfile diff --git a/lib/galaxy/model/unittest_utils/store_fixtures.py b/lib/galaxy/model/unittest_utils/store_fixtures.py index f93fe32392cd..d779e79d698e 100644 --- a/lib/galaxy/model/unittest_utils/store_fixtures.py +++ b/lib/galaxy/model/unittest_utils/store_fixtures.py @@ -1,4 +1,5 @@ """Fixtures for populating model stores.""" + from typing import ( Any, Dict, diff --git a/lib/galaxy/objectstore/__init__.py b/lib/galaxy/objectstore/__init__.py index d799ad674bbc..df9f6f485c2a 100644 --- a/lib/galaxy/objectstore/__init__.py +++ b/lib/galaxy/objectstore/__init__.py @@ -68,7 +68,6 @@ class ObjectStore(metaclass=abc.ABCMeta): - """ObjectStore interface. FIELD DESCRIPTIONS (these apply to all the methods in this class): @@ -902,7 +901,6 @@ def _get_store_usage_percent(self, **kwargs): class NestedObjectStore(BaseObjectStore): - """ Base for ObjectStores that use other ObjectStores. @@ -1008,7 +1006,6 @@ def _call_method(self, method, obj, default, default_is_exception, **kwargs): class DistributedObjectStore(NestedObjectStore): - """ ObjectStore that defers to a list of backends. diff --git a/lib/galaxy/objectstore/caching.py b/lib/galaxy/objectstore/caching.py index 2df468681498..f923a33d3fb9 100644 --- a/lib/galaxy/objectstore/caching.py +++ b/lib/galaxy/objectstore/caching.py @@ -1,5 +1,6 @@ """ """ + import logging import os import threading diff --git a/lib/galaxy/objectstore/irods.py b/lib/galaxy/objectstore/irods.py index d2ac18fdca94..c4fb79777cc6 100644 --- a/lib/galaxy/objectstore/irods.py +++ b/lib/galaxy/objectstore/irods.py @@ -1,6 +1,7 @@ """ Object Store plugin for the Integrated Rule-Oriented Data System (iRODS) """ + import logging import os import shutil diff --git a/lib/galaxy/objectstore/s3.py b/lib/galaxy/objectstore/s3.py index 41b4d58e96a9..7e17c34d844e 100644 --- a/lib/galaxy/objectstore/s3.py +++ b/lib/galaxy/objectstore/s3.py @@ -1,6 +1,7 @@ """ Object Store plugin for the Amazon Simple Storage Service (S3) """ + import logging import multiprocessing import os diff --git a/lib/galaxy/objectstore/unittest_utils/__init__.py b/lib/galaxy/objectstore/unittest_utils/__init__.py index e6acadc45166..f96b12d91a0c 100644 --- a/lib/galaxy/objectstore/unittest_utils/__init__.py +++ b/lib/galaxy/objectstore/unittest_utils/__init__.py @@ -1,4 +1,5 @@ """Utilities for configuring and using objectstores in unit tests.""" + import os from io import StringIO from shutil import rmtree diff --git a/lib/galaxy/queues.py b/lib/galaxy/queues.py index d68012beb5c7..ab6edafcf5b0 100644 --- a/lib/galaxy/queues.py +++ b/lib/galaxy/queues.py @@ -3,6 +3,7 @@ All message queues used by Galaxy """ + import socket from typing import Optional diff --git a/lib/galaxy/quota/__init__.py b/lib/galaxy/quota/__init__.py index 88254be3438f..e7ebcc4b3a88 100644 --- a/lib/galaxy/quota/__init__.py +++ b/lib/galaxy/quota/__init__.py @@ -1,4 +1,5 @@ """Galaxy Quotas""" + import logging from typing import Optional diff --git a/lib/galaxy/schema/bco/util.py b/lib/galaxy/schema/bco/util.py index b842c821802c..46f9389594f5 100644 --- a/lib/galaxy/schema/bco/util.py +++ b/lib/galaxy/schema/bco/util.py @@ -3,6 +3,7 @@ We don't have a lot of functional code in this schema module so this may belong somewhere else in another galaxy-data package. """ + import hashlib from typing import ( Any, diff --git a/lib/galaxy/security/__init__.py b/lib/galaxy/security/__init__.py index 0867f7cc6cf7..8d3bfcaa4d2f 100644 --- a/lib/galaxy/security/__init__.py +++ b/lib/galaxy/security/__init__.py @@ -2,6 +2,7 @@ Galaxy Security """ + from typing import ( List, Optional, diff --git a/lib/galaxy/security/validate_user_input.py b/lib/galaxy/security/validate_user_input.py index 29e052db4dc3..5e21c86c6c4c 100644 --- a/lib/galaxy/security/validate_user_input.py +++ b/lib/galaxy/security/validate_user_input.py @@ -4,6 +4,7 @@ The validate_* methods in this file return simple messages that do not contain user inputs - so these methods do not need to be escaped. """ + import logging import re from typing import Optional diff --git a/lib/galaxy/selenium/cli.py b/lib/galaxy/selenium/cli.py index 5f52d69ce0f3..f52f3b3a7332 100644 --- a/lib/galaxy/selenium/cli.py +++ b/lib/galaxy/selenium/cli.py @@ -55,7 +55,6 @@ def add_selenium_arguments(parser): class DriverWrapper(NavigatesGalaxy): - """Adapt argparse command-line options to a concrete Selenium driver.""" def __init__(self, args): diff --git a/lib/galaxy/selenium/has_driver.py b/lib/galaxy/selenium/has_driver.py index de7f904edcbd..ed11cba91182 100644 --- a/lib/galaxy/selenium/has_driver.py +++ b/lib/galaxy/selenium/has_driver.py @@ -3,6 +3,7 @@ This should be mixed into classes with a self.driver and self.default_timeout attribute. """ + import abc import threading from typing import ( @@ -250,8 +251,7 @@ def _send_key(self, key: str, element: Optional[WebElement] = None): element.send_keys(key) @abc.abstractmethod - def timeout_for(self, **kwds) -> float: - ... + def timeout_for(self, **kwds) -> float: ... def wait(self, timeout=UNSPECIFIED_TIMEOUT, **kwds): if timeout is UNSPECIFIED_TIMEOUT: diff --git a/lib/galaxy/structured_app.py b/lib/galaxy/structured_app.py index 2c20b9cf3d53..ebab917098fc 100644 --- a/lib/galaxy/structured_app.py +++ b/lib/galaxy/structured_app.py @@ -1,4 +1,5 @@ """Typed description of Galaxy's app object.""" + import abc from typing import ( Any, @@ -125,11 +126,9 @@ class MinimalManagerApp(MinimalApp): @property @abc.abstractmethod - def is_job_handler(self) -> bool: - ... + def is_job_handler(self) -> bool: ... - def wait_for_toolbox_reload(self, old_toolbox: "ToolBox") -> None: - ... + def wait_for_toolbox_reload(self, old_toolbox: "ToolBox") -> None: ... class StructuredApp(MinimalManagerApp): diff --git a/lib/galaxy/tool_shed/galaxy_install/client.py b/lib/galaxy/tool_shed/galaxy_install/client.py index 92125ba6d78d..da9ae649c080 100644 --- a/lib/galaxy/tool_shed/galaxy_install/client.py +++ b/lib/galaxy/tool_shed/galaxy_install/client.py @@ -30,28 +30,22 @@ class DataManagerInterface(Protocol): GUID_TYPE: str = "data_manager" DEFAULT_VERSION: str = "0.0.1" - def process_result(self, out_data): - ... + def process_result(self, out_data): ... - def write_bundle(self, out: Dict[str, OutputDataset]) -> Dict[str, OutputDataset]: - ... + def write_bundle(self, out: Dict[str, OutputDataset]) -> Dict[str, OutputDataset]: ... class DataManagersInterface(Protocol): @property - def _reload_count(self) -> int: - ... + def _reload_count(self) -> int: ... def load_manager_from_elem( self, data_manager_elem, tool_path=None, add_manager=True - ) -> Optional[DataManagerInterface]: - ... + ) -> Optional[DataManagerInterface]: ... - def get_manager(self, data_manager_id: str) -> Optional[DataManagerInterface]: - ... + def get_manager(self, data_manager_id: str) -> Optional[DataManagerInterface]: ... - def remove_manager(self, manager_ids: Union[str, List[str]]) -> None: - ... + def remove_manager(self, manager_ids: Union[str, List[str]]) -> None: ... ToolBoxType = TypeVar("ToolBoxType", bound="AbstractToolBox") @@ -69,5 +63,4 @@ class InstallationTarget(HasToolBox, Generic[ToolBoxType]): tool_shed_repository_cache: Optional[ToolShedRepositoryCache] tool_data_tables: ToolDataTableManager - def wait_for_toolbox_reload(self, old_toolbox: ToolBoxType) -> None: - ... + def wait_for_toolbox_reload(self, old_toolbox: ToolBoxType) -> None: ... diff --git a/lib/galaxy/tool_shed/galaxy_install/installed_repository_manager.py b/lib/galaxy/tool_shed/galaxy_install/installed_repository_manager.py index 76bf5b0b24c1..aff38254d183 100644 --- a/lib/galaxy/tool_shed/galaxy_install/installed_repository_manager.py +++ b/lib/galaxy/tool_shed/galaxy_install/installed_repository_manager.py @@ -1,6 +1,7 @@ """ Class encapsulating the management of repositories installed into Galaxy from the Tool Shed. """ + import copy import logging import os @@ -170,9 +171,9 @@ def add_entry_to_installed_repository_dependencies_of_installed_repositories( ) debug_msg += "to installed_repository_dependencies_of_installed_repositories." log.debug(debug_msg) - self.installed_repository_dependencies_of_installed_repositories[ - repository_tup - ] = repository_dependency_tups + self.installed_repository_dependencies_of_installed_repositories[repository_tup] = ( + repository_dependency_tups + ) # Use the repository_dependency_tups to add entries to the reverse dictionary # self.installed_dependent_repositories_of_installed_repositories. for required_repository_tup in repository_dependency_tups: diff --git a/lib/galaxy/tool_shed/galaxy_install/repository_dependencies/repository_dependency_manager.py b/lib/galaxy/tool_shed/galaxy_install/repository_dependencies/repository_dependency_manager.py index 0d6a291e0576..b367a3322fba 100644 --- a/lib/galaxy/tool_shed/galaxy_install/repository_dependencies/repository_dependency_manager.py +++ b/lib/galaxy/tool_shed/galaxy_install/repository_dependencies/repository_dependency_manager.py @@ -2,6 +2,7 @@ Class encapsulating the management of repository dependencies installed or being installed into Galaxy from the Tool Shed. """ + import json import logging import os diff --git a/lib/galaxy/tool_shed/galaxy_install/update_repository_manager.py b/lib/galaxy/tool_shed/galaxy_install/update_repository_manager.py index 6b2e9dead307..42f86250f563 100644 --- a/lib/galaxy/tool_shed/galaxy_install/update_repository_manager.py +++ b/lib/galaxy/tool_shed/galaxy_install/update_repository_manager.py @@ -1,6 +1,7 @@ """ Determine if installed tool shed repositories have updates available in their respective tool sheds. """ + import logging import threading from typing import NamedTuple diff --git a/lib/galaxy/tool_shed/metadata/metadata_generator.py b/lib/galaxy/tool_shed/metadata/metadata_generator.py index a93139c17afd..e040ec0bdf16 100644 --- a/lib/galaxy/tool_shed/metadata/metadata_generator.py +++ b/lib/galaxy/tool_shed/metadata/metadata_generator.py @@ -68,8 +68,7 @@ class RepositoryProtocol(Protocol): name: str id: str - def repo_path(self, app) -> Optional[str]: - ... + def repo_path(self, app) -> Optional[str]: ... class BaseMetadataGenerator: diff --git a/lib/galaxy/tool_util/client/staging.py b/lib/galaxy/tool_util/client/staging.py index 46ea37b5858c..0a93fb9ddd98 100644 --- a/lib/galaxy/tool_util/client/staging.py +++ b/lib/galaxy/tool_util/client/staging.py @@ -3,6 +3,7 @@ Implement as a connector to serve a bridge between galactic_job_json utility and a Galaxy API library. """ + import abc import json import logging diff --git a/lib/galaxy/tool_util/cwl/cwltool_deps.py b/lib/galaxy/tool_util/cwl/cwltool_deps.py index 9d0bba1d5393..bd40a6c3092a 100644 --- a/lib/galaxy/tool_util/cwl/cwltool_deps.py +++ b/lib/galaxy/tool_util/cwl/cwltool_deps.py @@ -4,6 +4,7 @@ :func:`ensure_cwltool_available` before using any of the imported functionality at runtime. """ + import re import warnings diff --git a/lib/galaxy/tool_util/cwl/parser.py b/lib/galaxy/tool_util/cwl/parser.py index 2dc573ec9300..6236eb9d8793 100644 --- a/lib/galaxy/tool_util/cwl/parser.py +++ b/lib/galaxy/tool_util/cwl/parser.py @@ -1231,12 +1231,10 @@ def __init__(self, name, label, description, input_type, array=False, area=False self.area = area @overload - def to_dict(self, itemwise: Literal[False]) -> InputInstanceDict: - ... + def to_dict(self, itemwise: Literal[False]) -> InputInstanceDict: ... @overload - def to_dict(self, itemwise: Literal[True]) -> Union[InputInstanceDict, InputInstanceArrayDict]: - ... + def to_dict(self, itemwise: Literal[True]) -> Union[InputInstanceDict, InputInstanceArrayDict]: ... def to_dict(self, itemwise: bool = True) -> Union[InputInstanceDict, InputInstanceArrayDict]: if itemwise and self.array: diff --git a/lib/galaxy/tool_util/cwl/runnable.py b/lib/galaxy/tool_util/cwl/runnable.py index 4ee7581d5fd6..4890d1f0822f 100644 --- a/lib/galaxy/tool_util/cwl/runnable.py +++ b/lib/galaxy/tool_util/cwl/runnable.py @@ -1,4 +1,5 @@ """Lighter-weight variant of Planemo runnable outputs.""" + from galaxy.tool_util.parser import get_tool_source from .parser import workflow_proxy from .util import guess_artifact_type diff --git a/lib/galaxy/tool_util/cwl/schema.py b/lib/galaxy/tool_util/cwl/schema.py index f29a245850e9..03370b03d2ba 100644 --- a/lib/galaxy/tool_util/cwl/schema.py +++ b/lib/galaxy/tool_util/cwl/schema.py @@ -1,4 +1,5 @@ """Abstraction around cwltool and related libraries for loading a CWL artifact.""" + import os import tempfile from typing import NamedTuple diff --git a/lib/galaxy/tool_util/cwl/util.py b/lib/galaxy/tool_util/cwl/util.py index 18e40beb1e7c..fd32c9079263 100644 --- a/lib/galaxy/tool_util/cwl/util.py +++ b/lib/galaxy/tool_util/cwl/util.py @@ -2,6 +2,7 @@ Used to share code between the Galaxy test framework and other Galaxy CWL clients (e.g. Planemo).""" + import abc import hashlib import io diff --git a/lib/galaxy/tool_util/data/__init__.py b/lib/galaxy/tool_util/data/__init__.py index 6597124536ba..08ca6d82ff48 100644 --- a/lib/galaxy/tool_util/data/__init__.py +++ b/lib/galaxy/tool_util/data/__init__.py @@ -81,8 +81,7 @@ class StoresConfigFilePaths(Protocol): - def get(self, key: Any, default: Optional[Any]) -> Optional[Any]: - ... + def get(self, key: Any, default: Optional[Any]) -> Optional[Any]: ... class ToolDataPathFiles: @@ -892,8 +891,7 @@ def _expand_here_template(content: str, here: Optional[str]) -> str: class HasExtraFiles(Protocol): extra_files_path: str - def extra_files_path_exists(self) -> bool: - ... + def extra_files_path_exists(self) -> bool: ... class DirectoryAsExtraFiles(HasExtraFiles): @@ -907,8 +905,7 @@ def extra_files_path_exists(self) -> bool: class OutputDataset(HasExtraFiles, Protocol): ext: str - def get_file_name(self, sync_cache=True) -> str: - ... + def get_file_name(self, sync_cache=True) -> str: ... class ToolDataTableManager(Dictifiable): diff --git a/lib/galaxy/tool_util/deps/brew_util.py b/lib/galaxy/tool_util/deps/brew_util.py index a2e19d7d5ccb..6f748a0402f1 100644 --- a/lib/galaxy/tool_util/deps/brew_util.py +++ b/lib/galaxy/tool_util/deps/brew_util.py @@ -2,6 +2,7 @@ builds on those abstraction and provides Galaxy specific functionality not useful to the brew external commands. """ + from . import brew_exts DEFAULT_TAP = "homebrew/science" diff --git a/lib/galaxy/tool_util/deps/conda_compat.py b/lib/galaxy/tool_util/deps/conda_compat.py index 8bc745e7cc0c..d4ee224960cb 100644 --- a/lib/galaxy/tool_util/deps/conda_compat.py +++ b/lib/galaxy/tool_util/deps/conda_compat.py @@ -4,6 +4,7 @@ and should be utilized when available but that are only available in conda channels and not in PyPI. This module serves as a PyPI capable interface to these utilities. """ + import os from collections.abc import Hashable diff --git a/lib/galaxy/tool_util/deps/container_classes.py b/lib/galaxy/tool_util/deps/container_classes.py index e89e55ab6b1a..e7bd0940a0fd 100644 --- a/lib/galaxy/tool_util/deps/container_classes.py +++ b/lib/galaxy/tool_util/deps/container_classes.py @@ -96,16 +96,13 @@ class ContainerProtocol(Protocol): """ @property - def app_info(self) -> "AppInfo": - ... + def app_info(self) -> "AppInfo": ... @property - def tool_info(self) -> "ToolInfo": - ... + def tool_info(self) -> "ToolInfo": ... @property - def job_info(self) -> Optional["JobInfo"]: - ... + def job_info(self) -> Optional["JobInfo"]: ... class Container(metaclass=ABCMeta): diff --git a/lib/galaxy/tool_util/deps/container_resolvers/__init__.py b/lib/galaxy/tool_util/deps/container_resolvers/__init__.py index 763e293819b4..6407ba2fa609 100644 --- a/lib/galaxy/tool_util/deps/container_resolvers/__init__.py +++ b/lib/galaxy/tool_util/deps/container_resolvers/__init__.py @@ -1,4 +1,5 @@ """The module defines the abstract interface for resolving container images for tool execution.""" + from abc import ( ABCMeta, abstractmethod, diff --git a/lib/galaxy/tool_util/deps/container_resolvers/explicit.py b/lib/galaxy/tool_util/deps/container_resolvers/explicit.py index c85359827ec3..6493db1197a7 100644 --- a/lib/galaxy/tool_util/deps/container_resolvers/explicit.py +++ b/lib/galaxy/tool_util/deps/container_resolvers/explicit.py @@ -1,4 +1,5 @@ """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin.""" + import copy import logging import os diff --git a/lib/galaxy/tool_util/deps/docker_util.py b/lib/galaxy/tool_util/deps/docker_util.py index 54823dd1219e..c47a3296bbda 100644 --- a/lib/galaxy/tool_util/deps/docker_util.py +++ b/lib/galaxy/tool_util/deps/docker_util.py @@ -2,6 +2,7 @@ ...using common defaults and configuration mechanisms. """ + import os import shlex import sys diff --git a/lib/galaxy/tool_util/deps/resolvers/__init__.py b/lib/galaxy/tool_util/deps/resolvers/__init__.py index d5e644ad52fd..492219665e0d 100644 --- a/lib/galaxy/tool_util/deps/resolvers/__init__.py +++ b/lib/galaxy/tool_util/deps/resolvers/__init__.py @@ -1,4 +1,5 @@ """The module defines the abstract interface for dealing tool dependency resolution plugins.""" + import errno import os.path from abc import ( diff --git a/lib/galaxy/tool_util/deps/resolvers/brewed_tool_shed_packages.py b/lib/galaxy/tool_util/deps/resolvers/brewed_tool_shed_packages.py index 7b0c52e7d971..2174ccf0ee5a 100644 --- a/lib/galaxy/tool_util/deps/resolvers/brewed_tool_shed_packages.py +++ b/lib/galaxy/tool_util/deps/resolvers/brewed_tool_shed_packages.py @@ -3,6 +3,7 @@ tool_dependencies.xml) installed using Platform Homebrew and converted via shed2tap (e.g. https://github.com/jmchilton/homebrew-toolshed). """ + import logging import os diff --git a/lib/galaxy/tool_util/deps/resolvers/lmod.py b/lib/galaxy/tool_util/deps/resolvers/lmod.py index 082de0bbff0f..bbe40897a5e6 100644 --- a/lib/galaxy/tool_util/deps/resolvers/lmod.py +++ b/lib/galaxy/tool_util/deps/resolvers/lmod.py @@ -6,6 +6,7 @@ LMOD @ Github: https://github.com/TACC/Lmod """ + import logging from io import StringIO from os import getenv diff --git a/lib/galaxy/tool_util/deps/resolvers/modules.py b/lib/galaxy/tool_util/deps/resolvers/modules.py index 3f7ce514bdb9..ffd5a30b1d38 100644 --- a/lib/galaxy/tool_util/deps/resolvers/modules.py +++ b/lib/galaxy/tool_util/deps/resolvers/modules.py @@ -6,6 +6,7 @@ it, hence support for it will be minimal. The Galaxy team eagerly welcomes community contribution and maintenance however. """ + import logging from io import StringIO from os import ( diff --git a/lib/galaxy/tool_util/deps/resolvers/unlinked_tool_shed_packages.py b/lib/galaxy/tool_util/deps/resolvers/unlinked_tool_shed_packages.py index cb4593639e4b..a565771d3399 100644 --- a/lib/galaxy/tool_util/deps/resolvers/unlinked_tool_shed_packages.py +++ b/lib/galaxy/tool_util/deps/resolvers/unlinked_tool_shed_packages.py @@ -20,6 +20,7 @@ See bottom for instructions on how to add this resolver. """ + import logging from os import listdir from os.path import ( diff --git a/lib/galaxy/tool_util/linters/general.py b/lib/galaxy/tool_util/linters/general.py index ee2df7f004d1..8ca73c76ff76 100644 --- a/lib/galaxy/tool_util/linters/general.py +++ b/lib/galaxy/tool_util/linters/general.py @@ -1,4 +1,5 @@ """This module contains linting functions for general aspects of the tool.""" + import re from galaxy.tool_util.version import ( diff --git a/lib/galaxy/tool_util/linters/inputs.py b/lib/galaxy/tool_util/linters/inputs.py index 0c619e49095f..4fdfb89ea070 100644 --- a/lib/galaxy/tool_util/linters/inputs.py +++ b/lib/galaxy/tool_util/linters/inputs.py @@ -1,4 +1,5 @@ """This module contains a linting functions for tool inputs.""" + import ast import re from typing import TYPE_CHECKING diff --git a/lib/galaxy/tool_util/linters/outputs.py b/lib/galaxy/tool_util/linters/outputs.py index e034b0fe606d..bfb9e1674fd5 100644 --- a/lib/galaxy/tool_util/linters/outputs.py +++ b/lib/galaxy/tool_util/linters/outputs.py @@ -1,4 +1,5 @@ """This module contains a linting functions for tool outputs.""" + from typing import TYPE_CHECKING from packaging.version import Version diff --git a/lib/galaxy/tool_util/linters/stdio.py b/lib/galaxy/tool_util/linters/stdio.py index 981882bbde39..04eec39e7fb8 100644 --- a/lib/galaxy/tool_util/linters/stdio.py +++ b/lib/galaxy/tool_util/linters/stdio.py @@ -1,4 +1,5 @@ """This module contains a linting functions for tool error detection.""" + import re from galaxy.util import etree diff --git a/lib/galaxy/tool_util/linters/tests.py b/lib/galaxy/tool_util/linters/tests.py index 5f26dc64c602..6f0680b2daf8 100644 --- a/lib/galaxy/tool_util/linters/tests.py +++ b/lib/galaxy/tool_util/linters/tests.py @@ -1,4 +1,5 @@ """This module contains a linting functions for tool tests.""" + import typing from inspect import ( Parameter, diff --git a/lib/galaxy/tool_util/loader_directory.py b/lib/galaxy/tool_util/loader_directory.py index 1491f5ab047a..ff386752decb 100644 --- a/lib/galaxy/tool_util/loader_directory.py +++ b/lib/galaxy/tool_util/loader_directory.py @@ -1,4 +1,5 @@ """Utilities for loading and reasoning about unparsed tools in directories.""" + import fnmatch import glob import logging diff --git a/lib/galaxy/tool_util/parser/__init__.py b/lib/galaxy/tool_util/parser/__init__.py index 27518c895be4..509a6c066b31 100644 --- a/lib/galaxy/tool_util/parser/__init__.py +++ b/lib/galaxy/tool_util/parser/__init__.py @@ -1,5 +1,6 @@ """ Package responsible for parsing tools from files/abstract tool sources. """ + from .factory import ( get_input_source, get_tool_source, diff --git a/lib/galaxy/tool_util/parser/output_collection_def.py b/lib/galaxy/tool_util/parser/output_collection_def.py index bd130da118e7..4d16cb5d3539 100644 --- a/lib/galaxy/tool_util/parser/output_collection_def.py +++ b/lib/galaxy/tool_util/parser/output_collection_def.py @@ -1,6 +1,7 @@ """ This module define an abstract class for reasoning about Galaxy's dataset collection after jobs are finished. """ + from typing import List from galaxy.util import asbool diff --git a/lib/galaxy/tool_util/toolbox/base.py b/lib/galaxy/tool_util/toolbox/base.py index c2a2f1ee47b2..5ada4549c5aa 100644 --- a/lib/galaxy/tool_util/toolbox/base.py +++ b/lib/galaxy/tool_util/toolbox/base.py @@ -1389,8 +1389,7 @@ def _build_filter_method(self, trans): return lambda element, item_type: _filter_for_panel(element, item_type, filters, context) @abc.abstractmethod - def _looks_like_a_tool(self, path: str) -> bool: - ... + def _looks_like_a_tool(self, path: str) -> bool: ... def _filter_for_panel(item, item_type, filters, context): diff --git a/lib/galaxy/tool_util/toolbox/parser.py b/lib/galaxy/tool_util/toolbox/parser.py index 63416e48fc25..07b841f93f78 100644 --- a/lib/galaxy/tool_util/toolbox/parser.py +++ b/lib/galaxy/tool_util/toolbox/parser.py @@ -3,6 +3,7 @@ These files define tool lists, sections, labels, etc... the elements of the Galaxy tool panel. """ + from abc import ( ABCMeta, abstractmethod, diff --git a/lib/galaxy/tool_util/verify/interactor.py b/lib/galaxy/tool_util/verify/interactor.py index 94cdb25a8efd..c3b9eeca8a77 100644 --- a/lib/galaxy/tool_util/verify/interactor.py +++ b/lib/galaxy/tool_util/verify/interactor.py @@ -1278,8 +1278,7 @@ def _verify_extra_files_content( class TestConfig(Protocol): - def get_test_config(self, job_data: Dict[str, Any]) -> Optional[Dict[str, Any]]: - ... + def get_test_config(self, job_data: Dict[str, Any]) -> Optional[Dict[str, Any]]: ... class NullClientTestConfig(TestConfig): diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index a3b894d1e9b8..3213f10b218b 100644 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -1,6 +1,7 @@ """ Classes encapsulating galaxy tools and tool configuration. """ + import itertools import json import logging diff --git a/lib/galaxy/tools/actions/__init__.py b/lib/galaxy/tools/actions/__init__.py index cee8b06015d1..80604f7976fa 100644 --- a/lib/galaxy/tools/actions/__init__.py +++ b/lib/galaxy/tools/actions/__init__.py @@ -176,9 +176,9 @@ def process_dataset(data, formats=None): for conversion_name, conversion_extensions, conversion_datatypes in input.conversions: new_data = process_dataset(input_datasets[prefixed_name + str(i + 1)], conversion_datatypes) if not new_data or new_data.datatype.matches_any(conversion_datatypes): - input_datasets[ - prefixed_name[: -len(input.name)] + conversion_name + str(i + 1) - ] = new_data + input_datasets[prefixed_name[: -len(input.name)] + conversion_name + str(i + 1)] = ( + new_data + ) input_datasets.set_legacy_alias( new_key=prefixed_name[: -len(input.name)] + conversion_name + str(i + 1), old_key=prefix + conversion_name + str(i + 1), @@ -221,9 +221,9 @@ def process_dataset(data, formats=None): target_dict[input.name] = input_datasets[prefixed_name] for conversion_name, conversion_data in conversions: # allow explicit conversion to be stored in job_parameter table - target_dict[ - conversion_name - ] = conversion_data.id # a more robust way to determine JSONable value is desired + target_dict[conversion_name] = ( + conversion_data.id + ) # a more robust way to determine JSONable value is desired elif isinstance(input, DataCollectionToolParameter): if not value: return diff --git a/lib/galaxy/tools/error_reports/__init__.py b/lib/galaxy/tools/error_reports/__init__.py index 83762ac5c96d..3ac83fbb42a3 100644 --- a/lib/galaxy/tools/error_reports/__init__.py +++ b/lib/galaxy/tools/error_reports/__init__.py @@ -1,5 +1,6 @@ """This module defines the error reporting framework for Galaxy jobs. """ + import collections import logging import os diff --git a/lib/galaxy/tools/error_reports/plugins/__init__.py b/lib/galaxy/tools/error_reports/plugins/__init__.py index 04fed72a1651..97de6441cb30 100644 --- a/lib/galaxy/tools/error_reports/plugins/__init__.py +++ b/lib/galaxy/tools/error_reports/plugins/__init__.py @@ -2,6 +2,7 @@ These are responsible for collecting and formatting a coherent set of metrics. """ + from abc import ( ABCMeta, abstractmethod, diff --git a/lib/galaxy/tools/error_reports/plugins/base_git.py b/lib/galaxy/tools/error_reports/plugins/base_git.py index b0e6e1e793ac..e1487642c6f9 100644 --- a/lib/galaxy/tools/error_reports/plugins/base_git.py +++ b/lib/galaxy/tools/error_reports/plugins/base_git.py @@ -1,7 +1,6 @@ """This module defines the common functions for error reporting for Galaxy jobs towards Git applications (e.g. Github/GitLab). """ - import logging from abc import ( ABCMeta, diff --git a/lib/galaxy/tools/error_reports/plugins/sentry.py b/lib/galaxy/tools/error_reports/plugins/sentry.py index 21b914e0be01..052f4c19dba3 100644 --- a/lib/galaxy/tools/error_reports/plugins/sentry.py +++ b/lib/galaxy/tools/error_reports/plugins/sentry.py @@ -1,4 +1,5 @@ """The module describes the ``sentry`` error plugin.""" + import logging from typing import Dict diff --git a/lib/galaxy/tools/error_reports/plugins/slack.py b/lib/galaxy/tools/error_reports/plugins/slack.py index 10e3c69128b4..6af1431ba86d 100644 --- a/lib/galaxy/tools/error_reports/plugins/slack.py +++ b/lib/galaxy/tools/error_reports/plugins/slack.py @@ -1,4 +1,5 @@ """The module describes the ``slack`` error plugin plugin.""" + import logging import uuid from typing import ( diff --git a/lib/galaxy/tools/errors.py b/lib/galaxy/tools/errors.py index 38a74e2914b9..e1dc2052bb5f 100644 --- a/lib/galaxy/tools/errors.py +++ b/lib/galaxy/tools/errors.py @@ -1,6 +1,7 @@ """ Functionality for dealing with tool errors. """ + import string import markupsafe diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py index 2e0c40c2c3ff..39247afde9e7 100644 --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -560,9 +560,9 @@ def __sanitize_param_dict(self, param_dict): # Remove key so that new wrapped object will occupy key slot del param_dict[key] # And replace with new wrapped key - param_dict[ - wrap_with_safe_string(key, no_wrap_classes=ToolParameterValueWrapper) - ] = wrap_with_safe_string(value, no_wrap_classes=ToolParameterValueWrapper) + param_dict[wrap_with_safe_string(key, no_wrap_classes=ToolParameterValueWrapper)] = ( + wrap_with_safe_string(value, no_wrap_classes=ToolParameterValueWrapper) + ) def build(self): """ @@ -686,9 +686,9 @@ def _build_environment_variables(self): ) config_file_basename = os.path.basename(config_filename) # environment setup in job file template happens before `cd $working_directory` - environment_variable[ - "value" - ] = f'`cat "{self.compute_environment.env_config_directory()}/{config_file_basename}"`' + environment_variable["value"] = ( + f'`cat "{self.compute_environment.env_config_directory()}/{config_file_basename}"`' + ) environment_variable["raw"] = True environment_variable["job_directory_path"] = config_filename environment_variables.append(environment_variable) diff --git a/lib/galaxy/tools/execute.py b/lib/galaxy/tools/execute.py index e1ac8f9f6e25..6b4180a825cb 100644 --- a/lib/galaxy/tools/execute.py +++ b/lib/galaxy/tools/execute.py @@ -3,6 +3,7 @@ from various states, tracking results, and building implicit dataset collections from matched collections. """ + import collections import logging import typing diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 7f23efe13e34..3cf9e7d377d6 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -2029,9 +2029,7 @@ def do_validate(v): raise ValueError("At most %d datasets are required for %s" % (self.max, self.name)) -def src_id_to_item( - sa_session: "Session", value: Dict[str, Any], security: "IdEncodingHelper" -) -> Union[ +def src_id_to_item(sa_session: "Session", value: Dict[str, Any], security: "IdEncodingHelper") -> Union[ DatasetCollectionElement, HistoryDatasetAssociation, HistoryDatasetCollectionAssociation, @@ -2248,9 +2246,9 @@ def visitor(prefix, input, value, parent=None): or (not input.dynamic_options and not input.options) or not input.options.converter_safe ): - converter_safe[ - 0 - ] = False # This option does not allow for conversion, i.e. uses contents of dataset file to generate options + converter_safe[0] = ( + False # This option does not allow for conversion, i.e. uses contents of dataset file to generate options + ) self.tool.visit_inputs(other_values, visitor) return False not in converter_safe diff --git a/lib/galaxy/tools/parameters/dynamic_options.py b/lib/galaxy/tools/parameters/dynamic_options.py index 2e05fa475ebe..e01ca980704a 100644 --- a/lib/galaxy/tools/parameters/dynamic_options.py +++ b/lib/galaxy/tools/parameters/dynamic_options.py @@ -2,6 +2,7 @@ Support for generating the options for a SelectToolParameter dynamically (based on the values of other parameters or other aspects of the current state) """ + import copy import logging import os diff --git a/lib/galaxy/tools/parameters/grouping.py b/lib/galaxy/tools/parameters/grouping.py index ad18c4d55958..4ee100cbce7d 100644 --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -1,6 +1,7 @@ """ Constructs for grouping tool parameters """ + import io import logging import os diff --git a/lib/galaxy/tools/parameters/sanitize.py b/lib/galaxy/tools/parameters/sanitize.py index 9a576b5c9d85..5ea49dcd7342 100644 --- a/lib/galaxy/tools/parameters/sanitize.py +++ b/lib/galaxy/tools/parameters/sanitize.py @@ -1,6 +1,7 @@ """ Tool Parameter specific sanitizing. """ + import logging import string diff --git a/lib/galaxy/tools/parameters/validation.py b/lib/galaxy/tools/parameters/validation.py index 49cae6053b94..ed0bbcf9884f 100644 --- a/lib/galaxy/tools/parameters/validation.py +++ b/lib/galaxy/tools/parameters/validation.py @@ -1,6 +1,7 @@ """ Classes related to parameter validation. """ + import abc import json import logging diff --git a/lib/galaxy/tools/repositories.py b/lib/galaxy/tools/repositories.py index 50e848dda7ae..206d6632d0bf 100644 --- a/lib/galaxy/tools/repositories.py +++ b/lib/galaxy/tools/repositories.py @@ -1,4 +1,5 @@ """Provides a subset of app for verifying tools.""" + import os import shutil import tempfile diff --git a/lib/galaxy/tools/search/__init__.py b/lib/galaxy/tools/search/__init__.py index 075cbc9c51ea..cc77ad0125a1 100644 --- a/lib/galaxy/tools/search/__init__.py +++ b/lib/galaxy/tools/search/__init__.py @@ -24,6 +24,7 @@ stemming -> stem; opened -> open; philosophy -> philosoph. """ + import logging import os import re diff --git a/lib/galaxy/tours/_impl.py b/lib/galaxy/tours/_impl.py index d0bcf82b7a49..60ab97bfc80a 100644 --- a/lib/galaxy/tours/_impl.py +++ b/lib/galaxy/tours/_impl.py @@ -1,6 +1,7 @@ """ This module manages loading/etc of Galaxy interactive tours. """ + import logging import os from typing import ( diff --git a/lib/galaxy/util/__init__.py b/lib/galaxy/util/__init__.py index 6c5403ff6d60..dc764168588b 100644 --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -1080,25 +1080,21 @@ def string_as_bool_or_none(string): @overload -def listify(item: Union[None, Literal[False]], do_strip: bool = False) -> List: - ... +def listify(item: Union[None, Literal[False]], do_strip: bool = False) -> List: ... @overload -def listify(item: str, do_strip: bool = False) -> List[str]: - ... +def listify(item: str, do_strip: bool = False) -> List[str]: ... @overload -def listify(item: Union[List[ItemType], Tuple[ItemType, ...]], do_strip: bool = False) -> List[ItemType]: - ... +def listify(item: Union[List[ItemType], Tuple[ItemType, ...]], do_strip: bool = False) -> List[ItemType]: ... # Unfortunately we cannot use ItemType .. -> List[ItemType] in the next overload # because then that would also match Union types. @overload -def listify(item: Any, do_strip: bool = False) -> List: - ... +def listify(item: Any, do_strip: bool = False) -> List: ... def listify(item: Any, do_strip: bool = False) -> List: @@ -1157,8 +1153,7 @@ def unicodify( # type: ignore[misc] error: str = "replace", strip_null: bool = False, log_exception: bool = True, -) -> None: - ... +) -> None: ... @overload @@ -1168,8 +1163,7 @@ def unicodify( error: str = "replace", strip_null: bool = False, log_exception: bool = True, -) -> str: - ... +) -> str: ... def unicodify( diff --git a/lib/galaxy/util/checkers.py b/lib/galaxy/util/checkers.py index f51623199f91..de2e149aa6e4 100644 --- a/lib/galaxy/util/checkers.py +++ b/lib/galaxy/util/checkers.py @@ -31,8 +31,7 @@ class CompressionChecker(Protocol): - def __call__(self, file_path: str, check_content: bool = True) -> Tuple[bool, bool]: - ... + def __call__(self, file_path: str, check_content: bool = True) -> Tuple[bool, bool]: ... def check_html(name, file_path: bool = True) -> bool: diff --git a/lib/galaxy/util/commands.py b/lib/galaxy/util/commands.py index 6238431c0e44..206bbb25b3c1 100644 --- a/lib/galaxy/util/commands.py +++ b/lib/galaxy/util/commands.py @@ -1,4 +1,5 @@ """Generic I/O and shell processing code used by Galaxy tool dependencies.""" + import logging import os import shlex diff --git a/lib/galaxy/util/compression_utils.py b/lib/galaxy/util/compression_utils.py index 205cfd5558ca..addfe96dd6f9 100644 --- a/lib/galaxy/util/compression_utils.py +++ b/lib/galaxy/util/compression_utils.py @@ -45,23 +45,23 @@ @overload -def get_fileobj(filename: str, mode: Literal["r"], compressed_formats: Optional[List[str]] = None) -> FileObjTypeStr: - ... +def get_fileobj( + filename: str, mode: Literal["r"], compressed_formats: Optional[List[str]] = None +) -> FileObjTypeStr: ... @overload -def get_fileobj(filename: str, mode: Literal["rb"], compressed_formats: Optional[List[str]] = None) -> FileObjTypeBytes: - ... +def get_fileobj( + filename: str, mode: Literal["rb"], compressed_formats: Optional[List[str]] = None +) -> FileObjTypeBytes: ... @overload -def get_fileobj(filename: str) -> FileObjTypeStr: - ... +def get_fileobj(filename: str) -> FileObjTypeStr: ... @overload -def get_fileobj(filename: str, mode: str = "r", compressed_formats: Optional[List[str]] = None) -> FileObjType: - ... +def get_fileobj(filename: str, mode: str = "r", compressed_formats: Optional[List[str]] = None) -> FileObjType: ... def get_fileobj(filename: str, mode: str = "r", compressed_formats: Optional[List[str]] = None) -> FileObjType: @@ -80,27 +80,23 @@ def get_fileobj(filename: str, mode: str = "r", compressed_formats: Optional[Lis @overload def get_fileobj_raw( filename: str, mode: Literal["r"], compressed_formats: Optional[List[str]] = None -) -> Tuple[Optional[str], FileObjTypeStr]: - ... +) -> Tuple[Optional[str], FileObjTypeStr]: ... @overload def get_fileobj_raw( filename: str, mode: Literal["rb"], compressed_formats: Optional[List[str]] = None -) -> Tuple[Optional[str], FileObjTypeBytes]: - ... +) -> Tuple[Optional[str], FileObjTypeBytes]: ... @overload -def get_fileobj_raw(filename: str) -> Tuple[Optional[str], FileObjTypeStr]: - ... +def get_fileobj_raw(filename: str) -> Tuple[Optional[str], FileObjTypeStr]: ... @overload def get_fileobj_raw( filename: str, mode: str = "r", compressed_formats: Optional[List[str]] = None -) -> Tuple[Optional[str], FileObjType]: - ... +) -> Tuple[Optional[str], FileObjType]: ... def get_fileobj_raw( diff --git a/lib/galaxy/util/config_parsers.py b/lib/galaxy/util/config_parsers.py index 00ef641f28c2..7863d66d08f2 100644 --- a/lib/galaxy/util/config_parsers.py +++ b/lib/galaxy/util/config_parsers.py @@ -13,9 +13,11 @@ def parse_allowlist_ips(fetch_url_allowlist: List[str]) -> List[IpAllowedListEntryT]: return [ - ipaddress.ip_network(unicodify(ip.strip())) # If it has a slash, assume 127.0.0.1/24 notation - if "/" in ip - else ipaddress.ip_address(unicodify(ip.strip())) # Otherwise interpret it as an ip address. + ( + ipaddress.ip_network(unicodify(ip.strip())) # If it has a slash, assume 127.0.0.1/24 notation + if "/" in ip + else ipaddress.ip_address(unicodify(ip.strip())) + ) # Otherwise interpret it as an ip address. for ip in fetch_url_allowlist if len(ip.strip()) > 0 ] diff --git a/lib/galaxy/util/facts.py b/lib/galaxy/util/facts.py index 00ca0ff09f10..37d4c851b7d3 100644 --- a/lib/galaxy/util/facts.py +++ b/lib/galaxy/util/facts.py @@ -1,5 +1,6 @@ """Return various facts for string formatting. """ + import socket from collections.abc import MutableMapping diff --git a/lib/galaxy/util/filelock.py b/lib/galaxy/util/filelock.py index 860a9d8a7012..4378ad85b740 100644 --- a/lib/galaxy/util/filelock.py +++ b/lib/galaxy/util/filelock.py @@ -5,6 +5,7 @@ https://github.com/dmfrey/FileLock/blob/master/LICENSE.txt """ + import errno import os import time diff --git a/lib/galaxy/util/oset.py b/lib/galaxy/util/oset.py index eb8d5d0a8280..e6d039569351 100644 --- a/lib/galaxy/util/oset.py +++ b/lib/galaxy/util/oset.py @@ -1,6 +1,7 @@ """ Ordered set implementation from https://code.activestate.com/recipes/576694/ """ + from collections.abc import MutableSet diff --git a/lib/galaxy/util/permutations.py b/lib/galaxy/util/permutations.py index 9bb08e91f3be..5dd1b11ee8fa 100644 --- a/lib/galaxy/util/permutations.py +++ b/lib/galaxy/util/permutations.py @@ -6,6 +6,7 @@ Maybe this doesn't make sense and maybe much of this stuff could be replaced with itertools product and permutations. These are open questions. """ + from typing import ( Dict, TypeVar, diff --git a/lib/galaxy/util/properties.py b/lib/galaxy/util/properties.py index b6015b044318..d020b34d1691 100644 --- a/lib/galaxy/util/properties.py +++ b/lib/galaxy/util/properties.py @@ -2,6 +2,7 @@ to determine application configuration. Some hard coded defaults for Galaxy but this should be reusable by tool shed and pulsar as well. """ + import os import os.path import sys diff --git a/lib/galaxy/util/renamed_temporary_file.py b/lib/galaxy/util/renamed_temporary_file.py index b8037f672ea2..854160a4ff7c 100644 --- a/lib/galaxy/util/renamed_temporary_file.py +++ b/lib/galaxy/util/renamed_temporary_file.py @@ -1,4 +1,5 @@ """Safely write file to temporary file and then move file into place.""" + # Copied from https://stackoverflow.com/a/12007885. import os import tempfile diff --git a/lib/galaxy/util/resources.py b/lib/galaxy/util/resources.py index 0e90245539bd..f40a9b6071b3 100644 --- a/lib/galaxy/util/resources.py +++ b/lib/galaxy/util/resources.py @@ -1,5 +1,6 @@ """Provide a consistent interface into and utilities for importlib file resources. """ + import sys if sys.version_info >= (3, 9): diff --git a/lib/galaxy/util/sanitize_html.py b/lib/galaxy/util/sanitize_html.py index d915a80a7a1a..f00d5175eaac 100644 --- a/lib/galaxy/util/sanitize_html.py +++ b/lib/galaxy/util/sanitize_html.py @@ -1,6 +1,7 @@ """ HTML Sanitizer (lists of acceptable_* ripped from feedparser) """ + import bleach from galaxy.util import unicodify diff --git a/lib/galaxy/util/script.py b/lib/galaxy/util/script.py index 9b0e0e5dc0d9..d21fba54eb7a 100644 --- a/lib/galaxy/util/script.py +++ b/lib/galaxy/util/script.py @@ -1,5 +1,6 @@ """Utilities for Galaxy scripts """ + import argparse import logging import os diff --git a/lib/galaxy/util/simplegraph.py b/lib/galaxy/util/simplegraph.py index fe7fd3b03aed..20329387eec4 100644 --- a/lib/galaxy/util/simplegraph.py +++ b/lib/galaxy/util/simplegraph.py @@ -1,6 +1,7 @@ """ Fencepost-simple graph structure implementation. """ + # Currently (2013.7.12) only used in easing the parsing of graph datatype data. diff --git a/lib/galaxy/visualization/data_providers/genome.py b/lib/galaxy/visualization/data_providers/genome.py index 0ef56f6b9810..cc9e9f48ad6f 100644 --- a/lib/galaxy/visualization/data_providers/genome.py +++ b/lib/galaxy/visualization/data_providers/genome.py @@ -1164,8 +1164,7 @@ class BBIDataProvider(GenomeDataProvider): dataset_type = "bigwig" @abc.abstractmethod - def _get_dataset(self) -> Tuple[IO[bytes], Union[BigBedFile, BigWigFile]]: - ... + def _get_dataset(self) -> Tuple[IO[bytes], Union[BigBedFile, BigWigFile]]: ... def valid_chroms(self): # No way to return this info as of now diff --git a/lib/galaxy/visualization/data_providers/phyloviz/__init__.py b/lib/galaxy/visualization/data_providers/phyloviz/__init__.py index fc8201c85796..53e836fd1c33 100644 --- a/lib/galaxy/visualization/data_providers/phyloviz/__init__.py +++ b/lib/galaxy/visualization/data_providers/phyloviz/__init__.py @@ -1,4 +1,5 @@ """ Data providers code for PhyloViz """ + from typing import ( Any, Dict, diff --git a/lib/galaxy/visualization/plugins/plugin.py b/lib/galaxy/visualization/plugins/plugin.py index 645362a66366..dfe625e53dcb 100644 --- a/lib/galaxy/visualization/plugins/plugin.py +++ b/lib/galaxy/visualization/plugins/plugin.py @@ -2,6 +2,7 @@ Visualization plugins: instantiate/deserialize data and models from a query string and render a webpage based on those data. """ + import copy import logging import os diff --git a/lib/galaxy/visualization/plugins/registry.py b/lib/galaxy/visualization/plugins/registry.py index 41b0cf2eeaed..efc32e3f42c0 100644 --- a/lib/galaxy/visualization/plugins/registry.py +++ b/lib/galaxy/visualization/plugins/registry.py @@ -4,6 +4,7 @@ - create urls to visualizations based on some target object(s) - unpack a query string into the desired objects needed for rendering """ + import logging import os import weakref diff --git a/lib/galaxy/visualization/plugins/resource_parser.py b/lib/galaxy/visualization/plugins/resource_parser.py index df6dedf8640a..01ca8e78b237 100644 --- a/lib/galaxy/visualization/plugins/resource_parser.py +++ b/lib/galaxy/visualization/plugins/resource_parser.py @@ -2,6 +2,7 @@ Deserialize Galaxy resources (hdas, ldas, datasets, genomes, etc.) from a dictionary of string data/ids (often from a query string). """ + import json import logging import weakref diff --git a/lib/galaxy/web/framework/base.py b/lib/galaxy/web/framework/base.py index 9c2b777257a7..364e6d4c72e2 100644 --- a/lib/galaxy/web/framework/base.py +++ b/lib/galaxy/web/framework/base.py @@ -1,6 +1,7 @@ """ A simple WSGI application/framework. """ + import io import json import logging @@ -250,9 +251,9 @@ def handle_request(self, request_id, path_info, environ, start_response, body_re raise trans.controller = controller_name trans.action = action - environ[ - "controller_action_key" - ] = f"{'api' if environ['is_api_request'] else 'web'}.{controller_name}.{action or 'default'}" + environ["controller_action_key"] = ( + f"{'api' if environ['is_api_request'] else 'web'}.{controller_name}.{action or 'default'}" + ) # Combine mapper args and query string / form args and call kwargs = trans.request.params.mixed() kwargs.update(map_match) diff --git a/lib/galaxy/web/framework/helpers/__init__.py b/lib/galaxy/web/framework/helpers/__init__.py index 20e3c802614b..a0e7e75b5b0e 100644 --- a/lib/galaxy/web/framework/helpers/__init__.py +++ b/lib/galaxy/web/framework/helpers/__init__.py @@ -5,6 +5,7 @@ visualizations in their mako files through the `$h` object, see GalaxyWebTransaction in galaxy/webapps/base/webapp.py """ + from datetime import ( datetime, timedelta, diff --git a/lib/galaxy/web/framework/middleware/error.py b/lib/galaxy/web/framework/middleware/error.py index 99b4c8654c24..a7db108f96ed 100644 --- a/lib/galaxy/web/framework/middleware/error.py +++ b/lib/galaxy/web/framework/middleware/error.py @@ -37,7 +37,6 @@ def __repr__(self): class ErrorMiddleware: - """ Error handling middleware @@ -223,7 +222,6 @@ def __call__(self, *args): class CatchingIter: - """ A wrapper around the application iterator that will catch exceptions raised by the a generator, or by the close method, and @@ -286,7 +284,6 @@ def _close(self): class Supplement: - """ This is a supplement used to display standard WSGI information in the traceback. diff --git a/lib/galaxy/web/framework/middleware/profile.py b/lib/galaxy/web/framework/middleware/profile.py index ab041ca2d487..da2d4c9f9a8a 100644 --- a/lib/galaxy/web/framework/middleware/profile.py +++ b/lib/galaxy/web/framework/middleware/profile.py @@ -2,6 +2,7 @@ Middleware that profiles the request with cProfile and displays profiling information at the bottom of each page. """ + import cProfile import pstats import threading @@ -37,7 +38,6 @@ class ProfileMiddleware: - """ Middleware that profiles all requests. diff --git a/lib/galaxy/web/framework/middleware/remoteuser.py b/lib/galaxy/web/framework/middleware/remoteuser.py index 4bea7d9f1d56..dc260ceb3958 100644 --- a/lib/galaxy/web/framework/middleware/remoteuser.py +++ b/lib/galaxy/web/framework/middleware/remoteuser.py @@ -1,6 +1,7 @@ """ Middleware for handling $REMOTE_USER if use_remote_user is enabled. """ + import logging import socket diff --git a/lib/galaxy/web/framework/middleware/sqldebug.py b/lib/galaxy/web/framework/middleware/sqldebug.py index d4828aaeb98f..519eadbd4a59 100644 --- a/lib/galaxy/web/framework/middleware/sqldebug.py +++ b/lib/galaxy/web/framework/middleware/sqldebug.py @@ -1,6 +1,7 @@ """ Per-request SQL debugging middleware. """ + import logging from galaxy.model.orm.engine_factory import ( diff --git a/lib/galaxy/web_stack/gunicorn_config.py b/lib/galaxy/web_stack/gunicorn_config.py index 86e81ccc9a15..dbf41b97571e 100644 --- a/lib/galaxy/web_stack/gunicorn_config.py +++ b/lib/galaxy/web_stack/gunicorn_config.py @@ -1,6 +1,7 @@ """ Gunicorn config file based on https://gist.github.com/hynek/ba655c8756924a5febc5285c712a7946 """ + import gc import os import sys diff --git a/lib/galaxy/webapps/base/controller.py b/lib/galaxy/webapps/base/controller.py index 6c0f41d96978..83c3ae620560 100644 --- a/lib/galaxy/webapps/base/controller.py +++ b/lib/galaxy/webapps/base/controller.py @@ -1,6 +1,7 @@ """ Contains functionality needed in every web interface """ + import logging from typing import ( Any, diff --git a/lib/galaxy/webapps/base/webapp.py b/lib/galaxy/webapps/base/webapp.py index d7c7357f9453..fbf80fc1da97 100644 --- a/lib/galaxy/webapps/base/webapp.py +++ b/lib/galaxy/webapps/base/webapp.py @@ -1,5 +1,6 @@ """ """ + import datetime import inspect import logging diff --git a/lib/galaxy/webapps/galaxy/api/__init__.py b/lib/galaxy/webapps/galaxy/api/__init__.py index 1b3c33896813..f651ea347172 100644 --- a/lib/galaxy/webapps/galaxy/api/__init__.py +++ b/lib/galaxy/webapps/galaxy/api/__init__.py @@ -1,6 +1,7 @@ """ This module *does not* contain API routes. It exclusively contains dependencies to be used in FastAPI routes """ + import inspect from enum import Enum from string import Template diff --git a/lib/galaxy/webapps/galaxy/api/annotations.py b/lib/galaxy/webapps/galaxy/api/annotations.py index f11fea9660a1..0fdce24cb0dd 100644 --- a/lib/galaxy/webapps/galaxy/api/annotations.py +++ b/lib/galaxy/webapps/galaxy/api/annotations.py @@ -1,6 +1,7 @@ """ API operations on annotations. """ + import logging from abc import abstractmethod diff --git a/lib/galaxy/webapps/galaxy/api/authenticate.py b/lib/galaxy/webapps/galaxy/api/authenticate.py index cb4a26a9c77b..a491b84bd10f 100644 --- a/lib/galaxy/webapps/galaxy/api/authenticate.py +++ b/lib/galaxy/webapps/galaxy/api/authenticate.py @@ -15,6 +15,7 @@ } """ + from fastapi import Request from galaxy.web import expose_api_anonymous_and_sessionless diff --git a/lib/galaxy/webapps/galaxy/api/cbv.py b/lib/galaxy/webapps/galaxy/api/cbv.py index b5264696d44a..d68e1fd2e1fe 100644 --- a/lib/galaxy/webapps/galaxy/api/cbv.py +++ b/lib/galaxy/webapps/galaxy/api/cbv.py @@ -2,6 +2,7 @@ Original implementation by David Montague (@dmontagu) https://github.com/dmontagu/fastapi-utils """ + from __future__ import annotations import inspect diff --git a/lib/galaxy/webapps/galaxy/api/common.py b/lib/galaxy/webapps/galaxy/api/common.py index f4f38ed0a20d..4ba9cedbe53e 100644 --- a/lib/galaxy/webapps/galaxy/api/common.py +++ b/lib/galaxy/webapps/galaxy/api/common.py @@ -1,4 +1,5 @@ """This module contains utility functions shared across the api package.""" + from typing import ( Any, Dict, diff --git a/lib/galaxy/webapps/galaxy/api/configuration.py b/lib/galaxy/webapps/galaxy/api/configuration.py index 7450103197dc..fff240830645 100644 --- a/lib/galaxy/webapps/galaxy/api/configuration.py +++ b/lib/galaxy/webapps/galaxy/api/configuration.py @@ -2,6 +2,7 @@ API operations allowing clients to determine Galaxy instance's capabilities and configuration settings. """ + import logging from typing import ( Any, diff --git a/lib/galaxy/webapps/galaxy/api/container_resolution.py b/lib/galaxy/webapps/galaxy/api/container_resolution.py index b99f427a7f9c..5431888a9830 100644 --- a/lib/galaxy/webapps/galaxy/api/container_resolution.py +++ b/lib/galaxy/webapps/galaxy/api/container_resolution.py @@ -1,6 +1,7 @@ """ API operations allowing clients to manage container resolution. """ + import logging import requests diff --git a/lib/galaxy/webapps/galaxy/api/datasets.py b/lib/galaxy/webapps/galaxy/api/datasets.py index c735ef74ecb6..4dbe9bf18770 100644 --- a/lib/galaxy/webapps/galaxy/api/datasets.py +++ b/lib/galaxy/webapps/galaxy/api/datasets.py @@ -1,6 +1,7 @@ """ API operations on the contents of a history dataset. """ + import logging from io import ( BytesIO, diff --git a/lib/galaxy/webapps/galaxy/api/datatypes.py b/lib/galaxy/webapps/galaxy/api/datatypes.py index 0bc22ed98efb..8632368d537f 100644 --- a/lib/galaxy/webapps/galaxy/api/datatypes.py +++ b/lib/galaxy/webapps/galaxy/api/datatypes.py @@ -1,6 +1,7 @@ """ API operations allowing clients to determine datatype supported by Galaxy. """ + import logging from typing import ( cast, diff --git a/lib/galaxy/webapps/galaxy/api/display_applications.py b/lib/galaxy/webapps/galaxy/api/display_applications.py index 8a572ceec15e..93e028686351 100644 --- a/lib/galaxy/webapps/galaxy/api/display_applications.py +++ b/lib/galaxy/webapps/galaxy/api/display_applications.py @@ -1,6 +1,7 @@ """ API operations on annotations. """ + import logging from typing import ( Dict, diff --git a/lib/galaxy/webapps/galaxy/api/drs.py b/lib/galaxy/webapps/galaxy/api/drs.py index 5b5504cba3cd..99d535cf9153 100644 --- a/lib/galaxy/webapps/galaxy/api/drs.py +++ b/lib/galaxy/webapps/galaxy/api/drs.py @@ -1,4 +1,5 @@ """Implement a DRS server for Galaxy dataset objects (experimental).""" + import logging from io import IOBase from typing import cast diff --git a/lib/galaxy/webapps/galaxy/api/extended_metadata.py b/lib/galaxy/webapps/galaxy/api/extended_metadata.py index 7565c9a38af4..273519a00cd1 100644 --- a/lib/galaxy/webapps/galaxy/api/extended_metadata.py +++ b/lib/galaxy/webapps/galaxy/api/extended_metadata.py @@ -1,6 +1,7 @@ """ API operations on annotations. """ + import logging from typing import ( Generic, @@ -33,8 +34,7 @@ class BaseExtendedMetadataController( ): exmeta_item_id: str - def _get_item_from_id(self, trans, idstr, check_writable=True) -> Optional[T]: - ... + def _get_item_from_id(self, trans, idstr, check_writable=True) -> Optional[T]: ... @web.expose_api def index(self, trans, **kwd): diff --git a/lib/galaxy/webapps/galaxy/api/folder_contents.py b/lib/galaxy/webapps/galaxy/api/folder_contents.py index c7513f13f229..6b6fbffdd0a9 100644 --- a/lib/galaxy/webapps/galaxy/api/folder_contents.py +++ b/lib/galaxy/webapps/galaxy/api/folder_contents.py @@ -1,6 +1,7 @@ """ API operations on the contents of a library folder. """ + import logging from typing import Optional diff --git a/lib/galaxy/webapps/galaxy/api/folders.py b/lib/galaxy/webapps/galaxy/api/folders.py index 777a31ccf255..60f7dde8611b 100644 --- a/lib/galaxy/webapps/galaxy/api/folders.py +++ b/lib/galaxy/webapps/galaxy/api/folders.py @@ -1,6 +1,7 @@ """ API operations on library folders. """ + import logging from typing import ( Optional, diff --git a/lib/galaxy/webapps/galaxy/api/forms.py b/lib/galaxy/webapps/galaxy/api/forms.py index 2e89295ebc01..97c8bf2e6700 100644 --- a/lib/galaxy/webapps/galaxy/api/forms.py +++ b/lib/galaxy/webapps/galaxy/api/forms.py @@ -1,6 +1,7 @@ """ API operations on FormDefinition objects. """ + import logging from sqlalchemy import select diff --git a/lib/galaxy/webapps/galaxy/api/group_users.py b/lib/galaxy/webapps/galaxy/api/group_users.py index bcac3e02e0f5..aadf7c65730c 100644 --- a/lib/galaxy/webapps/galaxy/api/group_users.py +++ b/lib/galaxy/webapps/galaxy/api/group_users.py @@ -1,6 +1,7 @@ """ API operations on Group objects. """ + import logging from galaxy.managers.context import ProvidesAppContext diff --git a/lib/galaxy/webapps/galaxy/api/groups.py b/lib/galaxy/webapps/galaxy/api/groups.py index cf7f99d7ec75..7525e55fd1c0 100644 --- a/lib/galaxy/webapps/galaxy/api/groups.py +++ b/lib/galaxy/webapps/galaxy/api/groups.py @@ -1,6 +1,7 @@ """ API operations on Group objects. """ + import logging from fastapi import ( diff --git a/lib/galaxy/webapps/galaxy/api/histories.py b/lib/galaxy/webapps/galaxy/api/histories.py index 0a5a15396eb5..85d8c8061884 100644 --- a/lib/galaxy/webapps/galaxy/api/histories.py +++ b/lib/galaxy/webapps/galaxy/api/histories.py @@ -3,6 +3,7 @@ .. seealso:: :class:`galaxy.model.History` """ + import logging from typing import ( Any, diff --git a/lib/galaxy/webapps/galaxy/api/history_contents.py b/lib/galaxy/webapps/galaxy/api/history_contents.py index 9b56a4787202..4f1933514014 100644 --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -1,6 +1,7 @@ """ API operations on the contents of a history. """ + import logging from typing import ( Any, diff --git a/lib/galaxy/webapps/galaxy/api/item_tags.py b/lib/galaxy/webapps/galaxy/api/item_tags.py index ede0889f2279..cd84954d5b6c 100644 --- a/lib/galaxy/webapps/galaxy/api/item_tags.py +++ b/lib/galaxy/webapps/galaxy/api/item_tags.py @@ -1,6 +1,7 @@ """ API operations related to tagging items. """ + import logging from fastapi import ( diff --git a/lib/galaxy/webapps/galaxy/api/job_files.py b/lib/galaxy/webapps/galaxy/api/job_files.py index ae5ac6fe5fe7..df2edf2415cb 100644 --- a/lib/galaxy/webapps/galaxy/api/job_files.py +++ b/lib/galaxy/webapps/galaxy/api/job_files.py @@ -1,6 +1,7 @@ """ API for asynchronous job running mechanisms can use to fetch or put files related to running and queued jobs. """ + import logging import os import re diff --git a/lib/galaxy/webapps/galaxy/api/job_ports.py b/lib/galaxy/webapps/galaxy/api/job_ports.py index bf63f84f89a5..3fe8ed06efe2 100644 --- a/lib/galaxy/webapps/galaxy/api/job_ports.py +++ b/lib/galaxy/webapps/galaxy/api/job_ports.py @@ -1,6 +1,7 @@ """ API for asynchronous job running mechanisms can use to fetch or put files related to running and queued jobs. """ + from galaxy.job_execution.ports import JobPortsView from galaxy.structured_app import StructuredApp from galaxy.web import expose_api_anonymous_and_sessionless diff --git a/lib/galaxy/webapps/galaxy/api/job_tokens.py b/lib/galaxy/webapps/galaxy/api/job_tokens.py index 63907f662cd9..8853f33d62bd 100644 --- a/lib/galaxy/webapps/galaxy/api/job_tokens.py +++ b/lib/galaxy/webapps/galaxy/api/job_tokens.py @@ -1,5 +1,6 @@ """ API asynchronous job running mechanisms can use to get a fresh OIDC token. """ + import logging from fastapi import Query diff --git a/lib/galaxy/webapps/galaxy/api/libraries.py b/lib/galaxy/webapps/galaxy/api/libraries.py index 3f12d0adf485..7a814ee09f2a 100644 --- a/lib/galaxy/webapps/galaxy/api/libraries.py +++ b/lib/galaxy/webapps/galaxy/api/libraries.py @@ -1,6 +1,7 @@ """ API operations on a data library. """ + import logging from typing import ( List, diff --git a/lib/galaxy/webapps/galaxy/api/library_contents.py b/lib/galaxy/webapps/galaxy/api/library_contents.py index 7f791ef6be2a..dc3c5e120f34 100644 --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -1,6 +1,7 @@ """ API operations on the contents of a data library. """ + import logging from typing import Optional diff --git a/lib/galaxy/webapps/galaxy/api/library_datasets.py b/lib/galaxy/webapps/galaxy/api/library_datasets.py index 7f34ff0ab840..5c98c57eb96c 100644 --- a/lib/galaxy/webapps/galaxy/api/library_datasets.py +++ b/lib/galaxy/webapps/galaxy/api/library_datasets.py @@ -1,4 +1,5 @@ """API operations on the library datasets.""" + import glob import logging import os diff --git a/lib/galaxy/webapps/galaxy/api/metrics.py b/lib/galaxy/webapps/galaxy/api/metrics.py index e299aa6b8dad..7166b77b7791 100644 --- a/lib/galaxy/webapps/galaxy/api/metrics.py +++ b/lib/galaxy/webapps/galaxy/api/metrics.py @@ -2,6 +2,7 @@ API operations for for querying and recording user metrics from some client (typically a user's browser). """ + # TODO: facade or adapter to fluentd import logging diff --git a/lib/galaxy/webapps/galaxy/api/object_store.py b/lib/galaxy/webapps/galaxy/api/object_store.py index f8d7319b885f..31f067dbfb76 100644 --- a/lib/galaxy/webapps/galaxy/api/object_store.py +++ b/lib/galaxy/webapps/galaxy/api/object_store.py @@ -1,6 +1,7 @@ """ API operations on Galaxy's object store. """ + import logging from typing import List diff --git a/lib/galaxy/webapps/galaxy/api/page_revisions.py b/lib/galaxy/webapps/galaxy/api/page_revisions.py index 815b177d77fb..b07797bc5216 100644 --- a/lib/galaxy/webapps/galaxy/api/page_revisions.py +++ b/lib/galaxy/webapps/galaxy/api/page_revisions.py @@ -1,6 +1,7 @@ """ API for updating Galaxy Pages """ + import logging from galaxy.managers.base import get_object diff --git a/lib/galaxy/webapps/galaxy/api/pages.py b/lib/galaxy/webapps/galaxy/api/pages.py index f0e2fb4c5f64..7606aaa53b47 100644 --- a/lib/galaxy/webapps/galaxy/api/pages.py +++ b/lib/galaxy/webapps/galaxy/api/pages.py @@ -1,6 +1,7 @@ """ API for updating Galaxy Pages """ + import io import logging from typing import Optional diff --git a/lib/galaxy/webapps/galaxy/api/plugins.py b/lib/galaxy/webapps/galaxy/api/plugins.py index 1a1c88fd4f20..d8af00154ea1 100644 --- a/lib/galaxy/webapps/galaxy/api/plugins.py +++ b/lib/galaxy/webapps/galaxy/api/plugins.py @@ -1,6 +1,7 @@ """ Plugins resource control over the API. """ + import logging from galaxy import exceptions diff --git a/lib/galaxy/webapps/galaxy/api/provenance.py b/lib/galaxy/webapps/galaxy/api/provenance.py index afd21504d3ac..b1eeaf0b0f20 100644 --- a/lib/galaxy/webapps/galaxy/api/provenance.py +++ b/lib/galaxy/webapps/galaxy/api/provenance.py @@ -1,6 +1,7 @@ """ API operations provenance """ + import logging from paste.httpexceptions import ( diff --git a/lib/galaxy/webapps/galaxy/api/quotas.py b/lib/galaxy/webapps/galaxy/api/quotas.py index 716da7758a5e..222ca74ec39d 100644 --- a/lib/galaxy/webapps/galaxy/api/quotas.py +++ b/lib/galaxy/webapps/galaxy/api/quotas.py @@ -1,6 +1,7 @@ """ API operations on Quota objects. """ + import logging from fastapi.param_functions import Body diff --git a/lib/galaxy/webapps/galaxy/api/remote_files.py b/lib/galaxy/webapps/galaxy/api/remote_files.py index 481b46d8bdff..4edfe28cc6bc 100644 --- a/lib/galaxy/webapps/galaxy/api/remote_files.py +++ b/lib/galaxy/webapps/galaxy/api/remote_files.py @@ -1,6 +1,7 @@ """ API operations on remote files. """ + import logging from typing import ( List, diff --git a/lib/galaxy/webapps/galaxy/api/roles.py b/lib/galaxy/webapps/galaxy/api/roles.py index 1b64cdf70fc3..166860c92ffd 100644 --- a/lib/galaxy/webapps/galaxy/api/roles.py +++ b/lib/galaxy/webapps/galaxy/api/roles.py @@ -1,6 +1,7 @@ """ API operations on Role objects. """ + import logging from fastapi import Body diff --git a/lib/galaxy/webapps/galaxy/api/sanitize_allow.py b/lib/galaxy/webapps/galaxy/api/sanitize_allow.py index 0ecb709d6964..278f562bb5bf 100755 --- a/lib/galaxy/webapps/galaxy/api/sanitize_allow.py +++ b/lib/galaxy/webapps/galaxy/api/sanitize_allow.py @@ -1,6 +1,7 @@ """ API operations allowing clients to retrieve and modify the HTML sanitization allow list. """ + import logging from typing import ( Any, diff --git a/lib/galaxy/webapps/galaxy/api/short_term_storage.py b/lib/galaxy/webapps/galaxy/api/short_term_storage.py index 2fa5f55b6a25..2afd9b6801a0 100644 --- a/lib/galaxy/webapps/galaxy/api/short_term_storage.py +++ b/lib/galaxy/webapps/galaxy/api/short_term_storage.py @@ -1,6 +1,7 @@ """ API operations around galaxy.short_term_storage infrastructure. """ + from uuid import UUID from galaxy.short_term_storage import ( diff --git a/lib/galaxy/webapps/galaxy/api/storage_cleaner.py b/lib/galaxy/webapps/galaxy/api/storage_cleaner.py index 34a382a8629c..aec1b069d953 100644 --- a/lib/galaxy/webapps/galaxy/api/storage_cleaner.py +++ b/lib/galaxy/webapps/galaxy/api/storage_cleaner.py @@ -1,6 +1,7 @@ """ API operations on User storage management. """ + import logging from typing import ( List, diff --git a/lib/galaxy/webapps/galaxy/api/tags.py b/lib/galaxy/webapps/galaxy/api/tags.py index 81f8b9f1c0d6..4ba413b7eb27 100644 --- a/lib/galaxy/webapps/galaxy/api/tags.py +++ b/lib/galaxy/webapps/galaxy/api/tags.py @@ -1,6 +1,7 @@ """ API Controller providing Galaxy Tags """ + import logging from fastapi import ( diff --git a/lib/galaxy/webapps/galaxy/api/tasks.py b/lib/galaxy/webapps/galaxy/api/tasks.py index 4a0692b464ce..d15c309842ff 100644 --- a/lib/galaxy/webapps/galaxy/api/tasks.py +++ b/lib/galaxy/webapps/galaxy/api/tasks.py @@ -1,6 +1,7 @@ """ API Controller providing experimental access to Celery Task State. """ + import logging from uuid import UUID diff --git a/lib/galaxy/webapps/galaxy/api/tool_dependencies.py b/lib/galaxy/webapps/galaxy/api/tool_dependencies.py index bb9989222b19..79f01fe16ba4 100644 --- a/lib/galaxy/webapps/galaxy/api/tool_dependencies.py +++ b/lib/galaxy/webapps/galaxy/api/tool_dependencies.py @@ -1,6 +1,7 @@ """ API operations allowing clients to manage tool dependencies. """ + import logging from typing import Optional diff --git a/lib/galaxy/webapps/galaxy/api/tool_entry_points.py b/lib/galaxy/webapps/galaxy/api/tool_entry_points.py index bf494970d93f..fcaffd3049de 100644 --- a/lib/galaxy/webapps/galaxy/api/tool_entry_points.py +++ b/lib/galaxy/webapps/galaxy/api/tool_entry_points.py @@ -1,6 +1,7 @@ """ API for asynchronous job running mechanisms can use to fetch or put files related to running and queued jobs. """ + import logging from galaxy import ( diff --git a/lib/galaxy/webapps/galaxy/api/tours.py b/lib/galaxy/webapps/galaxy/api/tours.py index 52a2924fa9e4..b177794bb388 100644 --- a/lib/galaxy/webapps/galaxy/api/tours.py +++ b/lib/galaxy/webapps/galaxy/api/tours.py @@ -1,6 +1,7 @@ """ API Controller providing Galaxy Tours """ + import logging from galaxy.tours import ( diff --git a/lib/galaxy/webapps/galaxy/api/trs_consumer.py b/lib/galaxy/webapps/galaxy/api/trs_consumer.py index 00097c518e7d..d712f680667a 100644 --- a/lib/galaxy/webapps/galaxy/api/trs_consumer.py +++ b/lib/galaxy/webapps/galaxy/api/trs_consumer.py @@ -2,6 +2,7 @@ Information on TRS can be found at https://github.com/ga4gh/tool-registry-service-schemas. """ + from galaxy.web import expose_api from galaxy.workflow.trs_proxy import TrsProxy from . import ( diff --git a/lib/galaxy/webapps/galaxy/api/trs_search.py b/lib/galaxy/webapps/galaxy/api/trs_search.py index 33d844e96bf7..b8ad2dcbf45f 100644 --- a/lib/galaxy/webapps/galaxy/api/trs_search.py +++ b/lib/galaxy/webapps/galaxy/api/trs_search.py @@ -2,6 +2,7 @@ Information on TRS can be found at https://github.com/ga4gh/tool-registry-service-schemas. """ + import logging from galaxy.web import expose_api diff --git a/lib/galaxy/webapps/galaxy/api/uploads.py b/lib/galaxy/webapps/galaxy/api/uploads.py index a75a7f272b2e..e98b1afcb55b 100644 --- a/lib/galaxy/webapps/galaxy/api/uploads.py +++ b/lib/galaxy/webapps/galaxy/api/uploads.py @@ -1,6 +1,7 @@ """ API operations for uploaded files in storage. """ + import logging from galaxy.web.framework.decorators import expose_api_anonymous diff --git a/lib/galaxy/webapps/galaxy/api/users.py b/lib/galaxy/webapps/galaxy/api/users.py index daff0514e94a..03e1511c732d 100644 --- a/lib/galaxy/webapps/galaxy/api/users.py +++ b/lib/galaxy/webapps/galaxy/api/users.py @@ -1,6 +1,7 @@ """ API operations on User objects. """ + import copy import json import logging diff --git a/lib/galaxy/webapps/galaxy/api/visualizations.py b/lib/galaxy/webapps/galaxy/api/visualizations.py index dc693887fc0f..2e8283b03dcd 100644 --- a/lib/galaxy/webapps/galaxy/api/visualizations.py +++ b/lib/galaxy/webapps/galaxy/api/visualizations.py @@ -4,6 +4,7 @@ NOTE!: this is a work in progress and functionality and data structures may change often. """ + import json import logging from typing import Optional @@ -365,7 +366,7 @@ def _validate_and_parse_payload(self, payload): # this allows PUT'ing an entire model back to the server without attribute errors on uneditable attrs valid_but_uneditable_keys = ( "id", - "model_class" + "model_class", # TODO: fill out when we create to_dict, get_dict, whatevs ) # TODO: importable diff --git a/lib/galaxy/webapps/galaxy/api/webhooks.py b/lib/galaxy/webapps/galaxy/api/webhooks.py index 79ea78a0660d..90ddb3c98a50 100644 --- a/lib/galaxy/webapps/galaxy/api/webhooks.py +++ b/lib/galaxy/webapps/galaxy/api/webhooks.py @@ -1,6 +1,7 @@ """ API Controller providing Galaxy Webhooks """ + import importlib.util import logging from typing import Any diff --git a/lib/galaxy/webapps/galaxy/api/workflows.py b/lib/galaxy/webapps/galaxy/api/workflows.py index 10e130a8781f..66bbeecb076c 100644 --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -391,9 +391,9 @@ def workflow_dict(self, trans: GalaxyWebTransaction, workflow_id, **kwd): extension = "ga" else: extension = "gxwf.json" - trans.response.headers[ - "Content-Disposition" - ] = f'attachment; filename="Galaxy-Workflow-{sname}.{extension}"' + trans.response.headers["Content-Disposition"] = ( + f'attachment; filename="Galaxy-Workflow-{sname}.{extension}"' + ) trans.response.set_content_type("application/galaxy-archive") if style == "format2" and download_format != "json-download": @@ -1648,11 +1648,15 @@ def invocation_step_jobs_summary( """ step_jobs_summary = self.invocations_service.show_invocation_step_jobs_summary(trans, invocation_id) return [ - InvocationStepJobsResponseStepModel(**summary) - if summary["model"] == "WorkflowInvocationStep" - else InvocationStepJobsResponseJobModel(**summary) - if summary["model"] == "Job" - else InvocationStepJobsResponseCollectionJobsModel(**summary) + ( + InvocationStepJobsResponseStepModel(**summary) + if summary["model"] == "WorkflowInvocationStep" + else ( + InvocationStepJobsResponseJobModel(**summary) + if summary["model"] == "Job" + else InvocationStepJobsResponseCollectionJobsModel(**summary) + ) + ) for summary in step_jobs_summary ] diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 48771bf2a73d..511ae3f6f6c9 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -1,6 +1,7 @@ """ Provides factory methods to assemble the Galaxy web application """ + import atexit import logging import sys diff --git a/lib/galaxy/webapps/galaxy/controllers/authnz.py b/lib/galaxy/webapps/galaxy/controllers/authnz.py index 3bf290ba9902..f4c1becf1d2a 100644 --- a/lib/galaxy/webapps/galaxy/controllers/authnz.py +++ b/lib/galaxy/webapps/galaxy/controllers/authnz.py @@ -2,7 +2,6 @@ OAuth 2.0 and OpenID Connect Authentication and Authorization Controller. """ - import datetime import json import logging diff --git a/lib/galaxy/webapps/galaxy/controllers/tag.py b/lib/galaxy/webapps/galaxy/controllers/tag.py index dcd3513daf14..04f315202da9 100644 --- a/lib/galaxy/webapps/galaxy/controllers/tag.py +++ b/lib/galaxy/webapps/galaxy/controllers/tag.py @@ -2,6 +2,7 @@ Tags Controller: handles tagging/untagging of entities and provides autocomplete support. """ + import logging from sqlalchemy.sql import select diff --git a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py index 4b1cd8cebbd1..bf078054ae90 100644 --- a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py +++ b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py @@ -1,6 +1,7 @@ """ Controller handles external tool related requests """ + import logging from markupsafe import escape diff --git a/lib/galaxy/webapps/galaxy/services/datasets.py b/lib/galaxy/webapps/galaxy/services/datasets.py index f8208b088c96..94a36ecaec25 100644 --- a/lib/galaxy/webapps/galaxy/services/datasets.py +++ b/lib/galaxy/webapps/galaxy/services/datasets.py @@ -1,6 +1,7 @@ """ API operations on the contents of a history dataset. """ + import logging import os from enum import Enum diff --git a/lib/galaxy/webapps/galaxy/services/histories.py b/lib/galaxy/webapps/galaxy/services/histories.py index 827f3f5f35ce..ffe64d54237f 100644 --- a/lib/galaxy/webapps/galaxy/services/histories.py +++ b/lib/galaxy/webapps/galaxy/services/histories.py @@ -267,9 +267,9 @@ def create( validate_uri_access(archive_source, trans.user_is_admin, trans.app.config.fetch_url_allowlist_ips) job = self.manager.queue_history_import(trans, archive_type=archive_type, archive_source=archive_source) job_dict = job.to_dict() - job_dict[ - "message" - ] = f"Importing history from source '{archive_source}'. This history will be visible when the import is complete." + job_dict["message"] = ( + f"Importing history from source '{archive_source}'. This history will be visible when the import is complete." + ) return JobImportHistoryResponse(**job_dict) new_history = None diff --git a/lib/galaxy/webapps/galaxy/services/history_contents.py b/lib/galaxy/webapps/galaxy/services/history_contents.py index f6db1daf7af7..c0d99167baa8 100644 --- a/lib/galaxy/webapps/galaxy/services/history_contents.py +++ b/lib/galaxy/webapps/galaxy/services/history_contents.py @@ -1379,8 +1379,7 @@ def _get_contents_by_item_list( class ItemOperation(Protocol): def __call__( self, item: HistoryItemModel, params: Optional[AnyBulkOperationParams], trans: ProvidesHistoryContext - ) -> None: - ... + ) -> None: ... class HistoryItemOperator: diff --git a/lib/galaxy/webapps/openapi/utils.py b/lib/galaxy/webapps/openapi/utils.py index 52949628af60..369da1d4039d 100644 --- a/lib/galaxy/webapps/openapi/utils.py +++ b/lib/galaxy/webapps/openapi/utils.py @@ -1,6 +1,7 @@ """ Copy of https://github.com/tiangolo/fastapi/blob/master/fastapi/openapi/utils.py with changes from https://github.com/tiangolo/fastapi/pull/10903 """ + from typing import ( Any, Dict, diff --git a/lib/galaxy/webapps/reports/buildapp.py b/lib/galaxy/webapps/reports/buildapp.py index da3e74d3a93d..32d5d9a5b2d0 100644 --- a/lib/galaxy/webapps/reports/buildapp.py +++ b/lib/galaxy/webapps/reports/buildapp.py @@ -1,6 +1,7 @@ """ Provides factory methods to assemble the Galaxy web application """ + import atexit import logging import os diff --git a/lib/galaxy/webapps/reports/config.py b/lib/galaxy/webapps/reports/config.py index f64e70c3082f..e9ff3cfa3b36 100644 --- a/lib/galaxy/webapps/reports/config.py +++ b/lib/galaxy/webapps/reports/config.py @@ -1,4 +1,5 @@ """Universe configuration builder.""" + import logging import os import re diff --git a/lib/galaxy/webapps/reports/controllers/jobs.py b/lib/galaxy/webapps/reports/controllers/jobs.py index 3fbad58ba29f..7e034c0d5ba4 100644 --- a/lib/galaxy/webapps/reports/controllers/jobs.py +++ b/lib/galaxy/webapps/reports/controllers/jobs.py @@ -267,7 +267,6 @@ def build_initial_query(self, trans, **kwd): class Jobs(BaseUIController, ReportQueryBuilder): - """ Class contains functions for querying data requested by user via the webapp. It exposes the functions and responds to requests with the filled .mako templates. diff --git a/lib/galaxy/webapps/reports/controllers/query.py b/lib/galaxy/webapps/reports/controllers/query.py index 5d8b62b44f24..824c1af7e3c8 100644 --- a/lib/galaxy/webapps/reports/controllers/query.py +++ b/lib/galaxy/webapps/reports/controllers/query.py @@ -1,5 +1,6 @@ """ Mixin to help build advanced queries for reports interface. """ + import sqlalchemy as sa diff --git a/lib/galaxy/webhooks/__init__.py b/lib/galaxy/webhooks/__init__.py index d22c96309d3d..0c1db575941d 100644 --- a/lib/galaxy/webhooks/__init__.py +++ b/lib/galaxy/webhooks/__init__.py @@ -1,6 +1,7 @@ """ This module manages loading of Galaxy webhooks. """ + import logging import os diff --git a/lib/galaxy/workflow/extract.py b/lib/galaxy/workflow/extract.py index bfa74d404d17..54899414413c 100644 --- a/lib/galaxy/workflow/extract.py +++ b/lib/galaxy/workflow/extract.py @@ -1,6 +1,7 @@ """ This module contains functionality to aid in extracting workflows from histories. """ + import logging from typing import Optional diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index dc82b1d8c70d..4682a88fa148 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -1,6 +1,7 @@ """ Modules used in building workflows """ + import json import logging import re diff --git a/lib/galaxy/workflow/reports/generators/__init__.py b/lib/galaxy/workflow/reports/generators/__init__.py index 933484c72b63..081155ca811b 100644 --- a/lib/galaxy/workflow/reports/generators/__init__.py +++ b/lib/galaxy/workflow/reports/generators/__init__.py @@ -1,5 +1,6 @@ """Module containing Galaxy workflow report generator plugins. """ + from abc import ( ABCMeta, abstractmethod, diff --git a/lib/galaxy/workflow/reports/generators/markdown.py b/lib/galaxy/workflow/reports/generators/markdown.py index bcc65eebc8d6..9ae77ccef8cd 100644 --- a/lib/galaxy/workflow/reports/generators/markdown.py +++ b/lib/galaxy/workflow/reports/generators/markdown.py @@ -1,5 +1,6 @@ """The class defines the default stock Galaxy workflow reporting plugin """ + import logging import string diff --git a/lib/galaxy/workflow/resources/__init__.py b/lib/galaxy/workflow/resources/__init__.py index d81e85d6e6c4..13e556531881 100644 --- a/lib/galaxy/workflow/resources/__init__.py +++ b/lib/galaxy/workflow/resources/__init__.py @@ -3,6 +3,7 @@ This file defines the baked in resource mapper types, and this package contains an example of a more open, pluggable approach with greater control. """ + import functools import logging import os diff --git a/lib/galaxy/workflow/schedulers/__init__.py b/lib/galaxy/workflow/schedulers/__init__.py index 9f619426e800..f4de8f4f9cad 100644 --- a/lib/galaxy/workflow/schedulers/__init__.py +++ b/lib/galaxy/workflow/schedulers/__init__.py @@ -2,6 +2,7 @@ for workflow scheduling is highly experimental and the interface required for scheduling plugins will almost certainly change. """ + from abc import ( ABCMeta, abstractmethod, diff --git a/lib/galaxy/workflow/schedulers/core.py b/lib/galaxy/workflow/schedulers/core.py index 427e23f48181..26ae929729d1 100644 --- a/lib/galaxy/workflow/schedulers/core.py +++ b/lib/galaxy/workflow/schedulers/core.py @@ -1,6 +1,7 @@ """ The class defines the stock Galaxy workflow scheduling plugin - currently it simply schedules the whole workflow up front when offered. """ + import logging from typing import TYPE_CHECKING diff --git a/lib/galaxy/workflow/steps.py b/lib/galaxy/workflow/steps.py index f1cb776c9b94..8810e1b78771 100644 --- a/lib/galaxy/workflow/steps.py +++ b/lib/galaxy/workflow/steps.py @@ -1,6 +1,7 @@ """ This module contains utility methods for reasoning about and ordering workflow steps. """ + import math from galaxy.util.topsort import ( @@ -79,7 +80,7 @@ def order_workflow_steps(steps, comments): for step in steps: step.position = { "left": step.position["left"] - min_left, - "top": step.position["top"] - min_top + "top": step.position["top"] - min_top, # other position attributes can be discarded if present } diff --git a/lib/galaxy_ext/expressions/handle_job.py b/lib/galaxy_ext/expressions/handle_job.py index 17289028c211..fc9838d381b9 100644 --- a/lib/galaxy_ext/expressions/handle_job.py +++ b/lib/galaxy_ext/expressions/handle_job.py @@ -3,6 +3,7 @@ Galaxy should be importable on sys.path . """ + import json import logging import os diff --git a/lib/galaxy_test/api/test_workflows_cwl.py b/lib/galaxy_test/api/test_workflows_cwl.py index fce0792e5328..b9af5cbc1e2f 100644 --- a/lib/galaxy_test/api/test_workflows_cwl.py +++ b/lib/galaxy_test/api/test_workflows_cwl.py @@ -1,4 +1,5 @@ """Test CWL workflow functionality.""" + from galaxy_test.api.test_workflows import BaseWorkflowsApiTestCase from galaxy_test.base.populators import CwlPopulator diff --git a/lib/galaxy_test/base/api_asserts.py b/lib/galaxy_test/base/api_asserts.py index d31c6ca91cff..9b3e8c1f3daf 100644 --- a/lib/galaxy_test/base/api_asserts.py +++ b/lib/galaxy_test/base/api_asserts.py @@ -1,5 +1,6 @@ """Utility methods for making assertions about Galaxy API responses, etc... """ + from typing import ( Any, cast, diff --git a/lib/galaxy_test/base/decorators.py b/lib/galaxy_test/base/decorators.py index 710f7eda54ea..324d6e9ea884 100644 --- a/lib/galaxy_test/base/decorators.py +++ b/lib/galaxy_test/base/decorators.py @@ -8,6 +8,7 @@ jobs, workflows, and datasets will be created. But tests creating new published objects, histories, libraries, etc... should be annotated ideally. """ + import os import unittest from functools import wraps diff --git a/lib/galaxy_test/base/env.py b/lib/galaxy_test/base/env.py index ad652ac8c62f..0caee6da17f3 100644 --- a/lib/galaxy_test/base/env.py +++ b/lib/galaxy_test/base/env.py @@ -1,5 +1,6 @@ """Base utilities for working Galaxy test environments. """ + import fcntl import os import socket diff --git a/lib/galaxy_test/base/populators.py b/lib/galaxy_test/base/populators.py index 82490889e1f1..aa94305c60f5 100644 --- a/lib/galaxy_test/base/populators.py +++ b/lib/galaxy_test/base/populators.py @@ -37,6 +37,7 @@ requests should just be filtered through the verb abstractions if that functionality is then added to populators to be shared across tests or across testing frameworks. """ + import base64 import contextlib import json @@ -3210,7 +3211,6 @@ def _url(self, route): class GiDatasetPopulator(GiHttpMixin, BaseDatasetPopulator): - """Implementation of BaseDatasetPopulator backed by bioblend.""" def __init__(self, gi): @@ -3222,7 +3222,6 @@ def _summarize_history(self, history_id: str) -> None: class GiDatasetCollectionPopulator(GiHttpMixin, BaseDatasetCollectionPopulator): - """Implementation of BaseDatasetCollectionPopulator backed by bioblend.""" def __init__(self, gi): @@ -3237,7 +3236,6 @@ def _create_collection(self, payload): class GiWorkflowPopulator(GiHttpMixin, BaseWorkflowPopulator): - """Implementation of BaseWorkflowPopulator backed by bioblend.""" def __init__(self, gi): diff --git a/lib/galaxy_test/base/uses_shed_api.py b/lib/galaxy_test/base/uses_shed_api.py index 58a2c74522a7..f617c5745f42 100644 --- a/lib/galaxy_test/base/uses_shed_api.py +++ b/lib/galaxy_test/base/uses_shed_api.py @@ -22,8 +22,7 @@ class UsesShedApi: @property @abc.abstractmethod - def galaxy_interactor(self) -> GalaxyInteractorApi: - ... + def galaxy_interactor(self) -> GalaxyInteractorApi: ... def delete_repo_request(self, payload: Dict[str, Any]) -> Response: return self.galaxy_interactor._delete("tool_shed_repositories", data=payload, admin=True) diff --git a/lib/galaxy_test/driver/driver_util.py b/lib/galaxy_test/driver/driver_util.py index ee79b007f000..2016e64ce3c9 100644 --- a/lib/galaxy_test/driver/driver_util.py +++ b/lib/galaxy_test/driver/driver_util.py @@ -244,9 +244,9 @@ def setup_galaxy_config( if default_shed_tool_data_table_config: config["shed_tool_data_table_config"] = default_shed_tool_data_table_config if not use_shared_connection_for_amqp: - config[ - "amqp_internal_connection" - ] = f"sqlalchemy+sqlite:///{os.path.join(tmpdir, 'control.sqlite')}?isolation_level=IMMEDIATE" + config["amqp_internal_connection"] = ( + f"sqlalchemy+sqlite:///{os.path.join(tmpdir, 'control.sqlite')}?isolation_level=IMMEDIATE" + ) config.update(database_conf(tmpdir, prefer_template_database=prefer_template_database)) config.update(install_database_conf(tmpdir, default_merged=default_install_db_merged)) diff --git a/lib/galaxy_test/driver/integration_setup.py b/lib/galaxy_test/driver/integration_setup.py index f86c26788fdb..b63b567247ea 100644 --- a/lib/galaxy_test/driver/integration_setup.py +++ b/lib/galaxy_test/driver/integration_setup.py @@ -1,6 +1,7 @@ """ Test classes that should be shared between test scenarios. """ + import os import shutil from tempfile import mkdtemp diff --git a/lib/galaxy_test/driver/integration_util.py b/lib/galaxy_test/driver/integration_util.py index 1a38759c13f2..af8b56833380 100644 --- a/lib/galaxy_test/driver/integration_util.py +++ b/lib/galaxy_test/driver/integration_util.py @@ -4,6 +4,7 @@ order to test something that cannot be tested with the default functional/api testing configuration. """ + import os import re from typing import ( diff --git a/lib/galaxy_test/driver/uses_shed.py b/lib/galaxy_test/driver/uses_shed.py index 132a54011437..e592de25aefd 100644 --- a/lib/galaxy_test/driver/uses_shed.py +++ b/lib/galaxy_test/driver/uses_shed.py @@ -38,8 +38,7 @@ class UsesShed(UsesShedApi): @property @abc.abstractmethod - def _app(self) -> UniverseApplication: - ... + def _app(self) -> UniverseApplication: ... shed_tools_dir: ClassVar[str] shed_tool_data_dir: ClassVar[str] diff --git a/lib/galaxy_test/selenium/framework.py b/lib/galaxy_test/selenium/framework.py index 23d18b3f7478..7fc13f447204 100644 --- a/lib/galaxy_test/selenium/framework.py +++ b/lib/galaxy_test/selenium/framework.py @@ -779,7 +779,6 @@ def _put(self, route, data=None, headers=None, admin=False, json: bool = False) class SeleniumSessionDatasetPopulator(SeleniumSessionGetPostMixin, populators.BaseDatasetPopulator): - """Implementation of BaseDatasetPopulator backed by bioblend.""" def __init__(self, selenium_context: GalaxySeleniumContext): @@ -791,7 +790,6 @@ def _summarize_history(self, history_id: str) -> None: class SeleniumSessionDatasetCollectionPopulator(SeleniumSessionGetPostMixin, populators.BaseDatasetCollectionPopulator): - """Implementation of BaseDatasetCollectionPopulator backed by bioblend.""" def __init__(self, selenium_context: GalaxySeleniumContext): @@ -807,7 +805,6 @@ def _create_collection(self, payload: dict) -> Response: class SeleniumSessionWorkflowPopulator( SeleniumSessionGetPostMixin, populators.BaseWorkflowPopulator, ImporterGalaxyInterface ): - """Implementation of BaseWorkflowPopulator backed by bioblend.""" def __init__(self, selenium_context: GalaxySeleniumContext): diff --git a/lib/galaxy_test/selenium/jupyter_context.py b/lib/galaxy_test/selenium/jupyter_context.py index affd943407fa..759cdb3bcbf1 100644 --- a/lib/galaxy_test/selenium/jupyter_context.py +++ b/lib/galaxy_test/selenium/jupyter_context.py @@ -4,6 +4,7 @@ both Selenium for testing Galaxy with a browser and API populators for filling in fixture data rapidly in the target Galaxy. """ + from typing import Optional from galaxy.selenium.context import init as base_init diff --git a/lib/tool_shed/context.py b/lib/tool_shed/context.py index 107be8c8ed48..613c52b79a36 100644 --- a/lib/tool_shed/context.py +++ b/lib/tool_shed/context.py @@ -81,28 +81,22 @@ def repositories_hostname(self) -> str: class SessionRequestContext(ProvidesRepositoriesContext, Protocol): @abc.abstractmethod - def get_galaxy_session(self) -> Optional[GalaxySession]: - ... + def get_galaxy_session(self) -> Optional[GalaxySession]: ... @abc.abstractmethod - def set_galaxy_session(self, galaxy_session: GalaxySession): - ... + def set_galaxy_session(self, galaxy_session: GalaxySession): ... @abc.abstractproperty - def request(self) -> GalaxyAbstractRequest: - ... + def request(self) -> GalaxyAbstractRequest: ... @abc.abstractproperty - def response(self) -> GalaxyAbstractResponse: - ... + def response(self) -> GalaxyAbstractResponse: ... @abc.abstractmethod - def url_builder(self): - ... + def url_builder(self): ... @abc.abstractproperty - def session_csrf_token(self) -> str: - ... + def session_csrf_token(self) -> str: ... class SessionRequestContextImpl(SessionRequestContext): diff --git a/lib/tool_shed/managers/groups.py b/lib/tool_shed/managers/groups.py index 8ade7cb76c92..280f1e685995 100644 --- a/lib/tool_shed/managers/groups.py +++ b/lib/tool_shed/managers/groups.py @@ -1,6 +1,7 @@ """ Manager and Serializer for TS groups. """ + import logging from sqlalchemy import ( diff --git a/lib/tool_shed/managers/repositories.py b/lib/tool_shed/managers/repositories.py index 3d3c2ca8df0f..79fbb68cc0d5 100644 --- a/lib/tool_shed/managers/repositories.py +++ b/lib/tool_shed/managers/repositories.py @@ -1,6 +1,7 @@ """ Manager and Serializer for TS repositories. """ + import json import logging from collections import namedtuple diff --git a/lib/tool_shed/repository_types/registry.py b/lib/tool_shed/repository_types/registry.py index 3b1d461698e5..ec73bd9fd5c5 100644 --- a/lib/tool_shed/repository_types/registry.py +++ b/lib/tool_shed/repository_types/registry.py @@ -13,12 +13,12 @@ class Registry: def __init__(self): self.repository_types_by_label = {} self.repository_types_by_label["unrestricted"] = unrestricted.Unrestricted() - self.repository_types_by_label[ - "repository_suite_definition" - ] = repository_suite_definition.RepositorySuiteDefinition() - self.repository_types_by_label[ - "tool_dependency_definition" - ] = tool_dependency_definition.ToolDependencyDefinition() + self.repository_types_by_label["repository_suite_definition"] = ( + repository_suite_definition.RepositorySuiteDefinition() + ) + self.repository_types_by_label["tool_dependency_definition"] = ( + tool_dependency_definition.ToolDependencyDefinition() + ) def get_class_by_label(self, label): return self.repository_types_by_label.get(label, None) diff --git a/lib/tool_shed/webapp/api/authenticate.py b/lib/tool_shed/webapp/api/authenticate.py index 1d1cee2fa787..dc5bee6d5ad6 100644 --- a/lib/tool_shed/webapp/api/authenticate.py +++ b/lib/tool_shed/webapp/api/authenticate.py @@ -15,6 +15,7 @@ } """ + import logging from galaxy.web import expose_api_anonymous_and_sessionless diff --git a/lib/tool_shed/webapp/api/configuration.py b/lib/tool_shed/webapp/api/configuration.py index 920baeb670b5..3a9dda15f362 100644 --- a/lib/tool_shed/webapp/api/configuration.py +++ b/lib/tool_shed/webapp/api/configuration.py @@ -2,6 +2,7 @@ API operations allowing clients to determine Tool Shed instance's capabilities and configuration settings. """ + import logging from galaxy.web import expose_api_anonymous_and_sessionless diff --git a/lib/tool_shed/webapp/api/repositories.py b/lib/tool_shed/webapp/api/repositories.py index a5b6f1a9854a..08a89df60088 100644 --- a/lib/tool_shed/webapp/api/repositories.py +++ b/lib/tool_shed/webapp/api/repositories.py @@ -102,9 +102,9 @@ def add_repository_registry_entry(self, trans, payload, **kwd): # Update the repository registry. self.app.repository_registry.add_entry(repository) response_dict["status"] = "ok" - response_dict[ - "message" - ] = f"Entries for repository {name} owned by {owner} have been added to the Tool Shed repository registry." + response_dict["message"] = ( + f"Entries for repository {name} owned by {owner} have been added to the Tool Shed repository registry." + ) return response_dict @web.legacy_expose_api_anonymous @@ -317,9 +317,9 @@ def remove_repository_registry_entry(self, trans, payload, **kwd): response_dict = {} if not trans.user_is_admin: response_dict["status"] = "error" - response_dict[ - "message" - ] = "You are not authorized to remove entries from this Tool Shed's repository registry." + response_dict["message"] = ( + "You are not authorized to remove entries from this Tool Shed's repository registry." + ) return response_dict tool_shed_url = payload.get("tool_shed_url", "") if not tool_shed_url: @@ -341,9 +341,9 @@ def remove_repository_registry_entry(self, trans, payload, **kwd): # Update the repository registry. self.app.repository_registry.remove_entry(repository) response_dict["status"] = "ok" - response_dict[ - "message" - ] = f"Entries for repository {name} owned by {owner} have been removed from the Tool Shed repository registry." + response_dict["message"] = ( + f"Entries for repository {name} owned by {owner} have been removed from the Tool Shed repository registry." + ) return response_dict @web.legacy_expose_api diff --git a/lib/tool_shed/webapp/buildapp.py b/lib/tool_shed/webapp/buildapp.py index e25859c33be6..c74928f3cc6b 100644 --- a/lib/tool_shed/webapp/buildapp.py +++ b/lib/tool_shed/webapp/buildapp.py @@ -1,6 +1,7 @@ """ Provides factory methods to assemble the Galaxy web application """ + import atexit import logging import os diff --git a/lib/tool_shed/webapp/config.py b/lib/tool_shed/webapp/config.py index 4511b54e1cd7..9c0e3d44964a 100644 --- a/lib/tool_shed/webapp/config.py +++ b/lib/tool_shed/webapp/config.py @@ -1,6 +1,7 @@ """ Universe configuration builder. """ + import configparser import logging import logging.config diff --git a/lib/tool_shed/webapp/controllers/repository.py b/lib/tool_shed/webapp/controllers/repository.py index d471402aa7d1..f8d3facee1b4 100644 --- a/lib/tool_shed/webapp/controllers/repository.py +++ b/lib/tool_shed/webapp/controllers/repository.py @@ -975,13 +975,13 @@ def find_tools(self, trans, **kwd): self.install_matched_repository_grid.operations = operations return self.install_matched_repository_grid(trans, **kwd) else: - kwd[ - "message" - ] = "tool id: {}
tool name: {}
tool version: {}
exact matches only: {}".format( - basic_util.stringify(tool_ids), - escape(basic_util.stringify(tool_names)), - escape(basic_util.stringify(tool_versions)), - exact_matches_checked, + kwd["message"] = ( + "tool id: {}
tool name: {}
tool version: {}
exact matches only: {}".format( + basic_util.stringify(tool_ids), + escape(basic_util.stringify(tool_names)), + escape(basic_util.stringify(tool_versions)), + exact_matches_checked, + ) ) self.matched_repository_grid.title = "Repositories with matching tools" return self.matched_repository_grid(trans, **kwd) @@ -1032,9 +1032,9 @@ def has_galaxy_utilities(repository_metadata): has_repository_dependencies_only_if_compiling_contained_td, ) = repository_util.get_repository_dependency_types(repository_dependencies) has_galaxy_utilities_dict["has_repository_dependencies"] = has_repository_dependencies - has_galaxy_utilities_dict[ - "has_repository_dependencies_only_if_compiling_contained_td" - ] = has_repository_dependencies_only_if_compiling_contained_td + has_galaxy_utilities_dict["has_repository_dependencies_only_if_compiling_contained_td"] = ( + has_repository_dependencies_only_if_compiling_contained_td + ) if "workflows" in metadata: has_galaxy_utilities_dict["includes_workflows"] = True return has_galaxy_utilities_dict @@ -1127,9 +1127,9 @@ def has_galaxy_utilities(repository_metadata): update_dict["includes_tool_dependencies"] = includes_tool_dependencies update_dict["includes_workflows"] = includes_workflows update_dict["has_repository_dependencies"] = has_repository_dependencies - update_dict[ - "has_repository_dependencies_only_if_compiling_contained_td" - ] = has_repository_dependencies_only_if_compiling_contained_td + update_dict["has_repository_dependencies_only_if_compiling_contained_td"] = ( + has_repository_dependencies_only_if_compiling_contained_td + ) update_dict["changeset_revision"] = str(latest_changeset_revision) update_dict["ctx_rev"] = str(update_to_ctx.rev()) return encoding_util.tool_shed_encode(update_dict) diff --git a/lib/tool_shed/webapp/framework/middleware/remoteuser.py b/lib/tool_shed/webapp/framework/middleware/remoteuser.py index d2c5bc678936..fff7395b2287 100644 --- a/lib/tool_shed/webapp/framework/middleware/remoteuser.py +++ b/lib/tool_shed/webapp/framework/middleware/remoteuser.py @@ -1,6 +1,7 @@ """ Middleware for handling $REMOTE_USER if use_remote_user is enabled. """ + import socket from galaxy.util import safe_str_cmp diff --git a/lib/tool_shed/webapp/model/mapping.py b/lib/tool_shed/webapp/model/mapping.py index 692d058977ec..0da07ef195c1 100644 --- a/lib/tool_shed/webapp/model/mapping.py +++ b/lib/tool_shed/webapp/model/mapping.py @@ -2,6 +2,7 @@ Details of how the data model objects are mapped onto the relational database are encapsulated here. """ + import logging from typing import ( Any, diff --git a/lib/tool_shed/webapp/search/repo_search.py b/lib/tool_shed/webapp/search/repo_search.py index 1d8965f57702..b3fbb2edadba 100644 --- a/lib/tool_shed/webapp/search/repo_search.py +++ b/lib/tool_shed/webapp/search/repo_search.py @@ -1,4 +1,5 @@ """Module for searching the toolshed repositories""" + import logging import whoosh.index diff --git a/lib/tool_shed/webapp/search/tool_search.py b/lib/tool_shed/webapp/search/tool_search.py index bf3617c4cd38..f68aacabd489 100644 --- a/lib/tool_shed/webapp/search/tool_search.py +++ b/lib/tool_shed/webapp/search/tool_search.py @@ -1,4 +1,5 @@ """Module for searching the toolshed tools within all repositories""" + import logging import os diff --git a/lib/tool_shed/webapp/security/__init__.py b/lib/tool_shed/webapp/security/__init__.py index ce61f1dba1dd..10b7b4ed663a 100644 --- a/lib/tool_shed/webapp/security/__init__.py +++ b/lib/tool_shed/webapp/security/__init__.py @@ -1,4 +1,5 @@ """Tool Shed Security""" + import logging from typing import List diff --git a/scripts/celery_shell.py b/scripts/celery_shell.py index 72bcc98ede5f..aab6e90b231d 100644 --- a/scripts/celery_shell.py +++ b/scripts/celery_shell.py @@ -4,6 +4,7 @@ ipython -i scripts/celery_shell.py -- -c config/galaxy.yml ``` """ + import logging import os diff --git a/scripts/check_model.py b/scripts/check_model.py index 015e3509ac89..96cb66e9f562 100644 --- a/scripts/check_model.py +++ b/scripts/check_model.py @@ -3,6 +3,7 @@ Note: pass '-c /path/to/galaxy.yml' to use the database_connection set in galaxy.yml. Otherwise the default sqlite database will be used. """ + import json import os import sys diff --git a/scripts/dump_library_paths.py b/scripts/dump_library_paths.py index f3080c5118ff..504b348eb2fa 100644 --- a/scripts/dump_library_paths.py +++ b/scripts/dump_library_paths.py @@ -11,6 +11,7 @@ $ python dump_library_paths.py [options] --relative /srv/galaxy/datasets | rsync -arvPR \ --files-from=- /srv/galaxy/datasets backuphost:/backup/galaxy/datasets """ + import logging import os import sys diff --git a/scripts/extract_dataset_part.py b/scripts/extract_dataset_part.py index 82d05b544d51..62609e8b5800 100644 --- a/scripts/extract_dataset_part.py +++ b/scripts/extract_dataset_part.py @@ -6,6 +6,7 @@ on a gid in a scatter-gather mode. This does part of the scatter. """ + import json import logging import os diff --git a/scripts/manage_db.py b/scripts/manage_db.py index 49286a64cc13..ef180096f9d5 100644 --- a/scripts/manage_db.py +++ b/scripts/manage_db.py @@ -3,6 +3,7 @@ ansible galaxy and toolshed roles. For managing the database, please consult manage_db.sh. """ + import logging import os.path import sys diff --git a/test/integration/objectstore/test_objectstore_datatype_upload.py b/test/integration/objectstore/test_objectstore_datatype_upload.py index bdc78d219e7f..a31d878c3bc7 100644 --- a/test/integration/objectstore/test_objectstore_datatype_upload.py +++ b/test/integration/objectstore/test_objectstore_datatype_upload.py @@ -1,4 +1,5 @@ """Tests objectstores by exercising the datatype upload integration tests.""" + import os import string import subprocess diff --git a/test/integration/oidc/test_auth_oidc.py b/test/integration/oidc/test_auth_oidc.py index 09f809218b6b..10268225ef29 100644 --- a/test/integration/oidc/test_auth_oidc.py +++ b/test/integration/oidc/test_auth_oidc.py @@ -1,4 +1,5 @@ """Integration tests for the CLI shell plugins and runners.""" + import html import os import re diff --git a/test/integration/test_cli_runners.py b/test/integration/test_cli_runners.py index b240ebaf7cc3..aa41e9bdf360 100644 --- a/test/integration/test_cli_runners.py +++ b/test/integration/test_cli_runners.py @@ -1,4 +1,5 @@ """Integration tests for the CLI shell plugins and runners.""" + import os import string import subprocess diff --git a/test/integration/test_coexecution.py b/test/integration/test_coexecution.py index 4e542699a3b8..3bfb97561d44 100644 --- a/test/integration/test_coexecution.py +++ b/test/integration/test_coexecution.py @@ -11,6 +11,7 @@ GALAXY_TEST_PORT=9234 pytest test/integration/test_coexecution.py """ + import os import platform import random diff --git a/test/integration/test_container_resolvers.py b/test/integration/test_container_resolvers.py index f00efcfc3099..2188cf3f9bb2 100644 --- a/test/integration/test_container_resolvers.py +++ b/test/integration/test_container_resolvers.py @@ -303,8 +303,7 @@ def _check_status(self, status: Dict[str, Any], assumptions: Dict[str, Any]) -> # The remaining methods are implemented in IntegrationTestCase @property - def dataset_populator(self) -> DatasetPopulator: - ... + def dataset_populator(self) -> DatasetPopulator: ... def _assert_status_code_is(self, response: "Response", expected_status_code: int) -> None: """ diff --git a/test/integration/test_data_manager.py b/test/integration/test_data_manager.py index d6a42b00bae6..355f793b9170 100644 --- a/test/integration/test_data_manager.py +++ b/test/integration/test_data_manager.py @@ -42,7 +42,6 @@ class TestDataManagerIntegration(integration_util.IntegrationTestCase, UsesShed): - """Test data manager installation and table reload through the API""" framework_tool_and_types = True diff --git a/test/integration/test_data_manager_refgenie.py b/test/integration/test_data_manager_refgenie.py index 3af08162ab48..ac8d96ee852b 100644 --- a/test/integration/test_data_manager_refgenie.py +++ b/test/integration/test_data_manager_refgenie.py @@ -49,7 +49,6 @@ class TestDataManagerIntegration(integration_util.IntegrationTestCase, UsesShed): - """Test data manager installation and table reload through the API""" framework_tool_and_types = True diff --git a/test/integration/test_display_applications.py b/test/integration/test_display_applications.py index da79751480da..8b35021b4175 100644 --- a/test/integration/test_display_applications.py +++ b/test/integration/test_display_applications.py @@ -19,9 +19,9 @@ def test_get_display_application_links(self, history_id): for display_app_url in self._setup_igv_datasets(history_id=history_id, instance_url=instance_url): # wait for eventual conversion to finish wait_on( - lambda display_app_url=display_app_url: True - if self._get(display_app_url, allow_redirects=False).status_code == 302 - else None, + lambda display_app_url=display_app_url: ( + True if self._get(display_app_url, allow_redirects=False).status_code == 302 else None + ), "display application to become ready", timeout=60, ) diff --git a/test/integration/test_extended_metadata.py b/test/integration/test_extended_metadata.py index 11d259bf456f..ea433f5c2fab 100644 --- a/test/integration/test_extended_metadata.py +++ b/test/integration/test_extended_metadata.py @@ -1,4 +1,5 @@ """Integration tests for the Pulsar embedded runner.""" + from galaxy_test.base.populators import ( DatasetPopulator, LibraryPopulator, diff --git a/test/integration/test_flush_per_n_datasets.py b/test/integration/test_flush_per_n_datasets.py index 03dad07e948b..80daf9e0c730 100644 --- a/test/integration/test_flush_per_n_datasets.py +++ b/test/integration/test_flush_per_n_datasets.py @@ -1,4 +1,5 @@ """Integration tests for the flush_per_n_datasets setting.""" + from galaxy_test.driver import integration_util diff --git a/test/integration/test_interactivetools_api.py b/test/integration/test_interactivetools_api.py index 5d59c9f07557..7058070be0bc 100644 --- a/test/integration/test_interactivetools_api.py +++ b/test/integration/test_interactivetools_api.py @@ -1,4 +1,5 @@ """Integration tests for realtime tools.""" + import os import tempfile from typing import ( diff --git a/test/integration/test_job_files.py b/test/integration/test_job_files.py index 1c14ce81f284..cf43c2416813 100644 --- a/test/integration/test_job_files.py +++ b/test/integration/test_job_files.py @@ -14,6 +14,7 @@ integration tests avoid - but @jmchilton's fear of not touching this API has gone too far. """ + import io import os import tempfile diff --git a/test/integration/test_kubernetes_runner.py b/test/integration/test_kubernetes_runner.py index 728d2a4fbfdd..c751734353e2 100644 --- a/test/integration/test_kubernetes_runner.py +++ b/test/integration/test_kubernetes_runner.py @@ -1,4 +1,5 @@ """Integration tests for the Kubernetes runner.""" + # Tested on docker for mac 18.06.1-ce-mac73 using the default kubernetes setup, # also works on minikube import collections @@ -345,12 +346,10 @@ def test_exit_code_127(self, history_id: str) -> None: external_id = job.job_runner_external_id @overload - def get_kubectl_logs(allow_wait: Literal[False]) -> str: - ... + def get_kubectl_logs(allow_wait: Literal[False]) -> str: ... @overload - def get_kubectl_logs(allow_wait: bool = True) -> Optional[str]: - ... + def get_kubectl_logs(allow_wait: bool = True) -> Optional[str]: ... def get_kubectl_logs(allow_wait: bool = True) -> Optional[str]: log_cmd = ["kubectl", "logs", "-l", f"job-name={external_id}"] diff --git a/test/integration/test_max_discovered_files.py b/test/integration/test_max_discovered_files.py index f78e22bba663..7bcbca1659b0 100644 --- a/test/integration/test_max_discovered_files.py +++ b/test/integration/test_max_discovered_files.py @@ -1,4 +1,5 @@ """Integration tests for max_discoverd_files setting.""" + from galaxy_test.base.populators import DatasetPopulator from galaxy_test.driver import integration_util diff --git a/test/integration/test_remote_files_histories.py b/test/integration/test_remote_files_histories.py index 4996a6b76e5c..e6d98f913d04 100644 --- a/test/integration/test_remote_files_histories.py +++ b/test/integration/test_remote_files_histories.py @@ -1,4 +1,5 @@ """Test history import/export from galaxy.files plugins.""" + import os from .test_remote_files import ConfiguresRemoteFilesIntegrationTestCase diff --git a/test/integration/test_repository_operations.py b/test/integration/test_repository_operations.py index 95e0c97d912b..551d3a24125d 100644 --- a/test/integration/test_repository_operations.py +++ b/test/integration/test_repository_operations.py @@ -20,7 +20,6 @@ class TestRepositoryInstallIntegrationTestCase(integration_util.IntegrationTestCase, UsesShed): - """Test data manager installation and table reload through the API""" @classmethod diff --git a/test/integration/test_resolvers.py b/test/integration/test_resolvers.py index 70cce560adcd..242974ac2bef 100644 --- a/test/integration/test_resolvers.py +++ b/test/integration/test_resolvers.py @@ -1,4 +1,5 @@ """Integration tests for dependency resolution.""" + import os from tempfile import mkdtemp from typing import ClassVar @@ -10,7 +11,6 @@ class TestCondaResolutionIntegration(integration_util.IntegrationTestCase): - """Test conda dependency resolution through API.""" framework_tool_and_types = True diff --git a/test/integration/test_shed_tool_tests.py b/test/integration/test_shed_tool_tests.py index 93f1c750a49f..b1b35b33223c 100644 --- a/test/integration/test_shed_tool_tests.py +++ b/test/integration/test_shed_tool_tests.py @@ -4,7 +4,6 @@ class TestToolShedToolTestIntegration(integration_util.IntegrationTestCase, UsesShed): - """Test data manager installation and table reload through the API""" framework_tool_and_types = True diff --git a/test/integration/test_web_framework_config.py b/test/integration/test_web_framework_config.py index ffc72c8055f7..d617eed03ae4 100644 --- a/test/integration/test_web_framework_config.py +++ b/test/integration/test_web_framework_config.py @@ -1,4 +1,5 @@ """Integration tests for framework configuration code.""" + from requests import options from galaxy_test.driver import integration_util diff --git a/test/integration/test_workflow_tasks.py b/test/integration/test_workflow_tasks.py index d65f8eea6151..c250b624439f 100644 --- a/test/integration/test_workflow_tasks.py +++ b/test/integration/test_workflow_tasks.py @@ -3,6 +3,7 @@ Someday when the API tests can safely assume the target Galaxy has tasks enabled, this should be moved into the API test suite. """ + import json import os from typing import ( diff --git a/test/unit/app/managers/test_CollectionManager.py b/test/unit/app/managers/test_CollectionManager.py index 3e7e17a8bbcb..c6146dd3f78f 100644 --- a/test/unit/app/managers/test_CollectionManager.py +++ b/test/unit/app/managers/test_CollectionManager.py @@ -100,7 +100,7 @@ def test_update_from_dict(self): "deleted": True, "visible": False, "name": "New Name", - "tags": ["name:one", "group:two", "three"] + "tags": ["name:one", "group:two", "three"], # TODO: doesn't work # 'annotations' : [?] }, diff --git a/test/unit/app/managers/test_DatasetManager.py b/test/unit/app/managers/test_DatasetManager.py index 8847b019f2a4..91f891829fb6 100644 --- a/test/unit/app/managers/test_DatasetManager.py +++ b/test/unit/app/managers/test_DatasetManager.py @@ -1,5 +1,6 @@ """ """ + from unittest import mock import sqlalchemy diff --git a/test/unit/app/managers/test_HistoryContentsManager.py b/test/unit/app/managers/test_HistoryContentsManager.py index 0b2a07c45824..df260460a451 100644 --- a/test/unit/app/managers/test_HistoryContentsManager.py +++ b/test/unit/app/managers/test_HistoryContentsManager.py @@ -1,5 +1,6 @@ """ """ + import datetime import random diff --git a/test/unit/app/managers/test_UserManager.py b/test/unit/app/managers/test_UserManager.py index ea606f7743c7..871daac25c8f 100644 --- a/test/unit/app/managers/test_UserManager.py +++ b/test/unit/app/managers/test_UserManager.py @@ -3,6 +3,7 @@ Executable directly using: python -m test.unit.managers.test_UserManager """ + from datetime import datetime from unittest.mock import patch diff --git a/test/unit/app/managers/test_markdown_to_html.py b/test/unit/app/managers/test_markdown_to_html.py index 36cd2313168e..59cbc58f93e5 100644 --- a/test/unit/app/managers/test_markdown_to_html.py +++ b/test/unit/app/managers/test_markdown_to_html.py @@ -4,6 +4,7 @@ HTML content - best to test in insolation and verify the security of our dependencies. """ + from galaxy.managers.markdown_util import to_html diff --git a/test/unit/app/test_dbscript.py b/test/unit/app/test_dbscript.py index 4fd3da64ff8c..a5abf8951c07 100644 --- a/test/unit/app/test_dbscript.py +++ b/test/unit/app/test_dbscript.py @@ -4,6 +4,7 @@ - Use alembic api for setup and accessing the database. - Run command as subprocess, verify captured output + database state. """ + import os from typing import NewType diff --git a/test/unit/app/test_galaxy_install.py b/test/unit/app/test_galaxy_install.py index 021bfdfd12ec..1695e8faebc2 100644 --- a/test/unit/app/test_galaxy_install.py +++ b/test/unit/app/test_galaxy_install.py @@ -3,6 +3,7 @@ It should be able to quickly test installing things from the real tool shed and from bootstrapped tool sheds. """ + from pathlib import Path from typing import ( Any, diff --git a/test/unit/app/tools/test_collect_primary_datasets.py b/test/unit/app/tools/test_collect_primary_datasets.py index 40618ca9207b..16f3c6aae13e 100644 --- a/test/unit/app/tools/test_collect_primary_datasets.py +++ b/test/unit/app/tools/test_collect_primary_datasets.py @@ -377,15 +377,13 @@ def _replace_output_collectors(self, xml_str): # Rewrite tool as if it had been created with output containing # supplied dataset_collector elem. elem = util.parse_xml_string(xml_str) - self.tool.outputs[ - DEFAULT_TOOL_OUTPUT - ].dataset_collector_descriptions = output_collection_def.dataset_collector_descriptions_from_elem(elem) + self.tool.outputs[DEFAULT_TOOL_OUTPUT].dataset_collector_descriptions = ( + output_collection_def.dataset_collector_descriptions_from_elem(elem) + ) def _replace_output_collectors_from_dict(self, output_dict): - self.tool.outputs[ - DEFAULT_TOOL_OUTPUT - ].dataset_collector_descriptions = output_collection_def.dataset_collector_descriptions_from_output_dict( - output_dict + self.tool.outputs[DEFAULT_TOOL_OUTPUT].dataset_collector_descriptions = ( + output_collection_def.dataset_collector_descriptions_from_output_dict(output_dict) ) def _append_job_json(self, object, output_path=None, line_type="new_primary_dataset"): diff --git a/test/unit/app/tools/test_column_parameters.py b/test/unit/app/tools/test_column_parameters.py index 690292ed6d1d..f61a914e9182 100644 --- a/test/unit/app/tools/test_column_parameters.py +++ b/test/unit/app/tools/test_column_parameters.py @@ -1,6 +1,7 @@ """ Tests for tool parameters, more tests exist in test_data_parameters.py and test_select_parameters.py. """ + from galaxy import model from galaxy.app_unittest_utils.tools_support import datatypes_registry from galaxy.model.base import transaction diff --git a/test/unit/app/tools/test_execution.py b/test/unit/app/tools/test_execution.py index 0079a75dcb71..7e34757ec55d 100644 --- a/test/unit/app/tools/test_execution.py +++ b/test/unit/app/tools/test_execution.py @@ -1,5 +1,6 @@ """ Test Tool execution and state handling logic. """ + from collections import OrderedDict from typing import cast diff --git a/test/unit/app/tools/test_tool_external_files.py b/test/unit/app/tools/test_tool_external_files.py index b013f4eb9a42..e70e0c29d5af 100644 --- a/test/unit/app/tools/test_tool_external_files.py +++ b/test/unit/app/tools/test_tool_external_files.py @@ -1,6 +1,7 @@ """ Unit test logic related to finding externally referenced files in tool descriptions. """ + import os import shutil import tempfile diff --git a/test/unit/app/visualizations/plugins/test_VisualizationPlugin.py b/test/unit/app/visualizations/plugins/test_VisualizationPlugin.py index 3f94386df36b..bada3b4b4e62 100644 --- a/test/unit/app/visualizations/plugins/test_VisualizationPlugin.py +++ b/test/unit/app/visualizations/plugins/test_VisualizationPlugin.py @@ -1,6 +1,7 @@ """ Test lib/galaxy/visualization/plugins/plugin. """ + from galaxy.app_unittest_utils import galaxy_mock from galaxy.util import clean_multiline_string from galaxy.visualization.plugins import ( diff --git a/test/unit/app/visualizations/plugins/test_VisualizationsRegistry.py b/test/unit/app/visualizations/plugins/test_VisualizationsRegistry.py index c32a0303f9d7..1c7f9707f047 100644 --- a/test/unit/app/visualizations/plugins/test_VisualizationsRegistry.py +++ b/test/unit/app/visualizations/plugins/test_VisualizationsRegistry.py @@ -1,6 +1,7 @@ """ Test lib/galaxy/visualization/plugins/registry. """ + import os from galaxy.app_unittest_utils import galaxy_mock diff --git a/test/unit/data/datatypes/dataproviders/test_base_dataproviders.py b/test/unit/data/datatypes/dataproviders/test_base_dataproviders.py index a96e6f2c97f9..95c1d68e679e 100644 --- a/test/unit/data/datatypes/dataproviders/test_base_dataproviders.py +++ b/test/unit/data/datatypes/dataproviders/test_base_dataproviders.py @@ -2,6 +2,7 @@ Unit tests for base DataProviders. .. seealso:: galaxy.datatypes.dataproviders.base """ + import os import tempfile from io import StringIO diff --git a/test/unit/data/datatypes/dataproviders/test_line_dataproviders.py b/test/unit/data/datatypes/dataproviders/test_line_dataproviders.py index 091cc7f6e55c..67d1eeb2aaff 100644 --- a/test/unit/data/datatypes/dataproviders/test_line_dataproviders.py +++ b/test/unit/data/datatypes/dataproviders/test_line_dataproviders.py @@ -2,6 +2,7 @@ Unit tests for base DataProviders. .. seealso:: galaxy.datatypes.dataproviders.base """ + import logging from typing import Type diff --git a/test/unit/data/datatypes/test_data.py b/test/unit/data/datatypes/test_data.py index 26c5bc3d2cfe..d36c81b76399 100644 --- a/test/unit/data/datatypes/test_data.py +++ b/test/unit/data/datatypes/test_data.py @@ -2,6 +2,7 @@ Unit tests for base DataTypes. .. seealso:: galaxy.datatypes.data """ + import os from galaxy.datatypes.anvio import AnvioStructureDB diff --git a/test/unit/data/model/migrations/testing_utils/versions/db1/2e8a580bc79a_drop_sqlachemymigrate_table.py b/test/unit/data/model/migrations/testing_utils/versions/db1/2e8a580bc79a_drop_sqlachemymigrate_table.py index d80b518976b8..dd9bc42c9278 100644 --- a/test/unit/data/model/migrations/testing_utils/versions/db1/2e8a580bc79a_drop_sqlachemymigrate_table.py +++ b/test/unit/data/model/migrations/testing_utils/versions/db1/2e8a580bc79a_drop_sqlachemymigrate_table.py @@ -5,6 +5,7 @@ Create Date: 2021-11-05 16:29:19.123118 """ + import sqlalchemy as sa from alembic import op diff --git a/test/unit/data/model/migrations/testing_utils/versions/db1/62695fac6cc0_create_gxy_test_branch.py b/test/unit/data/model/migrations/testing_utils/versions/db1/62695fac6cc0_create_gxy_test_branch.py index afc3204a3095..585557c497d7 100644 --- a/test/unit/data/model/migrations/testing_utils/versions/db1/62695fac6cc0_create_gxy_test_branch.py +++ b/test/unit/data/model/migrations/testing_utils/versions/db1/62695fac6cc0_create_gxy_test_branch.py @@ -6,7 +6,6 @@ """ - # revision identifiers, used by Alembic. revision = "62695fac6cc0" down_revision = None diff --git a/test/unit/data/model/migrations/testing_utils/versions/db1/e02cef55763c_add_gxy_table3.py b/test/unit/data/model/migrations/testing_utils/versions/db1/e02cef55763c_add_gxy_table3.py index 37f9a596f95f..2d0989c7a69a 100644 --- a/test/unit/data/model/migrations/testing_utils/versions/db1/e02cef55763c_add_gxy_table3.py +++ b/test/unit/data/model/migrations/testing_utils/versions/db1/e02cef55763c_add_gxy_table3.py @@ -5,6 +5,7 @@ Create Date: 2021-11-05 16:30:30.521436 """ + import sqlalchemy as sa from alembic import op diff --git a/test/unit/data/model/migrations/testing_utils/versions/db2/0e28bf2fb7b5_add_tsi_table3.py b/test/unit/data/model/migrations/testing_utils/versions/db2/0e28bf2fb7b5_add_tsi_table3.py index d692c9f4937b..a760a9dcef5f 100644 --- a/test/unit/data/model/migrations/testing_utils/versions/db2/0e28bf2fb7b5_add_tsi_table3.py +++ b/test/unit/data/model/migrations/testing_utils/versions/db2/0e28bf2fb7b5_add_tsi_table3.py @@ -5,6 +5,7 @@ Create Date: 2021-11-05 16:31:00.530235 """ + import sqlalchemy as sa from alembic import op diff --git a/test/unit/data/model/migrations/testing_utils/versions/db2/1bceec30363a_create_tsi_test_branch.py b/test/unit/data/model/migrations/testing_utils/versions/db2/1bceec30363a_create_tsi_test_branch.py index 7209e389f8e7..fc813443a764 100644 --- a/test/unit/data/model/migrations/testing_utils/versions/db2/1bceec30363a_create_tsi_test_branch.py +++ b/test/unit/data/model/migrations/testing_utils/versions/db2/1bceec30363a_create_tsi_test_branch.py @@ -6,7 +6,6 @@ """ - # revision identifiers, used by Alembic. revision = "1bceec30363a" down_revision = None diff --git a/test/unit/data/model/migrations/testing_utils/versions/db2/8364ef1cab05_drop_sqlachemymigrate_table.py b/test/unit/data/model/migrations/testing_utils/versions/db2/8364ef1cab05_drop_sqlachemymigrate_table.py index ac4c9a98879b..1cdd4bcca92f 100644 --- a/test/unit/data/model/migrations/testing_utils/versions/db2/8364ef1cab05_drop_sqlachemymigrate_table.py +++ b/test/unit/data/model/migrations/testing_utils/versions/db2/8364ef1cab05_drop_sqlachemymigrate_table.py @@ -5,6 +5,7 @@ Create Date: 2021-11-05 16:30:51.369967 """ + import sqlalchemy as sa from alembic import op diff --git a/test/unit/data/model/test_mapping_testing_utils.py b/test/unit/data/model/test_mapping_testing_utils.py index 2b7e897afd3f..6424632422ab 100644 --- a/test/unit/data/model/test_mapping_testing_utils.py +++ b/test/unit/data/model/test_mapping_testing_utils.py @@ -1,6 +1,7 @@ """ This module contains tests for the utility functions in the test_mapping module. """ + import pytest from sqlalchemy import ( Column, diff --git a/test/unit/data/model/test_model_store.py b/test/unit/data/model/test_model_store.py index e9d222a9c159..0edb5377b016 100644 --- a/test/unit/data/model/test_model_store.py +++ b/test/unit/data/model/test_model_store.py @@ -1,4 +1,5 @@ """Unit tests for importing and exporting data from model stores.""" + import json import os import pathlib diff --git a/test/unit/files/_util.py b/test/unit/files/_util.py index 9d3277395da9..90e5696fd671 100644 --- a/test/unit/files/_util.py +++ b/test/unit/files/_util.py @@ -1,4 +1,5 @@ """Utilities for unit test suite for galaxy.files.""" + import os import tempfile diff --git a/test/unit/util/test_lazy_process.py b/test/unit/util/test_lazy_process.py index b3e41979c64a..bc113a33df6e 100644 --- a/test/unit/util/test_lazy_process.py +++ b/test/unit/util/test_lazy_process.py @@ -1,4 +1,5 @@ """Unit module for LazyProcess object in galaxy.util.lazy_process.""" + import os import tempfile import time diff --git a/test/unit/webapps/api/test_cbv.py b/test/unit/webapps/api/test_cbv.py index f683e2f47609..df3e9db3a5d0 100644 --- a/test/unit/webapps/api/test_cbv.py +++ b/test/unit/webapps/api/test_cbv.py @@ -2,6 +2,7 @@ Original implementation by David Montague (@dmontagu) https://github.com/dmontagu/fastapi-utils """ + from __future__ import annotations from typing import ( diff --git a/test/unit/webapps/test_webapp_base.py b/test/unit/webapps/test_webapp_base.py index 1fd4ef9c3f34..f304b3a42ad7 100644 --- a/test/unit/webapps/test_webapp_base.py +++ b/test/unit/webapps/test_webapp_base.py @@ -1,6 +1,7 @@ """ Unit tests for ``galaxy.web.framework.webapp`` """ + import logging import re from typing import ( diff --git a/tools/filters/sorter.py b/tools/filters/sorter.py index 50e81ddb419f..367aa4721ae9 100644 --- a/tools/filters/sorter.py +++ b/tools/filters/sorter.py @@ -2,6 +2,7 @@ Sorts tabular data on one or more columns. All comments of the file are collected and placed at the beginning of the sorted output file. """ + # 03/05/2013 guerler import argparse