From c17508d515d1b3a0617f35bd82b2c4dbd08828f4 Mon Sep 17 00:00:00 2001 From: Andrew Riha Date: Sat, 18 Jan 2025 21:47:51 -0800 Subject: [PATCH] Ruff format fix --- analysis/parse-opensnp-files/parse_opensnp_files.py | 2 +- analysis/xy-chrom-snp-ratios/xy-chrom-snp-ratios.py | 4 ++-- src/snps/io/writer.py | 4 ++-- src/snps/utils.py | 2 +- tests/io/test_reader.py | 2 +- tests/test_resources.py | 4 ++-- versioneer.py | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/analysis/parse-opensnp-files/parse_opensnp_files.py b/analysis/parse-opensnp-files/parse_opensnp_files.py index 49336e6..7a55112 100644 --- a/analysis/parse-opensnp-files/parse_opensnp_files.py +++ b/analysis/parse-opensnp-files/parse_opensnp_files.py @@ -29,7 +29,7 @@ # setup logger to output to file in output directory logging.basicConfig( - filename=f'{os.path.join(OUTPUT_DIR, "parse-opensnp-files.txt")}', + filename=f"{os.path.join(OUTPUT_DIR, 'parse-opensnp-files.txt')}", format="%(asctime)s: %(message)s", filemode="w", level=logging.INFO, diff --git a/analysis/xy-chrom-snp-ratios/xy-chrom-snp-ratios.py b/analysis/xy-chrom-snp-ratios/xy-chrom-snp-ratios.py index 5df5aea..67a1758 100644 --- a/analysis/xy-chrom-snp-ratios/xy-chrom-snp-ratios.py +++ b/analysis/xy-chrom-snp-ratios/xy-chrom-snp-ratios.py @@ -185,7 +185,7 @@ def create_analysis_plot( va="top", ) ax_scatter.annotate( - f"n={ len(df_ratios.loc[(df_ratios.heterozygous_x_snps_ratio < heterozygous_x_snps_threshold)& (df_ratios.y_snps_not_null_ratio >= y_snps_not_null_threshold)])}", + f"n={len(df_ratios.loc[(df_ratios.heterozygous_x_snps_ratio < heterozygous_x_snps_threshold) & (df_ratios.y_snps_not_null_ratio >= y_snps_not_null_threshold)])}", ( heterozygous_x_snps_threshold - x_offset, y_snps_not_null_threshold + y_offset, @@ -194,7 +194,7 @@ def create_analysis_plot( va="bottom", ) ax_scatter.annotate( - f"n={len(df_ratios.loc[ (df_ratios.heterozygous_x_snps_ratio >= heterozygous_x_snps_threshold) & (df_ratios.y_snps_not_null_ratio >= y_snps_not_null_threshold)])}", + f"n={len(df_ratios.loc[(df_ratios.heterozygous_x_snps_ratio >= heterozygous_x_snps_threshold) & (df_ratios.y_snps_not_null_ratio >= y_snps_not_null_threshold)])}", ( heterozygous_x_snps_threshold + x_offset, y_snps_not_null_threshold + y_offset, diff --git a/src/snps/io/writer.py b/src/snps/io/writer.py index d16b85f..d2865ee 100644 --- a/src/snps/io/writer.py +++ b/src/snps/io/writer.py @@ -124,7 +124,7 @@ def _write_csv(self): comment = [ f"# Source(s): {self._snps.source}", f"# Build: {self._snps.build}", - f"# Build Detected: { self._snps.build_detected}", + f"# Build Detected: {self._snps.build_detected}", f"# Phased: {self._snps.phased}", f"# SNPs: {self._snps.count}", f"# Chromosomes: {self._snps.chromosomes_summary}", @@ -166,7 +166,7 @@ def _write_vcf(self): comment = [ "##fileformat=VCFv4.3", - f'##fileDate={get_utc_now().strftime("%Y%m%d")}', + f"##fileDate={get_utc_now().strftime('%Y%m%d')}", f'##source="snps v{snps.__version__}; https://pypi.org/project/snps/"', f'##detectedCompany="{self._snps.source}"', ] diff --git a/src/snps/utils.py b/src/snps/utils.py index 4ca2b97..1f5f32a 100644 --- a/src/snps/utils.py +++ b/src/snps/utils.py @@ -147,7 +147,7 @@ def save_df_as_csv( if prepend_info: s = ( f"# Generated by snps v{snps.__version__}, https://pypi.org/project/snps/\n" - f'# Generated at {get_utc_now().strftime("%Y-%m-%d %H:%M:%S")} UTC\n' + f"# Generated at {get_utc_now().strftime('%Y-%m-%d %H:%M:%S')} UTC\n" ) else: s = "" diff --git a/tests/io/test_reader.py b/tests/io/test_reader.py index 0dc6bee..34b7a11 100644 --- a/tests/io/test_reader.py +++ b/tests/io/test_reader.py @@ -174,7 +174,7 @@ def test_read_ftdna_concat_gzip_extra_data(self): # generate content of second file s2 = "RSID,CHROMOSOME,POSITION,RESULT\r\n" for i in range(0, total_snps2): - s2 += f'"rs{total_snps1 + 1 + i}","1","{ total_snps1 + 101 + i}","AA"\r\n' + s2 += f'"rs{total_snps1 + 1 + i}","1","{total_snps1 + 101 + i}","AA"\r\n' snps_df = self.create_snp_df( rsid=[f"rs{1 + i}" for i in range(0, total_snps1 + total_snps2)], chrom="1", diff --git a/tests/test_resources.py b/tests/test_resources.py index 34d8809..9ebecaf 100644 --- a/tests/test_resources.py +++ b/tests/test_resources.py @@ -184,7 +184,7 @@ def f(): self.assertEqual( seqs["MT"].path, os.path.relpath( - f'{os.path.join(self.resource._resources_dir,"fasta", assembly_expect,os.path.basename(url_expect))}' + f"{os.path.join(self.resource._resources_dir, 'fasta', assembly_expect, os.path.basename(url_expect))}" ), ) self.assertTrue(os.path.exists(seqs["MT"].path)) @@ -261,7 +261,7 @@ def f(): self.assertEqual( seqs["MT"].path, os.path.relpath( - f'{os.path.join(self.resource._resources_dir,"fasta", "GRCh37","Homo_sapiens.GRCh37.dna.chromosome.MT.fa.gz")}' + f"{os.path.join(self.resource._resources_dir, 'fasta', 'GRCh37', 'Homo_sapiens.GRCh37.dna.chromosome.MT.fa.gz')}" ), ) self.assertTrue(os.path.exists(seqs["MT"].path)) diff --git a/versioneer.py b/versioneer.py index 0d87ee5..9a89946 100644 --- a/versioneer.py +++ b/versioneer.py @@ -1837,9 +1837,9 @@ def get_versions(verbose: bool = False) -> Dict[str, Any]: handlers = HANDLERS.get(cfg.VCS) assert handlers, "unrecognized VCS '%s'" % cfg.VCS verbose = verbose or bool(cfg.verbose) # `bool()` used to avoid `None` - assert ( - cfg.versionfile_source is not None - ), "please set versioneer.versionfile_source" + assert cfg.versionfile_source is not None, ( + "please set versioneer.versionfile_source" + ) assert cfg.tag_prefix is not None, "please set versioneer.tag_prefix" versionfile_abs = os.path.join(root, cfg.versionfile_source)