Skip to content

Commit

Permalink
Merge pull request #186 from apriha/hotfix/fix-formatting
Browse files Browse the repository at this point in the history
Ruff format fix
  • Loading branch information
apriha authored Jan 19, 2025
2 parents a47f1d4 + c17508d commit 489de97
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion analysis/parse-opensnp-files/parse_opensnp_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions analysis/xy-chrom-snp-ratios/xy-chrom-snp-ratios.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/snps/io/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down Expand Up @@ -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}"',
]
Expand Down
2 changes: 1 addition & 1 deletion src/snps/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
2 changes: 1 addition & 1 deletion tests/io/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions versioneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 489de97

Please sign in to comment.