Skip to content

Commit

Permalink
Merge pull request #18063 from galaxybot/dev_auto_update_dependencies
Browse files Browse the repository at this point in the history
Update Python dependencies
  • Loading branch information
nsoranzo authored Apr 29, 2024
2 parents ca4d90a + 6492f07 commit 7463439
Show file tree
Hide file tree
Showing 131 changed files with 398 additions and 442 deletions.
28 changes: 14 additions & 14 deletions config/plugins/webhooks/demo/tour_generator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _upload_test_data(self):
filename = test_datasets[input_name]
input_path = self._tool.test_data_path(filename)
if not input_path:
raise ValueError('Test dataset "%s" doesn\'t exist.' % input_name)
raise ValueError(f'Test dataset "{input_name}" doesn\'t exist.')
upload_tool = self._trans.app.toolbox.get_tool("upload1")
filename = os.path.basename(input_path)
with open(input_path, "rb") as f:
Expand Down Expand Up @@ -92,12 +92,12 @@ def _upload_test_data(self):

def _generate_tour(self):
"""Generate a tour."""
tour_name = self._tool.name + " Tour"
tour_name = f"{self._tool.name} Tour"
test_inputs = self._test.inputs.keys()
steps = [
{
"title": tour_name,
"content": "This short tour will guide you through the <b>" + self._tool.name + "</b> tool.",
"content": f"This short tour will guide you through the <b>{self._tool.name}</b> tool.",
"orphan": True,
}
]
Expand All @@ -107,26 +107,26 @@ def _generate_tour(self):
continue
step = {
"title": input.label,
"element": "[id='form-element-%s']" % name,
"element": f"[id='form-element-{name}']",
"placement": "right",
"content": "",
}
if input.type == "text":
if name in test_inputs:
param = self._test.inputs[name]
step["content"] = "Enter value(s): <b>%s</b>" % param
step["content"] = f"Enter value(s): <b>{param}</b>"
else:
step["content"] = "Enter a value"
elif input.type == "integer" or input.type == "float":
if name in test_inputs:
num_param = self._test.inputs[name][0]
step["content"] = "Enter number: <b>%s</b>" % num_param
step["content"] = f"Enter number: <b>{num_param}</b>"
else:
step["content"] = "Enter a number"
elif input.type == "boolean":
if name in test_inputs:
choice = "Yes" if self._test.inputs[name][0] is True else "No"
step["content"] = "Choose <b>%s</b>" % choice
step["content"] = f"Choose <b>{choice}</b>"
else:
step["content"] = "Choose Yes/No"
elif input.type == "select":
Expand All @@ -138,7 +138,7 @@ def _generate_tour(self):
params.append(option[0])
if params:
select_param = ", ".join(params)
step["content"] = "Select parameter(s): <b>%s</b>" % select_param
step["content"] = f"Select parameter(s): <b>{select_param}</b>"
else:
step["content"] = "Select a parameter"
elif input.type == "data":
Expand All @@ -151,7 +151,7 @@ def _generate_tour(self):
elif input.type == "conditional":
param_id = f"{input.name}|{input.test_param.name}"
step["title"] = input.test_param.label
step["element"] = "[id='form-element-%s']" % param_id
step["element"] = f"[id='form-element-{param_id}']"
params = []
if param_id in self._test.inputs.keys():
for option in input.test_param.static_options:
Expand All @@ -173,24 +173,24 @@ def _generate_tour(self):
step_msg = f"Select dataset: <b>{hid}: {dataset}</b>"
else:
case_params = ", ".join(self._test.inputs[tour_id])
step_msg = "Select parameter(s): " + "<b>%s</b>" % case_params
step_msg = f"Select parameter(s): <b>{case_params}</b>"
cond_case_steps.append(
{
"title": case_title,
"element": "[id='form-element-%s']" % tour_id,
"element": f"[id='form-element-{tour_id}']",
"placement": "right",
"content": step_msg,
}
)
if params:
cond_param = ", ".join(params)
step["content"] = "Select parameter(s): <b>%s</b>" % cond_param
step["content"] = f"Select parameter(s): <b>{cond_param}</b>"
else:
step["content"] = "Select a parameter"
elif input.type == "data_column":
if name in test_inputs:
column_param = self._test.inputs[name][0]
step["content"] = "Select <b>Column: %s</b>" % column_param
step["content"] = f"Select <b>Column: {column_param}</b>"
else:
step["content"] = "Select a column"
else:
Expand All @@ -210,7 +210,7 @@ def _generate_tour(self):
self._tour = {
"title_default": tour_name,
"name": tour_name,
"description": self._tool.name + " " + self._tool.description,
"description": f"{self._tool.name} {self._tool.description}",
"steps": steps,
}

Expand Down
32 changes: 14 additions & 18 deletions doc/parse_gx_xsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main():


class Tag:
def __init__(self, line):
def __init__(self, line: str):
assert line.startswith("$tag:")
line_parts = line.split(" ")
first_part = line_parts[0]
Expand All @@ -52,12 +52,12 @@ def __init__(self, line):

@property
def _pretty_title(self):
return " > ".join("``%s``" % p for p in self.title.split("|"))
return " > ".join(f"``{p}``" for p in self.title.split("|"))

def build_help(self):
tag = xmlschema_doc.find(self.xpath)
if tag is None:
raise Exception("Could not find xpath for %s" % self.xpath)
raise Exception(f"Could not find xpath for {self.xpath}")

tag_help = StringIO()
tag_help.write("## " + self._pretty_title)
Expand Down Expand Up @@ -98,7 +98,7 @@ def _build_tag(tag, hide_attributes):
doc = _doc_or_none(element)
if doc is None:
doc = _doc_or_none(_type_el(element))
assert doc is not None, "Documentation for %s is empty" % element.attrib["name"]
assert doc is not None, f"Documentation for {element.attrib['name']} is empty"
doc = doc.strip()

element_el = _find_tag_el(element)
Expand All @@ -110,10 +110,9 @@ def _build_tag(tag, hide_attributes):
if best_practices := _get_bp_link(annotation_el):
tag_help.write("\n\n### Best Practices\n")
tag_help.write(
"""
Find the Intergalactic Utilities Commision suggested best practices for this
element [here](%s)."""
% best_practices
f"""
Find the Intergalactic Utilities Commission suggested best practices for this
element [here]({best_practices})."""
)
tag_help.write(_build_attributes_table(tag, attributes, hide_attributes))

Expand All @@ -140,7 +139,7 @@ def _get_bp_link(annotation_el):
anchor = annotation_el.attrib.get("{http://galaxyproject.org/xml/1.0}best_practices", None)
link = None
if anchor:
link = "https://galaxy-iuc-standards.readthedocs.io/en/latest/best_practices/tool_xml.html#%s" % anchor
link = f"https://galaxy-iuc-standards.readthedocs.io/en/latest/best_practices/tool_xml.html#{anchor}"
return link


Expand All @@ -149,7 +148,7 @@ def _build_attributes_table(tag, attributes, hide_attributes=False, attribute_na
attribute_table.write("\n\n")
if attributes and not hide_attributes:
header_prefix = "#" * header_level
attribute_table.write("\n%s Attributes\n\n" % header_prefix)
attribute_table.write(f"\n{header_prefix} Attributes\n\n")
attribute_table.write("Attribute | Details | Required\n")
attribute_table.write("--- | --- | ---\n")
for attribute in attributes:
Expand All @@ -159,7 +158,7 @@ def _build_attributes_table(tag, attributes, hide_attributes=False, attribute_na
details = _doc_or_none(attribute)
if details is None:
type_el = _type_el(attribute)
assert type_el is not None, "No details or type found for %s" % name
assert type_el is not None, f"No details or type found for {name}"
details = _doc_or_none(type_el)
annotation_el = type_el.find("{http://www.w3.org/2001/XMLSchema}annotation")
else:
Expand All @@ -170,10 +169,7 @@ def _build_attributes_table(tag, attributes, hide_attributes=False, attribute_na
details = details.replace("|", "\\|").strip()
best_practices = _get_bp_link(annotation_el)
if best_practices:
details += (
""" Find the Intergalactic Utilities Commision suggested best practices for this element [here](%s)."""
% best_practices
)
details += f""" Find the Intergalactic Utilities Commission suggested best practices for this element [here]({best_practices})."""

attribute_table.write(f"``{name}`` | {details} | {use}\n")
return attribute_table.getvalue()
Expand Down Expand Up @@ -204,7 +200,7 @@ def _find_attributes(tag):
for attribute_group in attribute_groups:
attribute_group_name = attribute_group.get("ref")
attribute_group_def = xmlschema_doc.find(
"//{http://www.w3.org/2001/XMLSchema}attributeGroup/[@name='%s']" % attribute_group_name
f"//{{http://www.w3.org/2001/XMLSchema}}attributeGroup/[@name='{attribute_group_name}']"
)
attributes.extend(_find_attributes(attribute_group_def))
return attributes
Expand All @@ -219,9 +215,9 @@ def _find_tag_el(tag):

def _type_el(tag):
element_type = tag.attrib["type"]
type_el = xmlschema_doc.find("//{http://www.w3.org/2001/XMLSchema}complexType/[@name='%s']" % element_type)
type_el = xmlschema_doc.find(f"//{{http://www.w3.org/2001/XMLSchema}}complexType/[@name='{element_type}']")
if type_el is None:
type_el = xmlschema_doc.find("//{http://www.w3.org/2001/XMLSchema}simpleType/[@name='%s']" % element_type)
type_el = xmlschema_doc.find(f"//{{http://www.w3.org/2001/XMLSchema}}simpleType/[@name='{element_type}']")
return type_el


Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/actions/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def _check_path_paste_params(self, params):
if not os.path.exists(path):
bad_paths.append(path)
if bad_paths:
message = 'Invalid paths: "%s".' % '", "'.join(bad_paths)
message = 'Invalid paths: "{}".'.format('", "'.join(bad_paths))
response_code = 400
return None, response_code, message
return None
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/auth/providers/ldap_ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ def check_config(self, username, email, options):
self.role_search_attribute = options.get(self.role_search_option)
if self.auto_create_roles_or_groups and self.role_search_attribute is None:
raise ConfigurationError(
"If 'auto-create-roles' or 'auto-create-groups' is True, a '%s' attribute has to"
" be provided." % self.role_search_option
f"If 'auto-create-roles' or 'auto-create-groups' is True, a '{self.role_search_option}' attribute has to"
" be provided."
)

return ok, failure_mode
Expand Down
5 changes: 3 additions & 2 deletions lib/galaxy/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,8 @@ def _process_config(self, kwargs: Dict[str, Any]) -> None:
log.warning(
"The path '%s' for the 'sanitize_allowlist_file' config option is "
"deprecated and will be no longer checked in a future release. Please consult "
"the latest version of the sample configuration file." % deprecated
"the latest version of the sample configuration file.",
deprecated,
)
_sanitize_allowlist_path = deprecated
break
Expand All @@ -965,7 +966,7 @@ def _process_config(self, kwargs: Dict[str, Any]) -> None:
)
# Searching data libraries
self.ftp_upload_dir_template = kwargs.get(
"ftp_upload_dir_template", "${ftp_upload_dir}%s${ftp_upload_dir_identifier}" % os.path.sep
"ftp_upload_dir_template", f"${{ftp_upload_dir}}{os.path.sep}${{ftp_upload_dir_identifier}}"
)
# Support older library-specific path paste option but just default to the new
# allow_path_paste value.
Expand Down
14 changes: 7 additions & 7 deletions lib/galaxy/datatypes/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -2089,7 +2089,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str:
try:
return dataset.peek
except Exception:
return "HDF5 Model (%s)" % (nice_size(dataset.get_size()))
return f"HDF5 Model ({nice_size(dataset.get_size())})"

def display_data(
self,
Expand Down Expand Up @@ -4258,7 +4258,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str:
try:
return dataset.peek
except Exception:
return "Binary pretext file (%s)" % (nice_size(dataset.get_size()))
return f"Binary pretext file ({nice_size(dataset.get_size())})"


class JP2(Binary):
Expand Down Expand Up @@ -4302,7 +4302,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str:
try:
return dataset.peek
except Exception:
return "Binary JPEG 2000 file (%s)" % (nice_size(dataset.get_size()))
return f"Binary JPEG 2000 file ({nice_size(dataset.get_size())})"


class Npz(CompressedArchive):
Expand Down Expand Up @@ -4356,7 +4356,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str:
try:
return dataset.peek
except Exception:
return "Binary Numpy npz file (%s)" % (nice_size(dataset.get_size()))
return f"Binary Numpy npz file ({nice_size(dataset.get_size())})"


class HexrdImagesNpz(Npz):
Expand Down Expand Up @@ -4433,7 +4433,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str:
try:
return dataset.peek
except Exception:
return "Binary Numpy npz file (%s)" % (nice_size(dataset.get_size()))
return f"Binary Numpy npz file ({nice_size(dataset.get_size())})"


class HexrdEtaOmeNpz(Npz):
Expand Down Expand Up @@ -4495,7 +4495,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str:
try:
return dataset.peek
except Exception:
return "Binary Numpy npz file (%s)" % (nice_size(dataset.get_size()))
return f"Binary Numpy npz file ({nice_size(dataset.get_size())})"


class FITS(Binary):
Expand Down Expand Up @@ -4624,4 +4624,4 @@ def display_peek(self, dataset: DatasetProtocol) -> str:
try:
return dataset.peek
except Exception:
return "Binary numpy file (%s)" % (nice_size(dataset.get_size()))
return f"Binary numpy file ({nice_size(dataset.get_size())})"
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def __main__():
fields = [str(item) for item in (region.chrom, region.start, region.end, name, 0, region.strand)]
if force_num_columns is not None and len(fields) != force_num_columns:
fields = force_bed_field_count(fields, count, force_num_columns)
out.write("%s\n" % "\t".join(fields))
out.write("{}\n".format("\t".join(fields)))
except Exception:
skipped_lines += 1
if first_skipped_line is None:
Expand Down
11 changes: 6 additions & 5 deletions lib/galaxy/datatypes/converters/maf_to_fasta_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ def __main__():
else:
spec_counts[spec] += 1
out.write(
"%s\n"
% maf_utilities.get_fasta_header(
c,
{"block_index": count, "species": spec, "sequence_index": spec_counts[spec]},
suffix="%s_%i_%i" % (spec, count, spec_counts[spec]),
"{}\n".format(
maf_utilities.get_fasta_header(
c,
{"block_index": count, "species": spec, "sequence_index": spec_counts[spec]},
suffix="%s_%i_%i" % (spec, count, spec_counts[spec]),
)
)
)
out.write(f"{c.text}\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def main():
with open(sys.argv[1]) as in_file, open(sys.argv[2], "w") as out_file:
try:
for fields in bx.wiggle.IntervalReader(UCSCOutWrapper(in_file)):
out_file.write("%s\n" % "\t".join(map(str, fields)))
out_file.write("{}\n".format("\t".join(map(str, fields))))
except UCSCLimitException:
# Wiggle data was truncated, at the very least need to warn the user.
sys.stderr.write(
Expand Down
6 changes: 3 additions & 3 deletions lib/galaxy/datatypes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,18 @@ def as_ucsc_display_file(self, dataset: DatasetProtocol, **kwd) -> Union[FileObj
if t < len(elems):
strand = cast(str, elems[t])
tmp = [elems[c], elems[s], elems[e], name, "0", strand]
fh.write("%s\n" % "\t".join(tmp))
fh.write("{}\n".format("\t".join(tmp)))
elif n >= 0: # name column (should) exists
for i, elems in enumerate(compression_utils.file_iter(dataset.get_file_name())):
name = "region_%i" % i
if n >= 0 and n < len(elems):
name = cast(str, elems[n])
tmp = [elems[c], elems[s], elems[e], name]
fh.write("%s\n" % "\t".join(tmp))
fh.write("{}\n".format("\t".join(tmp)))
else:
for elems in compression_utils.file_iter(dataset.get_file_name()):
tmp = [elems[c], elems[s], elems[e]]
fh.write("%s\n" % "\t".join(tmp))
fh.write("{}\n".format("\t".join(tmp)))
return compression_utils.get_fileobj(fh.name, mode="rb")

def display_peek(self, dataset: DatasetProtocol) -> str:
Expand Down
3 changes: 1 addition & 2 deletions lib/galaxy/datatypes/neo4j.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ def generate_primary_file(self, dataset: HasExtraFilesAndMetadata) -> str:
"""
# self.regenerate_primary_file(dataset)
rval = [
"<html><head><title>Files for Composite Dataset (%s)</title></head><p/>\
f"<html><head><title>Files for Composite Dataset ({self.file_ext})</title></head><p/>\
This composite dataset is composed of the following files:<p/><ul>"
% (self.file_ext)
]
for composite_name, composite_file in self.get_composite_files(dataset=dataset).items():
opt_text = ""
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/datatypes/proteomics.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ def sniff_prefix(self, file_prefix: FilePrefix) -> bool:
if not line.startswith("<?"):
break
# pattern match <root or <ns:root for any ns string
pattern = r"<(\w*:)?%s" % self.root
pattern = rf"<(\w*:)?{self.root}"
return re.search(pattern, line) is not None

def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
Expand Down
Loading

0 comments on commit 7463439

Please sign in to comment.