From 5544eff1416f69dcb650d3683f138d72360fd98f Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 11 Dec 2024 13:39:06 +0000 Subject: [PATCH] Fix UP031 errors - Part 6 Also: - Update ruff to 0.8.2 - Add type annotations. - Small refactorings. --- lib/galaxy/datatypes/binary.py | 6 ++--- .../converters/bed_to_gff_converter.py | 24 ++++++------------- .../datatypes/converters/fasta_to_len.py | 6 ++--- .../fastqsolexa_to_fasta_converter.py | 8 +------ .../fastqsolexa_to_qual_converter.py | 20 +++++----------- .../converters/gff_to_bed_converter.py | 9 ++----- .../converters/interval_to_bed_converter.py | 20 ++++++---------- .../interval_to_bedstrict_converter.py | 22 +++++++---------- .../datatypes/converters/interval_to_fli.py | 2 +- .../converters/lped_to_fped_converter.py | 2 +- .../converters/lped_to_pbed_converter.py | 2 +- .../converters/maf_to_fasta_converter.py | 6 ++--- .../converters/maf_to_interval_converter.py | 12 ++-------- .../converters/pbed_ldreduced_converter.py | 3 +-- .../converters/pbed_to_lped_converter.py | 2 +- .../picard_interval_list_to_bed6_converter.py | 7 ++---- lib/galaxy/datatypes/data.py | 3 +-- lib/galaxy/datatypes/genetics.py | 23 ++++++++++-------- .../dependencies/pinned-lint-requirements.txt | 2 +- 19 files changed, 62 insertions(+), 117 deletions(-) diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 71e92e583d46..f7c0aa365891 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -1196,7 +1196,7 @@ def set_meta( # Create the bcf index dataset_symlink = os.path.join( os.path.dirname(index_file.get_file_name()), - "__dataset_%d_%s" % (dataset.id, os.path.basename(index_file.get_file_name())), + f"__dataset_{dataset.id}_{os.path.basename(index_file.get_file_name())}", ) os.symlink(dataset.get_file_name(), dataset_symlink) try: @@ -1677,7 +1677,7 @@ def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: def _makelayerstrings(layer, count, names): "Format the layers." if layer in tmp.layers_names: - return "\n[%s]: %d %s\n %s" % ( + return "\n[{}]: {} {}\n {}".format( layer, count, "layer" if count == 1 else "layers", @@ -1685,7 +1685,7 @@ def _makelayerstrings(layer, count, names): ) return "" - peekstr = "[n_obs x n_vars]\n %d x %d" % tuple(tmp.shape) + peekstr = "[n_obs x n_vars]\n {} x {}".format(*tuple(tmp.shape)) peekstr += _makelayerstrings("obs", tmp.obs_count, tmp.obs_layers) peekstr += _makelayerstrings("var", tmp.var_count, tmp.var_layers) peekstr += _makelayerstrings("obsm", tmp.obsm_count, tmp.obsm_layers) diff --git a/lib/galaxy/datatypes/converters/bed_to_gff_converter.py b/lib/galaxy/datatypes/converters/bed_to_gff_converter.py index eee7add9a8dc..b7caaa52d0ab 100644 --- a/lib/galaxy/datatypes/converters/bed_to_gff_converter.py +++ b/lib/galaxy/datatypes/converters/bed_to_gff_converter.py @@ -3,8 +3,6 @@ import sys -assert sys.version_info[:2] >= (2, 6) - def __main__(): input_name = sys.argv[1] @@ -30,7 +28,7 @@ def __main__(): try: feature = elems[3] except Exception: - feature = "feature%d" % (i + 1) + feature = f"feature{i + 1}" start = int(elems[1]) + 1 end = int(elems[2]) try: @@ -44,17 +42,13 @@ def __main__(): try: group = elems[3] except Exception: - group = "group%d" % (i + 1) + group = f"group{i + 1}" if complete_bed: out.write( - "%s\tbed2gff\t%s\t%d\t%d\t%s\t%s\t.\t%s %s;\n" - % (chrom, feature, start, end, score, strand, feature, group) + f"{chrom}\tbed2gff\t{feature}\t{start}\t{end}\t{score}\t{strand}\t.\t{feature} {group};\n" ) else: - out.write( - "%s\tbed2gff\t%s\t%d\t%d\t%s\t%s\t.\t%s;\n" - % (chrom, feature, start, end, score, strand, group) - ) + out.write(f"{chrom}\tbed2gff\t{feature}\t{start}\t{end}\t{score}\t{strand}\t.\t{group};\n") if complete_bed: # We have all the info necessary to annotate exons for genes and mRNAs block_count = int(elems[9]) @@ -64,8 +58,7 @@ def __main__(): exon_start = int(start) + int(block_starts[j]) exon_end = exon_start + int(block_sizes[j]) - 1 out.write( - "%s\tbed2gff\texon\t%d\t%d\t%s\t%s\t.\texon %s;\n" - % (chrom, exon_start, exon_end, score, strand, group) + f"{chrom}\tbed2gff\texon\t{exon_start}\t{exon_end}\t{score}\t{strand}\t.\texon {group};\n" ) except Exception: skipped_lines += 1 @@ -75,12 +68,9 @@ def __main__(): skipped_lines += 1 if not first_skipped_line: first_skipped_line = i + 1 - info_msg = "%i lines converted to GFF version 2. " % (i + 1 - skipped_lines) + info_msg = f"{i + 1 - skipped_lines} lines converted to GFF version 2. " if skipped_lines > 0: - info_msg += "Skipped %d blank/comment/invalid lines starting with line #%d." % ( - skipped_lines, - first_skipped_line, - ) + info_msg += f"Skipped {skipped_lines} blank/comment/invalid lines starting with line #{first_skipped_line}." print(info_msg) diff --git a/lib/galaxy/datatypes/converters/fasta_to_len.py b/lib/galaxy/datatypes/converters/fasta_to_len.py index b6f81aeacd64..489f242c6cc1 100644 --- a/lib/galaxy/datatypes/converters/fasta_to_len.py +++ b/lib/galaxy/datatypes/converters/fasta_to_len.py @@ -6,8 +6,6 @@ """ import sys -assert sys.version_info[:2] >= (2, 4) - def compute_fasta_length(fasta_file, out_file, keep_first_char, keep_first_word=False): infile = fasta_file @@ -34,7 +32,7 @@ def compute_fasta_length(fasta_file, out_file, keep_first_char, keep_first_word= if first_entry is False: if keep_first_word: fasta_title = fasta_title.split()[0] - out.write("%s\t%d\n" % (fasta_title[1:keep_first_char], seq_len)) + out.write(f"{fasta_title[1:keep_first_char]}\t{seq_len}\n") else: first_entry = False fasta_title = line @@ -45,7 +43,7 @@ def compute_fasta_length(fasta_file, out_file, keep_first_char, keep_first_word= # last fasta-entry if keep_first_word: fasta_title = fasta_title.split()[0] - out.write("%s\t%d\n" % (fasta_title[1:keep_first_char], seq_len)) + out.write(f"{fasta_title[1:keep_first_char]}\t{seq_len}\n") if __name__ == "__main__": diff --git a/lib/galaxy/datatypes/converters/fastqsolexa_to_fasta_converter.py b/lib/galaxy/datatypes/converters/fastqsolexa_to_fasta_converter.py index b7557de14817..2b69080a8480 100644 --- a/lib/galaxy/datatypes/converters/fastqsolexa_to_fasta_converter.py +++ b/lib/galaxy/datatypes/converters/fastqsolexa_to_fasta_converter.py @@ -15,12 +15,6 @@ """ import sys -assert sys.version_info[:2] >= (2, 4) - - -def stop_err(msg): - sys.exit(f"{msg}") - def __main__(): infile_name = sys.argv[1] @@ -39,7 +33,7 @@ def __main__(): if not seq_title_startswith: seq_title_startswith = line_startswith if seq_title_startswith != line_startswith: - stop_err("Invalid fastqsolexa format at line %d: %s." % (i + 1, line)) + sys.exit(f"Invalid fastqsolexa format at line {i + 1}: {line}.") outfile.write(f">{line[1:]}\n") elif fastq_block_lines == 2: # line 2 is nucleotides diff --git a/lib/galaxy/datatypes/converters/fastqsolexa_to_qual_converter.py b/lib/galaxy/datatypes/converters/fastqsolexa_to_qual_converter.py index c2f51cde20c8..0b6a79c2f3d0 100644 --- a/lib/galaxy/datatypes/converters/fastqsolexa_to_qual_converter.py +++ b/lib/galaxy/datatypes/converters/fastqsolexa_to_qual_converter.py @@ -15,12 +15,6 @@ """ import sys -assert sys.version_info[:2] >= (2, 4) - - -def stop_err(msg): - sys.exit(f"{msg}") - def __main__(): infile_name = sys.argv[1] @@ -42,7 +36,7 @@ def __main__(): if not seq_title_startswith: seq_title_startswith = line_startswith if line_startswith != seq_title_startswith: - stop_err("Invalid fastqsolexa format at line %d: %s." % (i + 1, line)) + sys.exit(f"Invalid fastqsolexa format at line {i + 1}: {line}.") read_title = line[1:] elif fastq_block_lines == 2: # second line is nucleotides @@ -52,12 +46,11 @@ def __main__(): if not qual_title_startswith: qual_title_startswith = line_startswith if line_startswith != qual_title_startswith: - stop_err("Invalid fastqsolexa format at line %d: %s." % (i + 1, line)) + sys.exit(f"Invalid fastqsolexa format at line {i + 1}: {line}.") quality_title = line[1:] if quality_title and read_title != quality_title: - stop_err( - 'Invalid fastqsolexa format at line %d: sequence title "%s" differes from score title "%s".' - % (i + 1, read_title, quality_title) + sys.exit( + f'Invalid fastqsolexa format at line {i + 1}: sequence title "{read_title}" differes from score title "{quality_title}".' ) if not quality_title: outfile_score.write(f">{read_title}\n") @@ -87,9 +80,8 @@ def __main__(): elif quality_score_length == read_length: quality_score_startswith = default_coding_value else: - stop_err( - "Invalid fastqsolexa format at line %d: the number of quality scores ( %d ) is not the same as bases ( %d )." - % (i + 1, quality_score_length, read_length) + sys.exit( + f"Invalid fastqsolexa format at line {i + 1}: the number of quality scores ( {quality_score_length} ) is not the same as bases ( {read_length} )." ) for char in line: score = ord(char) - quality_score_startswith # 64 diff --git a/lib/galaxy/datatypes/converters/gff_to_bed_converter.py b/lib/galaxy/datatypes/converters/gff_to_bed_converter.py index 379b3f3393ca..a191f7831783 100644 --- a/lib/galaxy/datatypes/converters/gff_to_bed_converter.py +++ b/lib/galaxy/datatypes/converters/gff_to_bed_converter.py @@ -2,8 +2,6 @@ import sys -assert sys.version_info[:2] >= (2, 6) - def __main__(): input_name = sys.argv[1] @@ -35,12 +33,9 @@ def __main__(): skipped_lines += 1 if not first_skipped_line: first_skipped_line = i + 1 - info_msg = "%i lines converted to BED. " % (i + 1 - skipped_lines) + info_msg = f"{i + 1 - skipped_lines} lines converted to BED. " if skipped_lines > 0: - info_msg += "Skipped %d blank/comment/invalid lines starting with line #%d." % ( - skipped_lines, - first_skipped_line, - ) + info_msg += f"Skipped {skipped_lines} blank/comment/invalid lines starting with line #{first_skipped_line}." print(info_msg) diff --git a/lib/galaxy/datatypes/converters/interval_to_bed_converter.py b/lib/galaxy/datatypes/converters/interval_to_bed_converter.py index 647be16fb772..6a87f5dba766 100644 --- a/lib/galaxy/datatypes/converters/interval_to_bed_converter.py +++ b/lib/galaxy/datatypes/converters/interval_to_bed_converter.py @@ -5,12 +5,6 @@ import bx.intervals.io -assert sys.version_info[:2] >= (2, 6) - - -def stop_err(msg): - sys.exit(msg) - def __main__(): output_name = sys.argv[1] @@ -18,19 +12,19 @@ def __main__(): try: chromCol = int(sys.argv[3]) - 1 except Exception: - stop_err( + sys.exit( f"'{str(sys.argv[3])}' is an invalid chrom column, correct the column settings before attempting to convert the data format." ) try: startCol = int(sys.argv[4]) - 1 except Exception: - stop_err( + sys.exit( f"'{str(sys.argv[4])}' is an invalid start column, correct the column settings before attempting to convert the data format." ) try: endCol = int(sys.argv[5]) - 1 except Exception: - stop_err( + sys.exit( f"'{str(sys.argv[5])}' is an invalid end column, correct the column settings before attempting to convert the data format." ) try: @@ -63,16 +57,16 @@ def __main__(): else: raise IndexError except Exception: - name = "region_%i" % count + name = f"region_{count}" try: - out.write("%s\t%i\t%i\t%s\t%i\t%s\n" % (region.chrom, region.start, region.end, name, 0, region.strand)) + out.write(f"{region.chrom}\t{region.start}\t{region.end}\t{name}\t0\t{region.strand}\n") except Exception: skipped_lines += 1 if not first_skipped_line: first_skipped_line = count + 1 - print("%i regions converted to BED." % (count + 1 - skipped_lines)) + print(f"{count + 1 - skipped_lines} regions converted to BED.") if skipped_lines > 0: - print("Skipped %d blank or invalid lines starting with line # %d." % (skipped_lines, first_skipped_line)) + print(f"Skipped {skipped_lines} blank or invalid lines starting with line # {first_skipped_line}.") if __name__ == "__main__": diff --git a/lib/galaxy/datatypes/converters/interval_to_bedstrict_converter.py b/lib/galaxy/datatypes/converters/interval_to_bedstrict_converter.py index 1e343d32ae8b..1c1e8a4a0c04 100644 --- a/lib/galaxy/datatypes/converters/interval_to_bedstrict_converter.py +++ b/lib/galaxy/datatypes/converters/interval_to_bedstrict_converter.py @@ -5,16 +5,10 @@ import bx.intervals.io -assert sys.version_info[:2] >= (2, 6) - -def stop_err(msg): - sys.exit(msg) - - -def force_bed_field_count(fields, region_count, force_num_columns): +def force_bed_field_count(fields, region_count: int, force_num_columns: int): if force_num_columns >= 4 and len(fields) < 4: - fields.append("region_%i" % (region_count)) + fields.append(f"region_{region_count}") if force_num_columns >= 5 and len(fields) < 5: fields.append("0") if force_num_columns >= 6 and len(fields) < 6: @@ -40,19 +34,19 @@ def __main__(): try: chromCol = int(sys.argv[3]) - 1 except Exception: - stop_err( + sys.exit( f"'{str(sys.argv[3])}' is an invalid chrom column, correct the column settings before attempting to convert the data format." ) try: startCol = int(sys.argv[4]) - 1 except Exception: - stop_err( + sys.exit( f"'{str(sys.argv[4])}' is an invalid start column, correct the column settings before attempting to convert the data format." ) try: endCol = int(sys.argv[5]) - 1 except Exception: - stop_err( + sys.exit( f"'{str(sys.argv[5])}' is an invalid end column, correct the column settings before attempting to convert the data format." ) try: @@ -176,7 +170,7 @@ def __main__(): else: raise IndexError except Exception: - name = "region_%i" % count + name = f"region_{count}" try: 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: @@ -186,9 +180,9 @@ def __main__(): skipped_lines += 1 if first_skipped_line is None: first_skipped_line = count + 1 - print("%i regions converted to BED." % (count + 1 - skipped_lines)) + print(f"{count + 1 - skipped_lines} regions converted to BED.") if skipped_lines > 0: - print("Skipped %d blank or invalid lines starting with line # %d." % (skipped_lines, first_skipped_line)) + print(f"Skipped {skipped_lines} blank or invalid lines starting with line # {first_skipped_line}.") if __name__ == "__main__": diff --git a/lib/galaxy/datatypes/converters/interval_to_fli.py b/lib/galaxy/datatypes/converters/interval_to_fli.py index c79dd9799955..78ba26256d32 100644 --- a/lib/galaxy/datatypes/converters/interval_to_fli.py +++ b/lib/galaxy/datatypes/converters/interval_to_fli.py @@ -90,7 +90,7 @@ def main(): entries = [] for name in sorted(name_loc_dict.keys()): loc = name_loc_dict[name] - entry = "{}\t{}\t{}".format(name.lower(), name, "%s:%i-%i" % (loc["contig"], loc["start"], loc["end"])) + entry = "{}\t{}\t{}:{}-{}".format(name.lower(), name, loc["contig"], loc["start"], loc["end"]) if len(entry) > max_len: max_len = len(entry) entries.append(entry) diff --git a/lib/galaxy/datatypes/converters/lped_to_fped_converter.py b/lib/galaxy/datatypes/converters/lped_to_fped_converter.py index e14845292789..ae784d97f1f8 100644 --- a/lib/galaxy/datatypes/converters/lped_to_fped_converter.py +++ b/lib/galaxy/datatypes/converters/lped_to_fped_converter.py @@ -81,7 +81,7 @@ def main(): """ nparm = 3 if len(sys.argv) < nparm: - sys.exit("## %s called with %s - needs %d parameters \n" % (prog, sys.argv, nparm)) + sys.exit(f"## {prog} called with {sys.argv} - needs {nparm} parameters \n") inpedfilepath = sys.argv[1] outhtmlname = sys.argv[2] outfilepath = sys.argv[3] diff --git a/lib/galaxy/datatypes/converters/lped_to_pbed_converter.py b/lib/galaxy/datatypes/converters/lped_to_pbed_converter.py index c9258e22375b..81af7f1c985e 100644 --- a/lib/galaxy/datatypes/converters/lped_to_pbed_converter.py +++ b/lib/galaxy/datatypes/converters/lped_to_pbed_converter.py @@ -85,7 +85,7 @@ def main(): """ nparm = 4 if len(sys.argv) < nparm: - sys.exit("## %s called with %s - needs %d parameters \n" % (prog, sys.argv, nparm)) + sys.exit(f"## {prog} called with {sys.argv} - needs {nparm} parameters \n") inpedfilepath = sys.argv[1] outhtmlname = sys.argv[2] outfilepath = sys.argv[3] diff --git a/lib/galaxy/datatypes/converters/maf_to_fasta_converter.py b/lib/galaxy/datatypes/converters/maf_to_fasta_converter.py index aa7252ba1128..8c8994a6fb3b 100644 --- a/lib/galaxy/datatypes/converters/maf_to_fasta_converter.py +++ b/lib/galaxy/datatypes/converters/maf_to_fasta_converter.py @@ -7,8 +7,6 @@ from galaxy.datatypes.util import maf_utilities -assert sys.version_info[:2] >= (2, 6) - def __main__(): output_name = sys.argv.pop(1) @@ -28,13 +26,13 @@ def __main__(): 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]), + suffix=f"{spec}_{count}_{spec_counts[spec]}", ) ) ) out.write(f"{c.text}\n") out.write("\n") - print("%i MAF blocks converted to FASTA." % (count)) + print(f"{count} MAF blocks converted to FASTA.") if __name__ == "__main__": diff --git a/lib/galaxy/datatypes/converters/maf_to_interval_converter.py b/lib/galaxy/datatypes/converters/maf_to_interval_converter.py index 05c9c4b1a73a..3301cab4843b 100644 --- a/lib/galaxy/datatypes/converters/maf_to_interval_converter.py +++ b/lib/galaxy/datatypes/converters/maf_to_interval_converter.py @@ -7,8 +7,6 @@ from galaxy.datatypes.util import maf_utilities -assert sys.version_info[:2] >= (2, 6) - def __main__(): output_name = sys.argv.pop(1) @@ -24,18 +22,12 @@ def __main__(): for c in maf_utilities.iter_components_by_src_start(block, species): if c is not None: out.write( - "%s\t%i\t%i\t%s\n" - % ( - maf_utilities.src_split(c.src)[-1], - c.get_forward_strand_start(), - c.get_forward_strand_end(), - c.strand, - ) + f"{maf_utilities.src_split(c.src)[-1]}\t{c.get_forward_strand_start()}\t{c.get_forward_strand_end()}\t{c.strand}\n" ) count += 1 except Exception as e: print(f"There was a problem processing your input: {e}", file=sys.stderr) - print("%i MAF blocks converted to Genomic Intervals for species %s." % (count, species)) + print(f"{count} MAF blocks converted to Genomic Intervals for species {species}.") if __name__ == "__main__": diff --git a/lib/galaxy/datatypes/converters/pbed_ldreduced_converter.py b/lib/galaxy/datatypes/converters/pbed_ldreduced_converter.py index cffebc2d8d6c..7698401b05e9 100644 --- a/lib/galaxy/datatypes/converters/pbed_ldreduced_converter.py +++ b/lib/galaxy/datatypes/converters/pbed_ldreduced_converter.py @@ -89,8 +89,7 @@ def main(): """ nparm = 7 if len(sys.argv) < nparm: - sys.stderr.write("## %s called with %s - needs %d parameters \n" % (prog, sys.argv, nparm)) - sys.exit(1) + sys.exit(f"## {prog} called with {sys.argv} - needs {nparm} parameters \n") inpedfilepath = sys.argv[1] base_name = os.path.split(inpedfilepath)[-1] winsize = sys.argv[2] diff --git a/lib/galaxy/datatypes/converters/pbed_to_lped_converter.py b/lib/galaxy/datatypes/converters/pbed_to_lped_converter.py index eee21aa85da7..fd634edf7a4d 100644 --- a/lib/galaxy/datatypes/converters/pbed_to_lped_converter.py +++ b/lib/galaxy/datatypes/converters/pbed_to_lped_converter.py @@ -49,7 +49,7 @@ def main(): """ nparm = 4 if len(sys.argv) < nparm: - sys.exit("PBED to LPED converter called with %s - needs %d parameters \n" % (sys.argv, nparm)) + sys.exit(f"PBED to LPED converter called with {sys.argv} - needs {nparm} parameters \n") inpedfilepath = sys.argv[1] outhtmlname = sys.argv[2] outfilepath = sys.argv[3] diff --git a/lib/galaxy/datatypes/converters/picard_interval_list_to_bed6_converter.py b/lib/galaxy/datatypes/converters/picard_interval_list_to_bed6_converter.py index dde54d6d6adc..8bb0a48add66 100644 --- a/lib/galaxy/datatypes/converters/picard_interval_list_to_bed6_converter.py +++ b/lib/galaxy/datatypes/converters/picard_interval_list_to_bed6_converter.py @@ -33,12 +33,9 @@ def __main__(): skipped_lines += 1 if not first_skipped_line: first_skipped_line = i + 1 - info_msg = "%i lines converted to BED. " % (i + 1 - skipped_lines) + info_msg = f"{i + 1 - skipped_lines} lines converted to BED. " if skipped_lines > 0: - info_msg += "Skipped %d blank/comment/invalid lines starting with line #%d." % ( - skipped_lines, - first_skipped_line, - ) + info_msg += f"Skipped {skipped_lines} blank/comment/invalid lines starting with line #{first_skipped_line}." print(info_msg) diff --git a/lib/galaxy/datatypes/data.py b/lib/galaxy/datatypes/data.py index 1cf74989976a..b51d3768f21d 100644 --- a/lib/galaxy/datatypes/data.py +++ b/lib/galaxy/datatypes/data.py @@ -556,8 +556,7 @@ def display_data( dir_items = sorted(os.listdir(file_path)) base_path, item_name = os.path.split(file_path) tmp_fh.write( - "

Directory %s contents: %d items

\n" - % (escape(item_name), len(dir_items)) + f"

Directory {escape(item_name)} contents: {len(dir_items)} items

\n" ) tmp_fh.write('

\n') for index, fname in enumerate(dir_items): diff --git a/lib/galaxy/datatypes/genetics.py b/lib/galaxy/datatypes/genetics.py index 1ce24261aebf..4921a9d96b5c 100644 --- a/lib/galaxy/datatypes/genetics.py +++ b/lib/galaxy/datatypes/genetics.py @@ -50,7 +50,7 @@ ) from galaxy.util.compression_utils import FileObjType -gal_Log = logging.getLogger(__name__) +log = logging.getLogger(__name__) verbose = False # https://genome.ucsc.edu/goldenpath/help/hgGenomeHelp.html @@ -121,7 +121,7 @@ def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str) -> action="display_at", filename=f"ucsc_{site_name}", ) - display_url = "%s%s/display_as?id=%i&display_app=%s&authz_method=display_at" % ( + display_url = "{}{}/display_as?id={}&display_app={}&authz_method=display_at".format( base_url, app.url_for(controller="root"), dataset.id, @@ -352,23 +352,23 @@ def set_meta(self, dataset: DatasetProtocol, overwrite: bool = True, **kwd) -> N super().set_meta(dataset, overwrite=overwrite, **kwd) if not overwrite: if verbose: - gal_Log.debug("@@@ rgenetics set_meta called with overwrite = False") + log.debug("@@@ rgenetics set_meta called with overwrite = False") return try: efp = dataset.extra_files_path except Exception: if verbose: - gal_Log.debug(f"@@@rgenetics set_meta failed {sys.exc_info()[0]} - dataset {dataset.name} has no efp ?") + log.debug(f"@@@rgenetics set_meta failed {sys.exc_info()[0]} - dataset {dataset.name} has no efp ?") return try: flist = os.listdir(efp) except Exception: if verbose: - gal_Log.debug(f"@@@rgenetics set_meta failed {sys.exc_info()[0]} - dataset {dataset.name} has no efp ?") + log.debug(f"@@@rgenetics set_meta failed {sys.exc_info()[0]} - dataset {dataset.name} has no efp ?") return if len(flist) == 0: if verbose: - gal_Log.debug(f"@@@rgenetics set_meta failed - {dataset.name} efp {efp} is empty?") + log.debug(f"@@@rgenetics set_meta failed - {dataset.name} efp {efp} is empty?") return self.regenerate_primary_file(dataset) if not dataset.info: @@ -693,9 +693,12 @@ def get_phecols(self, phenolist: List, maxConc: int = 20) -> List: else: for col, code in enumerate(row): # keep column order correct if col >= totcols: - gal_Log.warning( - "### get_phecols error in pheno file - row %d col %d (%s) longer than header %s" - % (nrows, col, row, head) + log.warning( + "### get_phecols error in pheno file - row %d col %d (%s) longer than header %s", + nrows, + col, + row, + head, ) else: concordance[col].setdefault(code, 0) # first one is zero @@ -848,7 +851,7 @@ def set_meta(self, dataset: DatasetProtocol, overwrite: bool = True, **kwd) -> N flist = os.listdir(dataset.extra_files_path) except Exception: if verbose: - gal_Log.debug("@@@rexpression set_meta failed - no dataset?") + log.debug("@@@rexpression set_meta failed - no dataset?") return bn = dataset.metadata.base_name if not bn: diff --git a/lib/galaxy/dependencies/pinned-lint-requirements.txt b/lib/galaxy/dependencies/pinned-lint-requirements.txt index f0afdffeb3c3..ce3ea021982c 100644 --- a/lib/galaxy/dependencies/pinned-lint-requirements.txt +++ b/lib/galaxy/dependencies/pinned-lint-requirements.txt @@ -4,4 +4,4 @@ flake8-bugbear==24.10.31 mccabe==0.7.0 pycodestyle==2.12.1 pyflakes==3.2.0 -ruff==0.7.4 +ruff==0.8.2