diff --git a/.circleci/config.yml b/.circleci/config.yml
index 5535e10190d..f779bac7fcf 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -27,7 +27,7 @@ variables:
jobs:
get_code:
docker:
- - image: circleci/python:3.5
+ - image: circleci/python:3.6
<<: *set_workdir
steps:
# Replace standard code checkout with shallow clone to speed things up.
@@ -83,34 +83,34 @@ jobs:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo
- py35_docstring:
+ py36_docstring:
docker:
- - image: circleci/python:3.5
+ - image: circleci/python:3.6
<<: *set_workdir
steps:
- *restore_repo_cache
- *install_tox
- - run: tox -e py35-lint_docstring_include_list
- py35_lint:
+ - run: tox -e py36-lint_docstring_include_list
+ py36_lint:
docker:
- - image: circleci/python:3.5
+ - image: circleci/python:3.6
<<: *set_workdir
steps:
- *restore_repo_cache
- *install_tox
- - run: tox -e py35-lint
- py35_unit:
+ - run: tox -e py36-lint
+ py36_unit:
docker:
- - image: circleci/python:3.5
+ - image: circleci/python:3.6
<<: *set_workdir
steps:
- *restore_repo_cache
- *install_tox
- *install_ffprobe
- - run: tox -e py35-unit
- py35_first_startup:
+ - run: tox -e py36-unit
+ py36_first_startup:
docker:
- - image: circleci/python:3.5
+ - image: circleci/python:3.6
<<: *set_workdir
steps:
- *restore_repo_cache
@@ -118,10 +118,10 @@ jobs:
- run: wget -q https://github.com/jmchilton/galaxy-downloads/raw/master/db_gx_rev_0141.sqlite
- run: mv db_gx_rev_0141.sqlite database/universe.sqlite
- *install_tox
- - run: tox -e py35-first_startup
+ - run: tox -e py36-first_startup
validate_test_tools:
docker:
- - image: circleci/python:3.5
+ - image: circleci/python:3.6
<<: *set_workdir
steps:
- *restore_repo_cache
@@ -131,7 +131,7 @@ jobs:
- run: tox -e validate_test_tools
test_galaxy_packages:
docker:
- - image: circleci/python:3.5
+ - image: circleci/python:3.6
<<: *set_workdir
steps:
- *restore_repo_cache
@@ -167,13 +167,13 @@ workflows:
get_code_and_test:
jobs:
- get_code
- - py35_docstring:
+ - py36_docstring:
<<: *requires_get_code
- - py35_lint:
+ - py36_lint:
<<: *requires_get_code
- - py35_unit:
+ - py36_unit:
<<: *requires_get_code
- - py35_first_startup:
+ - py36_first_startup:
<<: *requires_get_code
- test_galaxy_packages:
<<: *requires_get_code
diff --git a/README.rst b/README.rst
index cc66ea4bcdb..f260d040869 100644
--- a/README.rst
+++ b/README.rst
@@ -24,7 +24,7 @@ Community support is available at `Galaxy Help
Galaxy Quickstart
=================
-Galaxy requires Python 3.5 or 3.6 . To check your Python version, run:
+Galaxy requires Python 3.6 . To check your Python version, run:
.. code:: console
diff --git a/client/src/assets/images/circle.py b/client/src/assets/images/circle.py
index cbd5d06bade..b0d60f02adc 100755
--- a/client/src/assets/images/circle.py
+++ b/client/src/assets/images/circle.py
@@ -2,7 +2,6 @@
"""
usage: %prog width height bg_color hatch_color [color alpha stop_pos] +
"""
-from __future__ import division
import sys
from math import pi
diff --git a/config/plugins/webhooks/demo/tour_generator/__init__.py b/config/plugins/webhooks/demo/tour_generator/__init__.py
index 080706fa881..f61ddaaf323 100644
--- a/config/plugins/webhooks/demo/tour_generator/__init__.py
+++ b/config/plugins/webhooks/demo/tour_generator/__init__.py
@@ -8,7 +8,7 @@ from galaxy.util import Params
log = logging.getLogger(__name__)
-class TourGenerator(object):
+class TourGenerator:
def __init__(self, trans, tool_id, tool_version):
self._trans = trans
self._tool = self._trans.app.toolbox.get_tool(tool_id, tool_version)
@@ -177,14 +177,14 @@ class TourGenerator(object):
if name in test_inputs:
hid = self._hids[name]
dataset = self._test.inputs[name][0]
- step['content'] = 'Select dataset: %s: %s' % (
+ step['content'] = 'Select dataset: {}: {}'.format(
hid, dataset
)
else:
step['content'] = 'Select a dataset'
elif input.type == 'conditional':
- param_id = '%s|%s' % (input.name, input.test_param.name)
+ param_id = f'{input.name}|{input.test_param.name}'
step['title'] = input.test_param.label
step['element'] = '[tour_id="%s"]' % param_id
params = []
@@ -203,7 +203,7 @@ class TourGenerator(object):
cases[key] = value.label
for case_id, case_title in cases.items():
- tour_id = '%s|%s' % (input.name, case_id)
+ tour_id = f'{input.name}|{case_id}'
if tour_id in self._test.inputs.keys():
if case_id in self._data_inputs.keys():
hid = self._hids[case_id]
diff --git a/contrib/galaxy_config_merger.py b/contrib/galaxy_config_merger.py
index d813dbb7b80..b5a24c60d5c 100644
--- a/contrib/galaxy_config_merger.py
+++ b/contrib/galaxy_config_merger.py
@@ -23,14 +23,12 @@ THE ORIGINAL WORK IS WITH YOU.
Script for merging specific local Galaxy config galaxy.ini.cri with default Galaxy galaxy.ini.sample
'''
-from __future__ import print_function
+import configparser
import logging
import optparse
import sys
-from six.moves import configparser
-
def main():
# logging configuration
@@ -51,12 +49,12 @@ def main():
config_sample = configparser.RawConfigParser()
config_sample.read(options.sample)
- config_sample_content = open(options.sample, 'r').read()
+ config_sample_content = open(options.sample).read()
config = configparser.RawConfigParser()
config.read(options.config)
- logging.info("Merging your own config file %s into the sample one %s." % (options.config, options.sample))
+ logging.info(f"Merging your own config file {options.config} into the sample one {options.sample}.")
logging.info("---------- DIFFERENCE ANALYSIS BEGIN ----------")
for section in config.sections():
if not config_sample.has_section(section):
@@ -65,13 +63,13 @@ def main():
for (name, value) in config.items(section):
if not config_sample.has_option(section, name):
if not "#%s" % name in config_sample_content:
- logging.warning("-MISSING- section [%s] option '%s' not found in sample file. It will be ignored." % (section, name))
+ logging.warning(f"-MISSING- section [{section}] option '{name}' not found in sample file. It will be ignored.")
else:
- logging.info("-notset- section [%s] option '%s' not set in sample file. It will be added." % (section, name))
+ logging.info(f"-notset- section [{section}] option '{name}' not set in sample file. It will be added.")
config_sample.set(section, name, value)
else:
if not config_sample.get(section, name) == value:
- logging.info("- diff - section [%s] option '%s' has different value ('%s':'%s'). It will be modified." % (section, name, config_sample.get(section, name), value))
+ logging.info("- diff - section [{}] option '{}' has different value ('{}':'{}'). It will be modified.".format(section, name, config_sample.get(section, name), value))
config_sample.set(section, name, value)
logging.info("---------- DIFFERENCE ANALYSIS END ----------")
diff --git a/contrib/nagios/check_galaxy.py b/contrib/nagios/check_galaxy.py
index d61ff42d84f..6a5a9f6a138 100755
--- a/contrib/nagios/check_galaxy.py
+++ b/contrib/nagios/check_galaxy.py
@@ -3,7 +3,6 @@
check_galaxy can be run by hand, although it is meant to run from cron
via the check_galaxy.sh script in Galaxy's cron/ directory.
"""
-from __future__ import print_function
import formatter
import getopt
@@ -14,13 +13,12 @@ import socket
import sys
import time
import warnings
-from user import home
-
-from six.moves.urllib.request import (
+from urllib.request import (
build_opener,
HTTPCookieProcessor,
- Request
+ Request,
)
+from user import home
with warnings.catch_warnings():
warnings.simplefilter('ignore')
@@ -52,7 +50,7 @@ handler = args[3]
warntime = 240
new_history = False
-for o, a in opts:
+for o, _ in opts:
if o == "-n":
if debug:
print("Specified -n, will create a new history")
@@ -73,7 +71,7 @@ tc.agent("Mozilla/5.0 (compatible; check_galaxy/0.2)")
tc.config('use_tidy', 0)
-class Browser(object):
+class Browser:
def __init__(self):
self.server = server
self.handler = handler
@@ -93,7 +91,7 @@ class Browser(object):
self.opener = build_opener(HTTPCookieProcessor(tc.get_browser().cj))
def get(self, path):
- tc.go("%s%s" % (self.server, path))
+ tc.go(f"{self.server}{path}")
tc.code(200)
def req(self, path, data=None, method=None):
@@ -105,7 +103,7 @@ class Browser(object):
if method:
req.get_method = lambda: method
res = self.opener.open(req)
- print('==> at %s (%s)' % (url, method or 'GET'))
+ print('==> at {} ({})'.format(url, method or 'GET'))
assert res.getcode() == 200, url
return res
@@ -226,7 +224,7 @@ class Browser(object):
if self.hda_state != "ok":
self.get("/datasets/%s/stderr" % self.hda_id)
print(tc.browser.get_html())
- raise Exception("HDA %s NOT OK: %s" % (self.hda_id, self.hda_state))
+ raise Exception(f"HDA {self.hda_id} NOT OK: {self.hda_state}")
def check_hda_content(self):
self.get("/datasets/%s/display?to_ext=txt" % self.hda_id)
@@ -240,7 +238,7 @@ class Browser(object):
def delete_datasets(self):
for hda in self.undeleted_hdas:
- path = '/api/histories/%s/contents/%s' % (self.history_id, hda['id'])
+ path = '/api/histories/{}/contents/{}'.format(self.history_id, hda['id'])
self.req(path, method='DELETE')
hdas = [hda['id'] for hda in self.undeleted_hdas]
if hdas:
diff --git a/cron/add_manual_builds.py b/cron/add_manual_builds.py
index 2d1bd58b2e0..8a4197eef5b 100644
--- a/cron/add_manual_builds.py
+++ b/cron/add_manual_builds.py
@@ -6,7 +6,6 @@ Adds Manually created builds and chrom info to Galaxy's info tables
Usage:
python add_manual_builds.py input_file builds.txt chrom_length_dir
"""
-from __future__ import print_function
import os
import sys
diff --git a/cron/build_chrom_db.py b/cron/build_chrom_db.py
index b3c7094238b..7289dc72202 100644
--- a/cron/build_chrom_db.py
+++ b/cron/build_chrom_db.py
@@ -11,14 +11,13 @@ All chromInfo is placed in a path with the convention
Usage:
python build_chrom_db.py dbpath/ [builds_file]
"""
-from __future__ import print_function
import fileinput
import os
import sys
+from urllib.parse import urlencode
import requests
-from six.moves.urllib.parse import urlencode
import parse_builds # noqa: I100,I202
@@ -78,5 +77,5 @@ if __name__ == "__main__":
for chrominfo in getchrominfo("http://genome-test.gi.ucsc.edu/cgi-bin/hgTables?", build):
print("\t".join(chrominfo), file=outfile)
except Exception as e:
- print("Failed to retrieve %s: %s" % (build, e))
+ print(f"Failed to retrieve {build}: {e}")
os.remove(outfile_name)
diff --git a/cron/parse_builds.py b/cron/parse_builds.py
index 597c36f8066..45361c3aeeb 100644
--- a/cron/parse_builds.py
+++ b/cron/parse_builds.py
@@ -4,7 +4,6 @@ Connects to the URL specified and outputs builds available at that
DSN in tabular format. UCSC Main gateway is used as default.
build description
"""
-from __future__ import print_function
import sys
import xml.etree.ElementTree as ElementTree
diff --git a/cron/parse_builds_3_sites.py b/cron/parse_builds_3_sites.py
index b3cd3bd5d64..c1eb4d0a147 100644
--- a/cron/parse_builds_3_sites.py
+++ b/cron/parse_builds_3_sites.py
@@ -2,7 +2,6 @@
"""
Connects to sites and determines which builds are available at each.
"""
-from __future__ import print_function
import xml.etree.ElementTree as ElementTree
diff --git a/doc/parse_gx_xsd.py b/doc/parse_gx_xsd.py
index b033608cc5c..2b58b650e83 100644
--- a/doc/parse_gx_xsd.py
+++ b/doc/parse_gx_xsd.py
@@ -1,17 +1,15 @@
-# coding: utf-8
# TODO: Add examples, tables and best practice links to command
# TODO: Examples of truevalue, falsevalue
# TODO: Test param extra_file
# Things dropped from schema_template.md (still documented inside schema).
# - request_parameter_translation
-from __future__ import print_function
import sys
+from io import StringIO
from lxml import etree
-from six import StringIO
-with open(sys.argv[2], "r") as f:
+with open(sys.argv[2]) as f:
xmlschema_doc = etree.parse(f)
markdown_buffer = StringIO()
@@ -22,7 +20,7 @@ def main():
toc_list = []
content_list = []
found_tag = False
- with open(sys.argv[1], "r") as markdown_template:
+ with open(sys.argv[1]) as markdown_template:
for line in markdown_template:
if line.startswith("$tag:"):
found_tag = True
@@ -41,7 +39,7 @@ def main():
print(el, end='')
-class Tag(object):
+class Tag:
def __init__(self, line):
assert line.startswith("$tag:")
@@ -71,7 +69,7 @@ class Tag(object):
return " > ".join("``%s``" % p for p in self.title.split("|"))
def build_toc_entry(self):
- return "* [%s](%s)" % (self._pretty_title, self._anchor)
+ return f"* [{self._pretty_title}]({self._anchor})"
def build_help(self):
tag = xmlschema_doc.find(self.xpath)
@@ -113,7 +111,7 @@ def _build_tag(tag, hide_attributes):
doc = _doc_or_none(_type_el(element))
assert doc is not None, "Documentation for %s is empty" % element.attrib["name"]
doc = doc.strip()
- assertions_buffer.write("``%s`` | %s\n" % (element.attrib["name"], doc))
+ assertions_buffer.write("``{}`` | {}\n".format(element.attrib["name"], doc))
text = text.replace(line, assertions_buffer.getvalue())
tag_help.write(text)
best_practices = _get_bp_link(annotation_el)
@@ -165,7 +163,7 @@ def _build_attributes_table(tag, attributes, hide_attributes=False, attribute_na
if best_practices:
details += """ Find the Intergalactic Utilities Commision suggested best practices for this element [here](%s).""" % best_practices
- attribute_table.write("``%s`` | %s | %s\n" % (name, details, use))
+ attribute_table.write(f"``{name}`` | {details} | {use}\n")
return attribute_table.getvalue()
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 2c57af0c459..7f4c6a4baa3 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Galaxy documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 6 10:44:44 2012.
@@ -80,8 +79,8 @@ source_suffix = ['.rst', '.md']
master_doc = 'index'
# General information about the project.
-project = u'Galaxy Project'
-copyright = str(datetime.datetime.now().year) + u', Galaxy Committers'
+project = 'Galaxy Project'
+copyright = str(datetime.datetime.now().year) + ', Galaxy Committers'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -233,8 +232,8 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'Galaxy.tex', u'Galaxy Code Documentation',
- u'Galaxy Team', 'manual'),
+ ('index', 'Galaxy.tex', 'Galaxy Code Documentation',
+ 'Galaxy Team', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -263,8 +262,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'galaxy', u'Galaxy Documentation',
- [u'Galaxy Team'], 1)
+ ('index', 'galaxy', 'Galaxy Documentation',
+ ['Galaxy Team'], 1)
]
# If true, show URL addresses after external links.
@@ -277,8 +276,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- ('index', 'Galaxy', u'Galaxy Documentation',
- u'Galaxy Team', 'Galaxy', 'Data intensive biology for everyone.',
+ ('index', 'Galaxy', 'Galaxy Documentation',
+ 'Galaxy Team', 'Galaxy', 'Data intensive biology for everyone.',
'Miscellaneous'),
]
@@ -293,7 +292,7 @@ texinfo_documents = [
# -- ReadTheDocs.org Settings ------------------------------------------------
-class Mock(object):
+class Mock:
def __init__(self, *args, **kwargs):
pass
diff --git a/doc/source/conf.versioning.py b/doc/source/conf.versioning.py
index 8b112f7afca..d7e108125de 100644
--- a/doc/source/conf.versioning.py
+++ b/doc/source/conf.versioning.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Galaxy sphinxcontrib-simpleversioning documentation build configuration file
#
diff --git a/lib/galaxy/actions/admin.py b/lib/galaxy/actions/admin.py
index 3afc8b569f2..6072d1aa886 100644
--- a/lib/galaxy/actions/admin.py
+++ b/lib/galaxy/actions/admin.py
@@ -76,7 +76,7 @@ class AdminActions:
quota.description = params.description
self.sa_session.add(quota)
self.sa_session.flush()
- message = "Quota '{}' has been renamed to '{}'.".format(old_name, params.name)
+ message = f"Quota '{old_name}' has been renamed to '{params.name}'."
return message
def _manage_users_and_groups_for_quota(self, quota, params, decode_id=None):
@@ -122,7 +122,7 @@ class AdminActions:
else:
if params.default != 'no':
self.app.quota_agent.set_default_quota(params.default, quota)
- message = "Quota '{}' is now the default for {} users.".format(quota.name, params.default)
+ message = f"Quota '{quota.name}' is now the default for {params.default} users."
else:
if quota.default:
message = "Quota '{}' is no longer the default for {} users.".format(quota.name, quota.default[0].type)
diff --git a/lib/galaxy/auth/providers/pam_auth.py b/lib/galaxy/auth/providers/pam_auth.py
index 334b7726be9..4037d6d91f0 100644
--- a/lib/galaxy/auth/providers/pam_auth.py
+++ b/lib/galaxy/auth/providers/pam_auth.py
@@ -109,23 +109,23 @@ class PAM(AuthProvider):
pam_service = options.get('pam-service', 'galaxy')
use_helper = string_as_bool(options.get('use-external-helper', False))
- log.debug("PAM auth: will use external helper: {}".format(use_helper))
+ log.debug(f"PAM auth: will use external helper: {use_helper}")
authenticated = False
if use_helper:
authentication_helper = options.get('authentication-helper-script', '/bin/false').strip()
- log.debug("PAM auth: external helper script: {}".format(authentication_helper))
+ log.debug(f"PAM auth: external helper script: {authentication_helper}")
if not authentication_helper.startswith('/'):
# don't accept relative path
authenticated = False
else:
- auth_cmd = shlex.split('/usr/bin/sudo -n {}'.format(authentication_helper))
- log.debug("PAM auth: external helper cmd: {}".format(auth_cmd))
- message = '{}\n{}\n{}\n'.format(pam_service, pam_username, password)
+ auth_cmd = shlex.split(f'/usr/bin/sudo -n {authentication_helper}')
+ log.debug(f"PAM auth: external helper cmd: {auth_cmd}")
+ message = f'{pam_service}\n{pam_username}\n{password}\n'
try:
output = commands.execute(auth_cmd, input=message)
except commands.CommandLineException as e:
if e.stderr != '':
- log.debug("PAM auth: external authentication script had errors: status {} error {}".format(e.returncode, e.stderr))
+ log.debug(f"PAM auth: external authentication script had errors: status {e.returncode} error {e.stderr}")
output = e.stdout
if output.strip() == 'True':
authenticated = True
diff --git a/lib/galaxy/auth/util.py b/lib/galaxy/auth/util.py
index b893d23d835..09ad3e8d53d 100644
--- a/lib/galaxy/auth/util.py
+++ b/lib/galaxy/auth/util.py
@@ -86,7 +86,7 @@ def parse_auth_results(trans, auth_results, options):
i += 1
else:
raise Conflict("Cannot make unique username")
- log.debug("Email: {}, auto-register with username: {}".format(auto_email, auto_username))
+ log.debug(f"Email: {auto_email}, auto-register with username: {auto_username}")
auth_return["auto_reg"] = string_as_bool(options.get('auto-register', False))
auth_return["email"] = auto_email
auth_return["username"] = auto_username
diff --git a/lib/galaxy/authnz/custos_authnz.py b/lib/galaxy/authnz/custos_authnz.py
index 3f9ed0bcc0f..f01d65eba14 100644
--- a/lib/galaxy/authnz/custos_authnz.py
+++ b/lib/galaxy/authnz/custos_authnz.py
@@ -3,12 +3,12 @@ import hashlib
import logging
import os
from datetime import datetime, timedelta
+from urllib.parse import quote
import jwt
import requests
from oauthlib.common import generate_nonce
from requests_oauthlib import OAuth2Session
-from six.moves.urllib.parse import quote
from galaxy import exceptions
from galaxy import util
@@ -248,16 +248,16 @@ class CustosAuthnz(IdentityProvider):
base_url = self.config["url"]
# Remove potential trailing slash to avoid "//realms"
base_url = base_url if base_url[-1] != "/" else base_url[:-1]
- return "{}/.well-known/openid-configuration".format(base_url)
+ return f"{base_url}/.well-known/openid-configuration"
else:
- raise Exception("Unknown Custos provider name: {}".format(provider))
+ raise Exception(f"Unknown Custos provider name: {provider}")
def _fetch_well_known_oidc_config(self, well_known_uri):
try:
return requests.get(well_known_uri,
verify=self._get_verify_param()).json()
except Exception:
- log.error("Failed to load well-known OIDC config URI: {}".format(well_known_uri))
+ log.error(f"Failed to load well-known OIDC config URI: {well_known_uri}")
raise
def _load_well_known_oidc_config(self, well_known_oidc_config):
diff --git a/lib/galaxy/authnz/managers.py b/lib/galaxy/authnz/managers.py
index 8cc8104eb7c..b9bdcf78ab8 100644
--- a/lib/galaxy/authnz/managers.py
+++ b/lib/galaxy/authnz/managers.py
@@ -1,3 +1,4 @@
+import builtins
import copy
import json
import logging
@@ -10,7 +11,6 @@ from cloudauthz import CloudAuthz
from cloudauthz.exceptions import (
CloudAuthzBaseException
)
-from six.moves import builtins
from galaxy import exceptions
from galaxy import model
@@ -89,7 +89,7 @@ class AuthnzManager:
except ImportError:
raise
except etree.ParseError as e:
- raise etree.ParseError("Invalid configuration at `{}`: {} -- unable to continue.".format(config_file, e))
+ raise etree.ParseError(f"Invalid configuration at `{config_file}`: {e} -- unable to continue.")
def _get_idp_icon(self, idp):
return self.oidc_backends_config[idp].get('icon') or DEFAULT_OIDC_IDP_ICONS.get(idp)
@@ -109,7 +109,7 @@ class AuthnzManager:
"skipping the node.".format(child.tag))
continue
if 'name' not in child.attrib:
- log.error("Could not find a node attribute 'name'; skipping the node '{}'.".format(child.tag))
+ log.error(f"Could not find a node attribute 'name'; skipping the node '{child.tag}'.")
continue
idp = child.get('name').lower()
if idp in BACKENDS_NAME:
@@ -127,7 +127,7 @@ class AuthnzManager:
except ImportError:
raise
except etree.ParseError as e:
- raise etree.ParseError("Invalid configuration at `{}`: {} -- unable to continue.".format(config_file, e))
+ raise etree.ParseError(f"Invalid configuration at `{config_file}`: {e} -- unable to continue.")
def _parse_idp_config(self, config_xml):
rtv = {
@@ -188,10 +188,10 @@ class AuthnzManager:
else:
return True, "", identity_provider_class(unified_provider_name, self.oidc_config, self.oidc_backends_config[unified_provider_name])
except Exception as e:
- log.exception('An error occurred when loading {}'.format(identity_provider_class.__name__))
+ log.exception(f'An error occurred when loading {identity_provider_class.__name__}')
return False, unicodify(e), None
else:
- msg = 'The requested identity provider, `{}`, is not a recognized/expected provider.'.format(provider)
+ msg = f'The requested identity provider, `{provider}`, is not a recognized/expected provider.'
log.debug(msg)
return False, msg, None
@@ -281,13 +281,13 @@ class AuthnzManager:
return False, message, None
elif provider in KEYCLOAK_BACKENDS:
if (self.allowed_idps and (idphint not in self.allowed_idps)):
- msg = 'An error occurred when authenticating a user. Invalid EntityID: `{}`'.format(idphint)
+ msg = f'An error occurred when authenticating a user. Invalid EntityID: `{idphint}`'
log.exception(msg)
return False, msg, None
- return True, "Redirecting to the `{}` identity provider for authentication".format(provider), backend.authenticate(trans, idphint)
- return True, "Redirecting to the `{}` identity provider for authentication".format(provider), backend.authenticate(trans)
+ return True, f"Redirecting to the `{provider}` identity provider for authentication", backend.authenticate(trans, idphint)
+ return True, f"Redirecting to the `{provider}` identity provider for authentication", backend.authenticate(trans)
except Exception:
- msg = 'An error occurred when authenticating a user on `{}` identity provider'.format(provider)
+ msg = f'An error occurred when authenticating a user on `{provider}` identity provider'
log.exception(msg)
return False, msg, None
@@ -322,7 +322,7 @@ class AuthnzManager:
# check if logout is enabled for this idp and return false if not
unified_provider_name = self._unify_provider_name(provider)
if self.oidc_backends_config[unified_provider_name]['enable_idp_logout'] is False:
- return False, "IDP logout is not enabled for {}".format(provider), None
+ return False, f"IDP logout is not enabled for {provider}", None
success, message, backend = self._get_authnz_backend(provider)
if success is False:
diff --git a/lib/galaxy/authnz/psa_authnz.py b/lib/galaxy/authnz/psa_authnz.py
index 1c6e60ff30b..c595b9e094a 100644
--- a/lib/galaxy/authnz/psa_authnz.py
+++ b/lib/galaxy/authnz/psa_authnz.py
@@ -316,11 +316,11 @@ def contains_required_data(response=None, is_new=False, **kwargs):
# sent back from the identity provider. PSA internally handles such
# scenarios; however, this case is implemented to prevent uncaught
# server-side errors.
- raise MalformedContents(err_msg="`response` not found. {}".format(hint_msg))
+ raise MalformedContents(err_msg=f"`response` not found. {hint_msg}")
if not response.get("id_token"):
# This can happen if a non-OIDC compliant backend is used;
# e.g., an OAuth2.0-based backend that only generates access token.
- raise MalformedContents(err_msg="Missing identity token. {}".format(hint_msg))
+ raise MalformedContents(err_msg=f"Missing identity token. {hint_msg}")
if is_new and not response.get("refresh_token"):
# An identity provider (e.g., Google) sends a refresh token the first
# time user consents Galaxy's access (i.e., the first time user logs in
@@ -331,7 +331,7 @@ def contains_required_data(response=None, is_new=False, **kwargs):
# user has provided consent. This can also happen under dev efforts.
# The solution is to revoke the consent by visiting the identity provider's
# website, and then retry the login process.
- raise MalformedContents(err_msg="Missing refresh token. {}".format(hint_msg))
+ raise MalformedContents(err_msg=f"Missing refresh token. {hint_msg}")
def verify(strategy=None, response=None, details=None, **kwargs):
@@ -344,7 +344,7 @@ def verify(strategy=None, response=None, details=None, **kwargs):
if provider.lower() == "gcp":
result = requests.post(
- "https://iam.googleapis.com/v1/projects/-/serviceAccounts/{}:getIamPolicy".format(endpoint),
+ f"https://iam.googleapis.com/v1/projects/-/serviceAccounts/{endpoint}:getIamPolicy",
headers={
'Authorization': 'Bearer {}'.format(response.get("access_token")),
'Accept': 'application/json'})
@@ -364,7 +364,7 @@ def verify(strategy=None, response=None, details=None, **kwargs):
# sensitive information that should not be exposed to users.
raise Exception(res["error"]["message"])
else:
- raise Exception("`{}` is an unsupported secondary authorization provider, contact admin.".format(provider))
+ raise Exception(f"`{provider}` is an unsupported secondary authorization provider, contact admin.")
def allowed_to_disconnect(name=None, user=None, user_storage=None, strategy=None,
diff --git a/lib/galaxy/config/__init__.py b/lib/galaxy/config/__init__.py
index 61e9e1eb704..fc33292e699 100644
--- a/lib/galaxy/config/__init__.py
+++ b/lib/galaxy/config/__init__.py
@@ -4,6 +4,7 @@ Universe configuration builder.
# absolute_import needed for tool_shed package.
import collections
+import configparser
import errno
import ipaddress
import logging
@@ -22,7 +23,6 @@ from datetime import timedelta
import yaml
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
-from six.moves import configparser
from galaxy.config.schema import AppSchema
from galaxy.containers import parse_containers_config
diff --git a/lib/galaxy/config/config_manage.py b/lib/galaxy/config/config_manage.py
index b7fcf21fdc8..b8e6dfd87ba 100644
--- a/lib/galaxy/config/config_manage.py
+++ b/lib/galaxy/config/config_manage.py
@@ -8,12 +8,12 @@ from collections import (
namedtuple,
OrderedDict
)
+from io import StringIO
from textwrap import TextWrapper
import requests
import yaml
from boltons.iterutils import remap
-from six import StringIO
try:
from pykwalify.core import Core
@@ -405,7 +405,7 @@ def _to_rst(args, app_desc, heading_level="~"):
def _write_option_rst(args, rst, key, heading_level, option_value):
title = "``%s``" % key
heading = heading_level * len(title)
- rst.write("{}\n{}\n{}\n\n".format(heading, title, heading))
+ rst.write(f"{heading}\n{title}\n{heading}\n\n")
option, value = _parse_option_value(option_value)
desc = option["desc"]
rst.write(":Description:\n")
@@ -649,7 +649,7 @@ def _is_ini(path):
def _replace_file(args, f, app_desc, from_path, to_path):
_write_to_file(args, f, to_path)
backup_path = "%s.backup" % from_path
- print("Moving [{}] to [{}]".format(from_path, backup_path))
+ print(f"Moving [{from_path}] to [{backup_path}]")
if args.dry_run:
print("... skipping because --dry-run is enabled.")
else:
@@ -661,7 +661,7 @@ def _build_sample_yaml(args, app_desc):
UWSGI_OPTIONS.update(SHED_ONLY_UWSGI_OPTIONS)
schema = app_desc.schema
f = StringIO()
- for key, value in UWSGI_OPTIONS.items():
+ for value in UWSGI_OPTIONS.values():
for field in ["desc", "default"]:
if field not in value:
continue
@@ -693,7 +693,7 @@ def _write_to_file(args, f, path):
contents = f
if args.dry_run:
contents_indented = "\n".join(" |%s" % l for l in contents.splitlines())
- print("Overwriting {} with the following contents:\n{}".format(path, contents_indented))
+ print(f"Overwriting {path} with the following contents:\n{contents_indented}")
print("... skipping because --dry-run is enabled.")
else:
print("Overwriting %s" % path)
@@ -743,10 +743,10 @@ def _write_option(args, f, key, option_value, as_comment=False, uwsgi_hack=False
if uwsgi_hack:
if option.get("type", "str") == "bool":
value = str(value).lower()
- key_val_str = "{}: {}".format(key, value)
+ key_val_str = f"{key}: {value}"
else:
key_val_str = yaml.dump({key: value}, width=float("inf")).lstrip("{").rstrip("\n}")
- lines = "{}{}{}".format(comment, as_comment_str, key_val_str)
+ lines = f"{comment}{as_comment_str}{key_val_str}"
lines_idented = "\n".join(" %s" % l for l in lines.split("\n"))
f.write("%s\n\n" % lines_idented)
@@ -774,7 +774,7 @@ def _server_paste_to_uwsgi(app_desc, server_config, applied_filters):
if server_config.get("use", "egg:Paste#http") != "egg:Paste#http":
raise Exception("Unhandled paste server 'use' value [%s], file must be manually migrate.")
- uwsgi_dict["http"] = "{}:{}".format(host, port)
+ uwsgi_dict["http"] = f"{host}:{port}"
# default changing from 10 to 8
uwsgi_dict["threads"] = int(server_config.get("threadpool_workers", 8))
# required for static...
@@ -791,7 +791,7 @@ def _server_paste_to_uwsgi(app_desc, server_config, applied_filters):
uwsgi_dict["http-auto-gzip"] = True
if prefix:
- uwsgi_dict["mount"] = "{}={}".format(prefix, app_desc.uwsgi_module)
+ uwsgi_dict["mount"] = f"{prefix}={app_desc.uwsgi_module}"
uwsgi_dict["manage-script-name"] = True
else:
uwsgi_dict["module"] = app_desc.uwsgi_module
diff --git a/lib/galaxy/config/schema.py b/lib/galaxy/config/schema.py
index b1d461900b1..c357f06a350 100644
--- a/lib/galaxy/config/schema.py
+++ b/lib/galaxy/config/schema.py
@@ -84,7 +84,7 @@ class AppSchema(Schema):
def check_type_is_str_or_any(option, key):
if option.get('type') not in ('str', 'any'):
- message = "Invalid schema: property '{}' should have type 'str'".format(key)
+ message = f"Invalid schema: property '{key}' should have type 'str'"
raise_error(message)
def check_is_dag():
diff --git a/lib/galaxy/containers/__init__.py b/lib/galaxy/containers/__init__.py
index 26e8100df5f..b6c775ab58d 100644
--- a/lib/galaxy/containers/__init__.py
+++ b/lib/galaxy/containers/__init__.py
@@ -17,7 +17,6 @@ from abc import (
from collections import namedtuple
import yaml
-from six.moves import shlex_quote
from galaxy.exceptions import ContainerCLIError
from galaxy.util.submodules import import_submodules
@@ -234,14 +233,14 @@ class ContainerInterface(metaclass=ABCMeta):
def _stringify_kwopt_string(self, flag, val):
"""
"""
- return '{flag} {value}'.format(flag=flag, value=shlex_quote(str(val)))
+ return '{flag} {value}'.format(flag=flag, value=shlex.quote(str(val)))
def _stringify_kwopt_list(self, flag, val):
"""
"""
if isinstance(val, str):
return self._stringify_kwopt_string(flag, val)
- return ' '.join('{flag} {value}'.format(flag=flag, value=shlex_quote(str(v))) for v in val)
+ return ' '.join('{flag} {value}'.format(flag=flag, value=shlex.quote(str(v))) for v in val)
def _stringify_kwopt_list_of_kvpairs(self, flag, val):
"""
@@ -253,7 +252,7 @@ class ContainerInterface(metaclass=ABCMeta):
else:
# {'foo': 'bar', 'baz': 'quux'}
for k, v in dict(val).items():
- l.append('{k}={v}'.format(k=k, v=v))
+ l.append(f'{k}={v}')
return self._stringify_kwopt_list(flag, l)
def _stringify_kwopt_list_of_kovtrips(self, flag, val):
@@ -263,7 +262,7 @@ class ContainerInterface(metaclass=ABCMeta):
return self._stringify_kwopt_string(flag, val)
l = []
for k, o, v in val:
- l.append('{k}{o}{v}'.format(k=k, o=o, v=v))
+ l.append(f'{k}{o}{v}')
return self._stringify_kwopt_list(flag, l)
def _run_command(self, command, verbose=False):
@@ -275,7 +274,7 @@ class ContainerInterface(metaclass=ABCMeta):
if p.returncode == 0:
return stdout.strip()
else:
- msg = "Command '{}' returned non-zero exit status {}".format(command, p.returncode)
+ msg = f"Command '{command}' returned non-zero exit status {p.returncode}"
log.error(msg + ': ' + stderr.strip())
raise ContainerCLIError(
msg,
@@ -324,7 +323,7 @@ class ContainerInterfaceConfig(dict):
try:
return self[name]
except KeyError:
- raise AttributeError("'{}' object has no attribute '{}'".format(self.__class__.__name__, name))
+ raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")
def get(self, name, default=None):
try:
diff --git a/lib/galaxy/containers/docker.py b/lib/galaxy/containers/docker.py
index 57d80cee289..93ef6ec1498 100644
--- a/lib/galaxy/containers/docker.py
+++ b/lib/galaxy/containers/docker.py
@@ -4,6 +4,7 @@ Interface to Docker
import logging
import os
+import shlex
from functools import partial
from itertools import cycle, repeat
from time import sleep
@@ -18,7 +19,6 @@ try:
except ImportError:
ConnectionError = None
ReadTimeout = None
-from six.moves import shlex_quote
from galaxy.containers import ContainerInterface
from galaxy.containers.docker_decorators import (
@@ -130,7 +130,7 @@ class DockerCLIInterface(DockerInterface):
global_kwopts = []
if self._conf.host:
global_kwopts.append('--host')
- global_kwopts.append(shlex_quote(self._conf.host))
+ global_kwopts.append(shlex.quote(self._conf.host))
if self._conf.force_tlsverify:
global_kwopts.append('--tlsverify')
self._docker_command = self._conf['command_template'].format(
@@ -142,9 +142,9 @@ class DockerCLIInterface(DockerInterface):
def _filter_by_id_or_name(self, id, name):
if id:
- return '--filter id={}'.format(id)
+ return f'--filter id={id}'
elif name:
- return '--filter name={}'.format(name)
+ return f'--filter name={name}'
return None
def _stringify_kwopt_docker_volumes(self, flag, val):
@@ -159,7 +159,7 @@ class DockerCLIInterface(DockerInterface):
for hostvol, guestopts in val.items():
if isinstance(guestopts, str):
# {'/host/vol': '/container/vol'}
- l.append('{}:{}'.format(hostvol, guestopts))
+ l.append(f'{hostvol}:{guestopts}')
else:
# {'/host/vol': {'bind': '/container/vol'}}
# {'/host/vol': {'bind': '/container/vol', 'mode': 'rw'}}
@@ -198,7 +198,7 @@ class DockerCLIInterface(DockerInterface):
return self._run_docker(subcommand='inspect', args=container_id)[0]
except (IndexError, ContainerCLIError) as exc:
msg = "Invalid container id: %s" % container_id
- if exc.stdout == '[]' and exc.stderr == 'Error: no such object: {container_id}'.format(container_id=container_id):
+ if exc.stdout == '[]' and exc.stderr == f'Error: no such object: {container_id}':
log.warning(msg)
return []
else:
@@ -210,7 +210,7 @@ class DockerCLIInterface(DockerInterface):
return self._run_docker(subcommand='image inspect', args=image)[0]
except (IndexError, ContainerCLIError) as exc:
msg = "%s not pulled, cannot get digest" % image
- if exc.stdout == '[]' and exc.stderr == 'Error: no such image: {image}'.format(image=image):
+ if exc.stdout == '[]' and exc.stderr == f'Error: no such image: {image}':
log.warning(msg, image)
return []
else:
diff --git a/lib/galaxy/containers/docker_model.py b/lib/galaxy/containers/docker_model.py
index d3b2df7a751..65c9cabeca1 100644
--- a/lib/galaxy/containers/docker_model.py
+++ b/lib/galaxy/containers/docker_model.py
@@ -3,13 +3,13 @@ Model objects for docker objects
"""
import logging
+import shlex
try:
import docker
except ImportError:
from galaxy.util.bunch import Bunch
docker = Bunch(errors=Bunch(NotFound=None))
-from six.moves import shlex_quote
from galaxy.containers import (
Container,
@@ -106,7 +106,7 @@ class DockerVolume(ContainerVolume):
def __str__(self):
volume_str = ":".join(filter(lambda x: x is not None, (self.host_path, self.path, self.mode)))
if "$" not in volume_str:
- volume_for_cmd_line = shlex_quote(volume_str)
+ volume_for_cmd_line = shlex.quote(volume_str)
else:
# e.g. $_GALAXY_JOB_TMP_DIR:$_GALAXY_JOB_TMP_DIR:rw so don't single quote.
volume_for_cmd_line = '"%s"' % volume_str
@@ -393,10 +393,10 @@ class DockerServiceConstraint:
return hash((self._name, self._op, self._value))
def __repr__(self):
- return '{}({}{}{})'.format(self.__class__.__name__, self._name, self._op, self._value)
+ return f'{self.__class__.__name__}({self._name}{self._op}{self._value})'
def __str__(self):
- return '{}{}{}'.format(self._name, self._op, self._value)
+ return f'{self._name}{self._op}{self._value}'
@staticmethod
def split_constraint_string(constraint_str):
@@ -508,7 +508,7 @@ class DockerNode:
@property
def state(self):
- return ('{}-{}'.format(self._status, self._availability)).lower()
+ return (f'{self._status}-{self._availability}').lower()
@property
def cpus(self):
@@ -597,10 +597,10 @@ class DockerNodeLabel:
return hash((self._name, self._value))
def __repr__(self):
- return '{}({}: {})'.format(self.__class__.__name__, self._name, self._value)
+ return f'{self.__class__.__name__}({self._name}: {self._value})'
def __str__(self):
- return '{}: {}'.format(self._name, self._value)
+ return f'{self._name}: {self._value}'
@property
def name(self):
@@ -612,12 +612,12 @@ class DockerNodeLabel:
@property
def constraint_string(self):
- return 'node.labels.{name}=={value}'.format(name=self.name, value=self.value)
+ return f'node.labels.{self.name}=={self.value}'
@property
def constraint(self):
return DockerServiceConstraint(
- name='node.labels.{name}'.format(name=self.name),
+ name=f'node.labels.{self.name}',
op='==',
value=self.value
)
@@ -744,7 +744,7 @@ class DockerTask:
@property
def state(self):
- return ('{}-{}'.format(self._desired_state, self._state)).lower()
+ return (f'{self._desired_state}-{self._state}').lower()
@property
def current_state(self):
diff --git a/lib/galaxy/containers/docker_swarm.py b/lib/galaxy/containers/docker_swarm.py
index 95b838a13ef..4edc04bc6f5 100644
--- a/lib/galaxy/containers/docker_swarm.py
+++ b/lib/galaxy/containers/docker_swarm.py
@@ -331,7 +331,7 @@ class DockerSwarmCLIInterface(DockerSwarmInterface, DockerCLIInterface):
@docker_columns
def service_ps(self, service_id):
- return self._run_docker(subcommand='service ps', args='--no-trunc {}'.format(service_id))
+ return self._run_docker(subcommand='service ps', args=f'--no-trunc {service_id}')
def service_rm(self, service_ids):
service_ids = ' '.join(service_ids)
@@ -347,7 +347,7 @@ class DockerSwarmCLIInterface(DockerSwarmInterface, DockerCLIInterface):
@docker_columns
def node_ps(self, node_id):
- return self._run_docker(subcommand='node ps', args='--no-trunc {}'.format(node_id))
+ return self._run_docker(subcommand='node ps', args=f'--no-trunc {node_id}')
def node_update(self, node_id, **kwopts):
return self._run_docker(subcommand='node update', args='{kwopts} {node_id}'.format(
diff --git a/lib/galaxy/datatypes/anvio.py b/lib/galaxy/datatypes/anvio.py
index 6faf20cf4cc..bfce608b7d4 100644
--- a/lib/galaxy/datatypes/anvio.py
+++ b/lib/galaxy/datatypes/anvio.py
@@ -37,7 +37,7 @@ class AnvioComposite(Html):
missing_text = ''
if not os.path.exists(os.path.join(dataset.extra_files_path, composite_name)):
missing_text = ' (missing)'
- rval.append('
{}{}{}'.format(composite_name, composite_name, opt_text, missing_text))
+ rval.append(f'{composite_name}{opt_text}{missing_text}')
rval.append("")
defined_files = map(lambda x: x[0], defined_files)
extra_files = []
@@ -49,7 +49,7 @@ class AnvioComposite(Html):
if extra_files:
rval.append("This composite dataset contains these undefined files:")
for rel_path in extra_files:
- rval.append('- {}
'.format(rel_path, rel_path))
+ rval.append(f'- {rel_path}
')
rval.append('
')
if not (defined_files or extra_files):
rval.append("This composite dataset does not contain any files!")
diff --git a/lib/galaxy/datatypes/assembly.py b/lib/galaxy/datatypes/assembly.py
index 33bde89ca1f..1d43c639522 100644
--- a/lib/galaxy/datatypes/assembly.py
+++ b/lib/galaxy/datatypes/assembly.py
@@ -157,7 +157,7 @@ class Velvet(Html):
if composite_file.get('description'):
rval.append('- {} ({}){}
'.format(fn, fn, composite_file.get('description'), opt_text))
else:
- rval.append('- {}{}
'.format(fn, fn, opt_text))
+ rval.append(f'- {fn}{opt_text}
')
rval.append('