mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-16 15:45:04 +08:00
Post-merge pass updating py3 features/standardizing
This commit is contained in:
@@ -898,13 +898,13 @@ class Text(Data):
|
||||
lc = self.count_data_lines(dataset)
|
||||
if lc is not None:
|
||||
dataset.metadata.data_lines = lc
|
||||
dataset.blurb = "%s %s" % (util.commaify(str(lc)), inflector.cond_plural(lc, self.line_class))
|
||||
dataset.blurb = "{} {}".format(util.commaify(str(lc)), inflector.cond_plural(lc, self.line_class))
|
||||
else:
|
||||
dataset.blurb = "Error: Cannot count lines in dataset"
|
||||
else:
|
||||
est_lines = self.estimate_file_lines(dataset)
|
||||
if est_lines is not None:
|
||||
dataset.blurb = "~%s %s" % (util.commaify(util.roundify(str(est_lines))), inflector.cond_plural(est_lines, self.line_class))
|
||||
dataset.blurb = "~{} {}".format(util.commaify(util.roundify(str(est_lines))), inflector.cond_plural(est_lines, self.line_class))
|
||||
else:
|
||||
dataset.blurb = "Error: Cannot estimate lines in dataset"
|
||||
else:
|
||||
|
||||
@@ -172,17 +172,17 @@ class Pdf(Image):
|
||||
|
||||
def create_applet_tag_peek(class_name, archive, params):
|
||||
text = """
|
||||
<object classid="java:%s"
|
||||
<object classid="java:{}"
|
||||
type="application/x-java-applet"
|
||||
height="30" width="200" align="center" >
|
||||
<param name="archive" value="%s"/>""" % (class_name, archive)
|
||||
<param name="archive" value="{}"/>""".format(class_name, archive)
|
||||
for name, value in params.items():
|
||||
text += """<param name="{}" value="{}"/>""".format(name, value)
|
||||
text += """
|
||||
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
|
||||
height="30" width="200" >
|
||||
<param name="code" value="%s" />
|
||||
<param name="archive" value="%s"/>""" % (class_name, archive)
|
||||
<param name="code" value="{}" />
|
||||
<param name="archive" value="{}"/>""".format(class_name, archive)
|
||||
for name, value in params.items():
|
||||
text += """<param name="{}" value="{}"/>""".format(name, value)
|
||||
text += """<div class="errormessage">You must install and enable Java in your browser in order to access this applet.<div></object>
|
||||
|
||||
@@ -146,10 +146,10 @@ class DoiCitation(BaseCitation):
|
||||
log.exception("Failed to fetch bibtex for DOI %s", self.__doi)
|
||||
|
||||
if self.raw_bibtex is DoiCitation.BIBTEX_UNSET:
|
||||
return """@MISC{%s,
|
||||
DOI = {%s},
|
||||
note = {Failed to fetch BibTeX for DOI.}
|
||||
}""" % (self.__doi, self.__doi)
|
||||
return """@MISC{{{},
|
||||
DOI = {{{}}},
|
||||
note = {{Failed to fetch BibTeX for DOI.}}
|
||||
}}""".format(self.__doi, self.__doi)
|
||||
else:
|
||||
return self.raw_bibtex
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ GALAXY_FLAVORED_MARKDOWN_CONTAINER_REGEX = r'(?P<container>%s)' % "|".join(GALAX
|
||||
ARG_VAL_REGEX = r'''[\w_\-]+|\"[^\"]+\"|\'[^\']+\''''
|
||||
FUNCTION_ARG = r'\s*\w+\s*=\s*(?:%s)\s*' % ARG_VAL_REGEX
|
||||
# embed commas between arguments
|
||||
FUNCTION_MULTIPLE_ARGS = r'(?P<firstargcall>%s)(?P<restargcalls>(?:,%s)*)' % (FUNCTION_ARG, FUNCTION_ARG)
|
||||
FUNCTION_MULTIPLE_ARGS = r'(?P<firstargcall>{})(?P<restargcalls>(?:,{})*)'.format(FUNCTION_ARG, FUNCTION_ARG)
|
||||
FUNCTION_MULTIPLE_ARGS_PATTERN = re.compile(FUNCTION_MULTIPLE_ARGS)
|
||||
FUNCTION_CALL_LINE_TEMPLATE = r'\s*%s\s*\((?:' + FUNCTION_MULTIPLE_ARGS + r')?\)\s*'
|
||||
GALAXY_MARKDOWN_FUNCTION_CALL_LINE = re.compile(FUNCTION_CALL_LINE_TEMPLATE % GALAXY_FLAVORED_MARKDOWN_CONTAINER_REGEX)
|
||||
|
||||
@@ -580,34 +580,34 @@ def resolve_invocation_markdown(trans, invocation, workflow_markdown):
|
||||
continue
|
||||
|
||||
if output_assoc.history_content_type == "dataset":
|
||||
section_markdown += """#### Output Dataset: %s
|
||||
section_markdown += """#### Output Dataset: {}
|
||||
```galaxy
|
||||
history_dataset_display(output="%s")
|
||||
history_dataset_display(output="{}")
|
||||
```
|
||||
""" % (output_assoc.workflow_output.label, output_assoc.workflow_output.label)
|
||||
""".format(output_assoc.workflow_output.label, output_assoc.workflow_output.label)
|
||||
else:
|
||||
section_markdown += """#### Output Dataset Collection: %s
|
||||
section_markdown += """#### Output Dataset Collection: {}
|
||||
```galaxy
|
||||
history_dataset_collection_display(output="%s")
|
||||
history_dataset_collection_display(output="{}")
|
||||
```
|
||||
""" % (output_assoc.workflow_output.label, output_assoc.workflow_output.label)
|
||||
""".format(output_assoc.workflow_output.label, output_assoc.workflow_output.label)
|
||||
elif container == "invocation_inputs":
|
||||
for input_assoc in invocation.input_associations:
|
||||
if not input_assoc.workflow_step.label:
|
||||
continue
|
||||
|
||||
if input_assoc.history_content_type == "dataset":
|
||||
section_markdown += """#### Input Dataset: %s
|
||||
section_markdown += """#### Input Dataset: {}
|
||||
```galaxy
|
||||
history_dataset_display(input="%s")
|
||||
history_dataset_display(input="{}")
|
||||
```
|
||||
""" % (input_assoc.workflow_step.label, input_assoc.workflow_step.label)
|
||||
""".format(input_assoc.workflow_step.label, input_assoc.workflow_step.label)
|
||||
else:
|
||||
section_markdown += """#### Input Dataset Collection: %s
|
||||
section_markdown += """#### Input Dataset Collection: {}
|
||||
```galaxy
|
||||
history_dataset_collection_display(input=%s)
|
||||
history_dataset_collection_display(input={})
|
||||
```
|
||||
""" % (input_assoc.workflow_step.label, input_assoc.workflow_step.label)
|
||||
""".format(input_assoc.workflow_step.label, input_assoc.workflow_step.label)
|
||||
else:
|
||||
return line, False
|
||||
return section_markdown, True
|
||||
|
||||
@@ -1333,7 +1333,7 @@ class SetupRubyEnvironment(Download, RecipeStep):
|
||||
if os.path.isfile(gem):
|
||||
# we assume a local shipped gem file
|
||||
cmd = '''PATH=$PATH:$RUBY_HOME/bin; export PATH; GEM_HOME=$INSTALL_DIR; export GEM_HOME;
|
||||
gem install --local %s %s''' % (gem, gem_parameters)
|
||||
gem install --local {} {}'''.format(gem, gem_parameters)
|
||||
elif gem.find('://') != -1:
|
||||
# We assume a URL to a gem file.
|
||||
url = gem
|
||||
@@ -1341,7 +1341,7 @@ class SetupRubyEnvironment(Download, RecipeStep):
|
||||
checksums = ruby_package_tup_dict.get('checksums', {})
|
||||
self.url_download(work_dir, gem_name, url, extract=False, checksums=checksums)
|
||||
cmd = '''PATH=$PATH:$RUBY_HOME/bin; export PATH; GEM_HOME=$INSTALL_DIR; export GEM_HOME;
|
||||
gem install --local %s %s''' % (gem_name, gem_parameters)
|
||||
gem install --local {} {}'''.format(gem_name, gem_parameters)
|
||||
else:
|
||||
# gem file from rubygems.org with or without version number
|
||||
if gem_version:
|
||||
@@ -1349,11 +1349,11 @@ class SetupRubyEnvironment(Download, RecipeStep):
|
||||
# Use raw strings so that python won't automatically unescape the quotes before passing the command
|
||||
# to subprocess.Popen.
|
||||
cmd = r'''PATH=$PATH:$RUBY_HOME/bin; export PATH; GEM_HOME=$INSTALL_DIR; export GEM_HOME;
|
||||
gem install %s --version "=%s" %s''' % (gem, gem_version, gem_parameters)
|
||||
gem install {} --version "={}" {}'''.format(gem, gem_version, gem_parameters)
|
||||
else:
|
||||
# no version number given
|
||||
cmd = '''PATH=$PATH:$RUBY_HOME/bin; export PATH; GEM_HOME=$INSTALL_DIR; export GEM_HOME;
|
||||
gem install %s %s''' % (gem, gem_parameters)
|
||||
gem install {} {}'''.format(gem, gem_parameters)
|
||||
cmd = install_environment.build_command(basic_util.evaluate_template(cmd, install_environment))
|
||||
return_code = install_environment.handle_command(tool_dependency=tool_dependency,
|
||||
cmd=cmd,
|
||||
|
||||
@@ -324,11 +324,11 @@ class DockerContainer(Container, HasDockerLikeVolumes):
|
||||
# Standard error is:
|
||||
# Error response from daemon: Cannot kill container: 2b0b961527574ebc873256b481bbe72e: No such container: 2b0b961527574ebc873256b481bbe72e
|
||||
return """
|
||||
_on_exit() {
|
||||
%s &> /dev/null
|
||||
}
|
||||
_on_exit() {{
|
||||
{} &> /dev/null
|
||||
}}
|
||||
trap _on_exit 0
|
||||
%s\n%s""" % (kill_command, cache_command, run_command)
|
||||
{}\n{}""".format(kill_command, cache_command, run_command)
|
||||
|
||||
def __cache_from_file_command(self, cached_image_file, docker_host_props):
|
||||
images_cmd = docker_util.build_docker_images_command(truncate=False, **docker_host_props)
|
||||
|
||||
@@ -515,7 +515,7 @@ class DefaultToolAction:
|
||||
)
|
||||
if hdca:
|
||||
datasets_to_persist.append(hdca)
|
||||
log.info("Handled collection output named %s for tool %s %s" % (name, tool.id, handle_output_timer))
|
||||
log.info("Handled collection output named {} for tool {} {}".format(name, tool.id, handle_output_timer))
|
||||
else:
|
||||
handle_output(name, output)
|
||||
log.info("Handled output named {} for tool {} {}".format(name, tool.id, handle_output_timer))
|
||||
@@ -560,7 +560,7 @@ class DefaultToolAction:
|
||||
current_job=job,
|
||||
out_data=out_data)
|
||||
datasets_to_persist = []
|
||||
log.info("Setup for job %s complete, ready to be enqueued %s" % (job.log_str(), job_setup_timer))
|
||||
log.info("Setup for job {} complete, ready to be enqueued {}".format(job.log_str(), job_setup_timer))
|
||||
|
||||
# Some tools are not really executable, but jobs are still created for them ( for record keeping ).
|
||||
# Examples include tools that redirect to other applications ( epigraph ). These special tools must
|
||||
@@ -589,7 +589,7 @@ class DefaultToolAction:
|
||||
history.add_datasets(trans.sa_session, datasets_to_persist, set_hid=set_output_hid, quota=False, flush=False)
|
||||
job_flush_timer = ExecutionTimer()
|
||||
trans.sa_session.flush()
|
||||
log.info("Flushed transaction for job %s %s" % (job.log_str(), job_flush_timer))
|
||||
log.info("Flushed transaction for job {} {}".format(job.log_str(), job_flush_timer))
|
||||
|
||||
# Dispatch to a job handler. enqueue() is responsible for flushing the job
|
||||
app.job_manager.enqueue(job, tool=tool)
|
||||
|
||||
@@ -1045,7 +1045,7 @@ def unicodify(value, encoding=DEFAULT_ENCODING, error='replace', strip_null=Fals
|
||||
if not isinstance(value, text_type):
|
||||
value = text_type(value, encoding, error)
|
||||
except Exception as e:
|
||||
msg = "Value '%s' could not be coerced to Unicode: %s('%s')" % (value, type(e).__name__, e)
|
||||
msg = "Value '{}' could not be coerced to Unicode: {}('{}')".format(value, type(e).__name__, e)
|
||||
raise Exception(msg)
|
||||
if strip_null:
|
||||
return value.replace('\0', '')
|
||||
|
||||
@@ -444,10 +444,10 @@ def send_report(rep, exc_data, html=True):
|
||||
traceback.print_exc(file=output)
|
||||
if html:
|
||||
return """
|
||||
<p>Additionally an error occurred while sending the %s report:
|
||||
<p>Additionally an error occurred while sending the {} report:
|
||||
|
||||
<pre>%s</pre>
|
||||
</p>""" % (
|
||||
<pre>{}</pre>
|
||||
</p>""".format(
|
||||
markupsafe.escape(str(rep)), output.getvalue())
|
||||
else:
|
||||
return (
|
||||
@@ -463,11 +463,11 @@ def error_template(head_html, exception, extra):
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body { color: #303030; background: #dfe5f9; font-family:"Lucida Grande",verdana,arial,helvetica,sans-serif; font-size:12px; line-height:16px; }
|
||||
.content { max-width: 720px; margin: auto; margin-top: 50px; }
|
||||
body {{ color: #303030; background: #dfe5f9; font-family:"Lucida Grande",verdana,arial,helvetica,sans-serif; font-size:12px; line-height:16px; }}
|
||||
.content {{ max-width: 720px; margin: auto; margin-top: 50px; }}
|
||||
</style>
|
||||
<title>Internal Server Error</title>
|
||||
%s
|
||||
{}
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
@@ -475,14 +475,14 @@ def error_template(head_html, exception, extra):
|
||||
|
||||
<h2>Galaxy was unable to successfully complete your request</h2>
|
||||
|
||||
<p>%s</p>
|
||||
<p>{}</p>
|
||||
|
||||
This may be an intermittent problem due to load or other unpredictable factors, reloading the page may address the problem.
|
||||
|
||||
%s
|
||||
{}
|
||||
</div>
|
||||
</body>
|
||||
</html>''' % (head_html, exception, extra)
|
||||
</html>'''.format(head_html, exception, extra)
|
||||
|
||||
|
||||
def make_error_middleware(app, global_conf, **kw):
|
||||
|
||||
@@ -72,7 +72,7 @@ class DatatypesController(BaseAPIController):
|
||||
n = c.__module__ + "." + c.__name__
|
||||
types = {n}
|
||||
visit_bases(types, c)
|
||||
class_to_classes[n] = dict((t, True) for t in types)
|
||||
class_to_classes[n] = {t: True for t in types}
|
||||
return dict(ext_to_class_name=ext_to_class_name, class_to_classes=class_to_classes)
|
||||
|
||||
@expose_api_anonymous_and_sessionless
|
||||
|
||||
@@ -278,8 +278,8 @@ class RootController(controller.JSAppLauncher, UsesAnnotations):
|
||||
trans.set_history(new_history)
|
||||
trans.log_event("History imported, id: {}, name: '{}': ".format(str(new_history.id), new_history.name))
|
||||
return trans.show_ok_message("""
|
||||
History "%s" has been imported. Click <a href="%s">here</a>
|
||||
to begin.""" % (new_history.name, web.url_for('/')))
|
||||
History "{}" has been imported. Click <a href="{}">here</a>
|
||||
to begin.""".format(new_history.name, web.url_for('/')))
|
||||
elif not user_history.datasets or confirm:
|
||||
new_history = import_history.copy()
|
||||
new_history.name = "imported: " + new_history.name
|
||||
@@ -297,8 +297,8 @@ class RootController(controller.JSAppLauncher, UsesAnnotations):
|
||||
trans.set_history(new_history)
|
||||
trans.log_event("History imported, id: {}, name: '{}': ".format(str(new_history.id), new_history.name))
|
||||
return trans.show_ok_message("""
|
||||
History "%s" has been imported. Click <a href="%s">here</a>
|
||||
to begin.""" % (new_history.name, web.url_for('/')))
|
||||
History "{}" has been imported. Click <a href="{}">here</a>
|
||||
to begin.""".format(new_history.name, web.url_for('/')))
|
||||
return trans.show_warn_message("""
|
||||
Warning! If you import this history, you will lose your current
|
||||
history. Click <a href="%s">here</a> to confirm.
|
||||
|
||||
@@ -773,9 +773,9 @@ class WorkflowController(BaseUIController, SharableMixin, UsesStoredWorkflowMixi
|
||||
workflow_list_str = " <br>Return to <a href='%s'>workflow list." % url_for(controller='workflows', action='list')
|
||||
if myexp_workflow_id:
|
||||
return trans.show_message(
|
||||
"""Workflow '%s' successfully exported to myExperiment. <br/>
|
||||
<a href="http://%s/workflows/%s">Click here to view the workflow on myExperiment</a> %s
|
||||
""" % (stored.name, myexp_url, myexp_workflow_id, workflow_list_str),
|
||||
"""Workflow '{}' successfully exported to myExperiment. <br/>
|
||||
<a href="http://{}/workflows/{}">Click here to view the workflow on myExperiment</a> {}
|
||||
""".format(stored.name, myexp_url, myexp_workflow_id, workflow_list_str),
|
||||
use_panels=True)
|
||||
else:
|
||||
return trans.show_error_message(
|
||||
|
||||
@@ -289,7 +289,7 @@ class DatasetCollectionApiTestCase(ApiTestCase):
|
||||
response = self._get(contents_url)
|
||||
self._assert_status_code_is(response, 200)
|
||||
fake_collection_id = '5d7db0757a2eb7ef'
|
||||
fake_contents_url = '/api/dataset_collections/%s/contents/%s' % (hdca['id'], fake_collection_id)
|
||||
fake_contents_url = '/api/dataset_collections/{}/contents/{}'.format(hdca['id'], fake_collection_id)
|
||||
error_response = self._get(fake_contents_url)
|
||||
assert_object_id_error(error_response)
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class DatatypesApiTestCase(ApiTestCase):
|
||||
|
||||
datatypes = response_dict["datatypes"]
|
||||
for common_type in ["tabular", "fasta"]:
|
||||
assert common_type in datatypes, "%s not in %s" % (common_type, datatypes)
|
||||
assert common_type in datatypes, "{} not in {}".format(common_type, datatypes)
|
||||
|
||||
def test_sniffers(self):
|
||||
response = self._get("datatypes/sniffers")
|
||||
|
||||
@@ -21,7 +21,7 @@ def setup_keep_outdir():
|
||||
def target_url_parts():
|
||||
host = socket.gethostbyname(os.environ.get('GALAXY_TEST_HOST', DEFAULT_WEB_HOST))
|
||||
port = os.environ.get('GALAXY_TEST_PORT')
|
||||
default_url = "http://%s:%s" % (host, port)
|
||||
default_url = "http://{}:{}".format(host, port)
|
||||
url = os.environ.get('GALAXY_TEST_EXTERNAL', default_url)
|
||||
return host, port, url
|
||||
|
||||
|
||||
Reference in New Issue
Block a user