diff --git a/lib/galaxy/authnz/custos_authnz.py b/lib/galaxy/authnz/custos_authnz.py index 6ce9aa4250f..579006246b2 100644 --- a/lib/galaxy/authnz/custos_authnz.py +++ b/lib/galaxy/authnz/custos_authnz.py @@ -265,7 +265,7 @@ class CustosAuthnz(IdentityProvider): def _load_config_for_custos(self): self.config['well_known_oidc_config_uri'] = self._get_well_known_uri_from_url(self.config['provider']) - self.config['credential_url'] = '/'.join([self.config['url'].rstrip('/'), 'credentials']) + self.config['credential_url'] = f"{self.config['url'].rstrip('/')}/credentials" self._get_custos_credentials() # Set custos endpoints clientIdAndSec = f"{self.config['client_id']}:{self.config['client_secret']}" diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index d4d6597f198..71c6395f753 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -2539,11 +2539,11 @@ class RDS(CompressedArchive): version = header_bytes[2:6] rversion = header_bytes[6:10] minrversion = header_bytes[10:14] - version = int("".join([str(_) for _ in version])) + version = int("".join(str(_) for _ in version)) if version not in [2, 3]: raise Exception() - rversion = int("".join([str(_) for _ in rversion])) - minrversion = int("".join([str(_) for _ in minrversion])) + rversion = int("".join(str(_) for _ in rversion)) + minrversion = int("".join(str(_) for _ in minrversion)) version = ".".join(str(version)) rversion = ".".join(str(rversion)) minrversion = ".".join(str(minrversion)) diff --git a/lib/galaxy/datatypes/dataproviders/line.py b/lib/galaxy/datatypes/dataproviders/line.py index c4707c553ce..3a95521e992 100644 --- a/lib/galaxy/datatypes/dataproviders/line.py +++ b/lib/galaxy/datatypes/dataproviders/line.py @@ -121,7 +121,7 @@ class RegexLineDataProvider(FilteredLineDataProvider): return line def filter_by_regex(self, line): - matches = any([regex.match(line) for regex in self.compiled_regex_list]) + matches = any(regex.match(line) for regex in self.compiled_regex_list) if self.invert: return line if not matches else None return line if matches else None diff --git a/lib/galaxy/datatypes/genetics.py b/lib/galaxy/datatypes/genetics.py index 05cbd35a8f4..6b32f006ebe 100644 --- a/lib/galaxy/datatypes/genetics.py +++ b/lib/galaxy/datatypes/genetics.py @@ -921,7 +921,7 @@ class GenotypeMatrix(LinkageStudies): return False try: - return all([int(sid) > 0 for sid in header_elems[1:]]) + return all(int(sid) > 0 for sid in header_elems[1:]) except ValueError: return False diff --git a/lib/galaxy/datatypes/goldenpath.py b/lib/galaxy/datatypes/goldenpath.py index 49292b0adb5..6f200a57fb4 100755 --- a/lib/galaxy/datatypes/goldenpath.py +++ b/lib/galaxy/datatypes/goldenpath.py @@ -193,7 +193,7 @@ class AGPFile: @property def num_lines(self): """ Calculate the number of lines in the current state of the AGP file. """ - return sum([len(self._comment_lines)] + [obj.num_lines for obj in self._objects]) + return len(self._comment_lines) + sum(obj.num_lines for obj in self._objects) def iterate_objs(self): """ Iterate over the objects of the AGP file. """ @@ -238,7 +238,7 @@ class AGPObject: self.add_line(in_agp_line) def __str__(self): - return "\n".join([str(i) for i in self._agp_lines]) + return "\n".join(str(i) for i in self._agp_lines) def __repr__(self): return f"AGP Object: {self.obj}" diff --git a/lib/galaxy/jobs/runners/pulsar.py b/lib/galaxy/jobs/runners/pulsar.py index 923afb2323e..f79c18f0cfb 100644 --- a/lib/galaxy/jobs/runners/pulsar.py +++ b/lib/galaxy/jobs/runners/pulsar.py @@ -652,7 +652,7 @@ class PulsarJobRunner(AsynchronousJobRunner): # Following check is a hack for jobs started during 19.01 or earlier release # and finishing with a 19.05 code base. Eliminate the hack in 19.09 or later # along with hacks for legacy metadata compute strategy. - if not os.path.exists(job_metrics_directory) or not any(["__instrument" in f for f in os.listdir(job_metrics_directory)]): + if not os.path.exists(job_metrics_directory) or not any("__instrument" in f for f in os.listdir(job_metrics_directory)): job_metrics_directory = job_wrapper.working_directory job_wrapper.finish( stdout, diff --git a/lib/galaxy/jobs/runners/util/job_script/__init__.py b/lib/galaxy/jobs/runners/util/job_script/__init__.py index d813f53144a..95c92f7b324 100644 --- a/lib/galaxy/jobs/runners/util/job_script/__init__.py +++ b/lib/galaxy/jobs/runners/util/job_script/__init__.py @@ -86,7 +86,7 @@ def job_script(template=DEFAULT_JOB_FILE_TEMPLATE, **kwds): >>> script.find('GALAXY_MEMORY_MB="32768"\\n') > 0 True """ - if any([param not in kwds for param in REQUIRED_TEMPLATE_PARAMS]): + if any(param not in kwds for param in REQUIRED_TEMPLATE_PARAMS): raise Exception("Failed to create job_script, a required parameter is missing.") job_instrumenter = kwds.get("job_instrumenter", None) if job_instrumenter: diff --git a/lib/galaxy/selenium/navigates_galaxy.py b/lib/galaxy/selenium/navigates_galaxy.py index 3c9a27f1179..f979cb15fd8 100644 --- a/lib/galaxy/selenium/navigates_galaxy.py +++ b/lib/galaxy/selenium/navigates_galaxy.py @@ -365,7 +365,7 @@ class NavigatesGalaxy(HasDriver): def history_has_hid(driver): hids = get_hids() - return any([h == hid for h in hids]) + return any(h == hid for h in hids) timeout = self.timeout_for(wait_type=WAIT_TYPES.JOB_COMPLETION) try: @@ -1698,7 +1698,7 @@ class NavigatesGalaxy(HasDriver): if contains is not None: if type(element) == list: - assert any([contains in el.text for el in element]), \ + assert any(contains in el.text for el in element), \ f"{contains} was not found in {[el.text for el in element]}" return diff --git a/lib/galaxy/tool_util/linters/inputs.py b/lib/galaxy/tool_util/linters/inputs.py index 1325b172288..90e4d6fe504 100644 --- a/lib/galaxy/tool_util/linters/inputs.py +++ b/lib/galaxy/tool_util/linters/inputs.py @@ -133,9 +133,9 @@ def lint_inputs(tool_xml, lint_ctx): lint_ctx.error(f"Select parameter [{param_name}] contains multiple options elements") # lint statically defined options - if any(['value' not in option.attrib for option in select_options]): + if any('value' not in option.attrib for option in select_options): lint_ctx.error(f"Select parameter [{param_name}] has option without value") - if any([option.text is None for option in select_options]): + if any(option.text is None for option in select_options): lint_ctx.warn(f"Select parameter [{param_name}] has option without text") if len(set(select_options_text)) != len(select_options_text): lint_ctx.error(f"Select parameter [{param_name}] has multiple options with the same text content") @@ -225,7 +225,7 @@ def lint_inputs(tool_xml, lint_ctx): if datasource: for datasource_tag in ('display', 'uihints'): - if not any([param.tag == datasource_tag for param in inputs]): + if not any(param.tag == datasource_tag for param in inputs): lint_ctx.info(f"{datasource_tag} tag usually present in data sources") if num_inputs: diff --git a/lib/galaxy/tools/wrappers.py b/lib/galaxy/tools/wrappers.py index cb9c0297938..f93cb7459ac 100644 --- a/lib/galaxy/tools/wrappers.py +++ b/lib/galaxy/tools/wrappers.py @@ -567,7 +567,7 @@ class DatasetListWrapper( if not self._dataset_elements_cache.get(group): wrappers = [] for element in self: - if any([t for t in element.tags if t.user_tname.lower() == 'group' and t.value.lower() == group]): + if any(t for t in element.tags if t.user_tname.lower() == 'group' and t.value.lower() == group): wrappers.append(element) self._dataset_elements_cache[group] = wrappers return self._dataset_elements_cache[group] @@ -652,7 +652,7 @@ class DatasetCollectionWrapper(ToolParameterValueWrapper, HasDatasets): if not self._dataset_elements_cache.get(group): wrappers = [] for element in self.collection.dataset_elements: - if any([t for t in element.dataset_instance.tags if t.user_tname.lower() == 'group' and t.value.lower() == group]): + if any(t for t in element.dataset_instance.tags if t.user_tname.lower() == 'group' and t.value.lower() == group): wrappers.append(self._dataset_wrapper(element.element_object, identifier=element.element_identifier, **self.kwargs)) self._dataset_elements_cache[group] = wrappers return self._dataset_elements_cache[group] diff --git a/lib/galaxy/web/framework/middleware/remoteuser.py b/lib/galaxy/web/framework/middleware/remoteuser.py index 3b6d1a0c2e4..e1e07d37e8e 100644 --- a/lib/galaxy/web/framework/middleware/remoteuser.py +++ b/lib/galaxy/web/framework/middleware/remoteuser.py @@ -172,10 +172,10 @@ class RemoteUser: # requests. pass elif environ[self.remote_user_header] in self.admin_users and \ - any([path_info.startswith(prefix) for prefix in admin_accessible_paths]): + any(path_info.startswith(prefix) for prefix in admin_accessible_paths): # If the user is an admin user, and any of the admin accessible paths match..., allow them to execute that action. pass - elif any([path_info.startswith(prefix) for prefix in user_accessible_paths]): + elif any(path_info.startswith(prefix) for prefix in user_accessible_paths): # If the user is allowed to access the path, pass pass elif path_info == '/user' or path_info == '/user/': diff --git a/lib/galaxy/web_stack/__init__.py b/lib/galaxy/web_stack/__init__.py index 211e952b8d8..5993d40d075 100644 --- a/lib/galaxy/web_stack/__init__.py +++ b/lib/galaxy/web_stack/__init__.py @@ -180,7 +180,7 @@ class ApplicationStack: return {} def has_base_pool(self, pool_name): - return self.has_pool(pool_name) or any([pool.startswith(f"{pool_name}.") for pool in self.configured_pools]) + return self.has_pool(pool_name) or any(pool.startswith(f"{pool_name}.") for pool in self.configured_pools) def has_pool(self, pool_name): return pool_name in self.configured_pools diff --git a/lib/galaxy/web_stack/handlers.py b/lib/galaxy/web_stack/handlers.py index 04077b36f55..d69460bfea2 100644 --- a/lib/galaxy/web_stack/handlers.py +++ b/lib/galaxy/web_stack/handlers.py @@ -124,7 +124,7 @@ class ConfiguresHandlers: method = method.lower() assert HANDLER_ASSIGNMENT_METHODS.has_value(method), \ "Invalid job handler assignment method '{}', must be one of: {}".format( - method, ', '.join([h.value for h in HANDLER_ASSIGNMENT_METHODS])) + method, ', '.join(h.value for h in HANDLER_ASSIGNMENT_METHODS)) try: self.handler_assignment_methods.append(method) except AttributeError: diff --git a/lib/galaxy_test/api/test_dataset_collections.py b/lib/galaxy_test/api/test_dataset_collections.py index 9cb8b8921b8..1acdff89134 100644 --- a/lib/galaxy_test/api/test_dataset_collections.py +++ b/lib/galaxy_test/api/test_dataset_collections.py @@ -443,7 +443,7 @@ class DatasetCollectionApiTestCase(ApiTestCase): actual: List[str] = [] for converter in converters.json(): actual.append(converter["tool_id"]) - assert sorted(actual) == sorted([]) + assert actual == [] def test_collection_tools_tag_propagation(self): elements = [{"src": "files", "tags": ["name:element_tag"]}] diff --git a/lib/galaxy_test/base/populators.py b/lib/galaxy_test/base/populators.py index d87ebe77fef..dcb71f320cb 100644 --- a/lib/galaxy_test/base/populators.py +++ b/lib/galaxy_test/base/populators.py @@ -739,19 +739,19 @@ class BaseDatasetPopulator(BasePopulator): def get_history_dataset_source_transform_actions(self, history_id: str, **kwd) -> Set[str]: details = self.get_history_dataset_details(history_id, **kwd) if "sources" not in details: - return set([]) + return set() sources = details["sources"] assert len(sources) <= 1 # We don't handle this use case yet. if len(sources) == 0: - return set([]) + return set() source_0 = sources[0] assert "transform" in source_0 transform = source_0["transform"] if transform is None: - return set([]) + return set() assert isinstance(transform, list) - return set([t["action"] for t in transform]) + return {t["action"] for t in transform} def get_history_dataset_details(self, history_id: str, **kwds) -> dict: dataset_id = self.__history_content_id(history_id, **kwds) diff --git a/lib/galaxy_test/selenium/test_tool_form.py b/lib/galaxy_test/selenium/test_tool_form.py index 597b599a2e2..73847564d5a 100644 --- a/lib/galaxy_test/selenium/test_tool_form.py +++ b/lib/galaxy_test/selenium/test_tool_form.py @@ -163,7 +163,7 @@ class ToolFormTestCase(SeleniumTestCase, UsesHistoryItemAssertions): tbody_element = tool_parameters_table.find_element_by_css_selector("tbody") tds = tbody_element.find_elements_by_css_selector("td") assert tds - assert any([expected_value in td.text for td in tds]) + assert any(expected_value in td.text for td in tds) def _run_environment_test_tool(self, inttest_value="42"): self.home() diff --git a/scripts/cwl_conformance_to_test_cases.py b/scripts/cwl_conformance_to_test_cases.py index 2e02b318372..710ae275dbd 100644 --- a/scripts/cwl_conformance_to_test_cases.py +++ b/scripts/cwl_conformance_to_test_cases.py @@ -360,7 +360,7 @@ def main(): raise Exception(f"No doc in test [{test_with_doc}]") del test_with_doc["doc"] cwl_test_def = yaml.dump(test_with_doc, default_flow_style=False) - cwl_test_def = "\n".join([f" {line}" for line in cwl_test_def.splitlines()]) + cwl_test_def = "\n".join(f" {line}" for line in cwl_test_def.splitlines()) label = conformance_test.get("label", str(i)) tags = conformance_test.get("tags", []) is_red = label in red_tests_list diff --git a/scripts/objectstore/copy_files_to_irods.py b/scripts/objectstore/copy_files_to_irods.py index bb1a5995ab0..1d88faf4c1f 100644 --- a/scripts/objectstore/copy_files_to_irods.py +++ b/scripts/objectstore/copy_files_to_irods.py @@ -257,7 +257,7 @@ def get_irods_resource(conn, objectid, object_store_id, irods_info): irods_tape_resc_cuttoff_dt = datetime.strptime(irods_tape_resc_cuttoff, "%m/%d/%Y") read_cursor = conn.cursor() - args = ('ok', objectid, objectid, tuple([object_store_id]), 'ok', objectid, objectid, tuple([object_store_id])) + args = ('ok', objectid, objectid, (object_store_id, ), 'ok', objectid, objectid, (object_store_id, )) read_cursor.execute(last_accessed_sql_statement, args) row = read_cursor.fetchone() if row is None: diff --git a/test/integration/test_resolvers.py b/test/integration/test_resolvers.py index 57e056642e9..5dfae3c24dd 100644 --- a/test/integration/test_resolvers.py +++ b/test/integration/test_resolvers.py @@ -93,7 +93,7 @@ class CondaResolutionIntegrationTestCase(integration_util.IntegrationTestCase): create_response = self._post(endpoint, data=data, admin=True) self._assert_status_code_is(create_response, 200) response = create_response.json() - assert any([True for d in response if d['dependency_type'] == 'conda']) + assert any(True for d in response if d['dependency_type'] == 'conda') endpoint = "tools/%s/build_dependency_cache" % tool_id create_response = self._post(endpoint, data=data, admin=True) self._assert_status_code_is(create_response, 200) @@ -105,7 +105,7 @@ class CondaResolutionIntegrationTestCase(integration_util.IntegrationTestCase): create_response = self._post(endpoint, data=data, admin=True) self._assert_status_code_is(create_response, 200) response = create_response.json() - assert any([True for d in response if d['dependency_type'] == 'conda']) + assert any(True for d in response if d['dependency_type'] == 'conda') endpoint = "tools/%s/dependencies" % tool_id create_response = self._delete(endpoint, data=data, admin=True) self._assert_status_code_is(create_response, 200) @@ -131,7 +131,7 @@ class CondaResolutionIntegrationTestCase(integration_util.IntegrationTestCase): create_response = self._post(endpoint, data=data, admin=True) self._assert_status_code_is(create_response, 200) response = create_response.json() - assert any([True for d in response if d['dependency_type'] == 'conda']) + assert any(True for d in response if d['dependency_type'] == 'conda') # Now that we know install was successfullt we can also doube check that the uninstall works self._uninstall_mulled_example_multi_1(resolver_type='conda') diff --git a/test/manual/workflows_scaling.py b/test/manual/workflows_scaling.py index 36faad66669..914e21cfac9 100644 --- a/test/manual/workflows_scaling.py +++ b/test/manual/workflows_scaling.py @@ -51,7 +51,7 @@ def main(argv=None): uuid = str(uuid4()) workflow_struct = _workflow_struct(args, uuid) - has_input = any([s.get("type", "tool") == "input_collection" for s in workflow_struct]) + has_input = any(s.get("type", "tool") == "input_collection" for s in workflow_struct) if not has_input: uuid = None diff --git a/test/unit/app/authnz/test_custos_authnz.py b/test/unit/app/authnz/test_custos_authnz.py index 67ce68df8cb..2430d10a57e 100644 --- a/test/unit/app/authnz/test_custos_authnz.py +++ b/test/unit/app/authnz/test_custos_authnz.py @@ -32,10 +32,10 @@ class CustosAuthnzTestCase(unittest.TestCase): return 'https://iam.scigap.org/auth' def _get_credential_url(self): - return '/'.join([self._get_idp_url(), 'credentials']) + return f"{self._get_idp_url()}/credentials" def _get_well_known_url(self): - return '/'.join([self._get_idp_url(), '.well-known/openid-configuration']) + return f"{self._get_idp_url()}/.well-known/openid-configuration" def setUp(self): self.orig_requests_get = requests.get diff --git a/test/unit/shed_unit/test_td_common_util.py b/test/unit/shed_unit/test_td_common_util.py index e655f0ba088..7189944c6cb 100644 --- a/test/unit/shed_unit/test_td_common_util.py +++ b/test/unit/shed_unit/test_td_common_util.py @@ -66,7 +66,7 @@ def test_get_env_shell_file_paths_from_setup_environment_elem(): # Verify new ones added. assert r_env_sh in all_env_paths # env_shell_file_paths includes everything - assert all([env in action_dict['env_shell_file_paths'] for env in all_env_paths]) + assert all(env in action_dict['env_shell_file_paths'] for env in all_env_paths) # for every given repository there should be one env # file + the required_for_install_env_sh file assert len(action_dict['env_shell_file_paths']) == 3