Skip to content

Commit 3118c0a

Browse files
committed
style: apply pre-commit (ruff/ruff-format) fixes
1 parent 5d0e8b8 commit 3118c0a

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

malariagen_data/anoph/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ def _read_sample_sets_manifest(self, *, single_release: str):
609609
# Add an "unrestricted_use" column, set to True if terms-of-use expiry date <= today's date.
610610
# Vectorized operation: True if NaN, else (d <= today_date_iso)
611611
s = df[terms_of_use_expiry_date_column]
612-
df["unrestricted_use"] = (s.isna() | (s <= today_date_iso))
612+
df["unrestricted_use"] = s.isna() | (s <= today_date_iso)
613613
# Make the "unrestricted_use" column a nullable boolean, to allow missing data.
614614
df["unrestricted_use"] = df["unrestricted_use"].astype(pd.BooleanDtype())
615615

malariagen_data/anoph/frq_base.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import re
21
from textwrap import dedent
32
from typing import Optional, Union, List
43

@@ -113,7 +112,7 @@ def _build_cohorts_from_sample_grouping(
113112
df_cohorts["period_end"] = period.map(
114113
lambda v: v.end_time if pd.notna(v) else pd.NaT
115114
)
116-
115+
117116
# Create a label that is similar to the cohort metadata,
118117
# although this won't be perfect.
119118
# Vectorized string operations
@@ -126,7 +125,11 @@ def _build_cohorts_from_sample_grouping(
126125
else:
127126
# Non-default case: replace non-alphanumeric characters with underscores
128127
area_str = df_cohorts["area"].astype(str)
129-
taxon_clean = df_cohorts[taxon_by].astype(str).str.replace(r"[^A-Za-z0-9]+", "_", regex=True)
128+
taxon_clean = (
129+
df_cohorts[taxon_by]
130+
.astype(str)
131+
.str.replace(r"[^A-Za-z0-9]+", "_", regex=True)
132+
)
130133
period_str = df_cohorts["period"].astype(str)
131134
df_cohorts["label"] = area_str + "_" + taxon_clean + "_" + period_str
132135

malariagen_data/anoph/sample_metadata.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,7 @@ def _parse_general_metadata(
182182

183183
# Derive a quarter column from month.
184184
# Vectorized operation: quarter = ((month - 1) // 3) + 1 if month > 0 else -1
185-
df["quarter"] = np.where(
186-
df["month"] > 0, ((df["month"] - 1) // 3) + 1, -1
187-
)
185+
df["quarter"] = np.where(df["month"] > 0, ((df["month"] - 1) // 3) + 1, -1)
188186

189187
# Add study columns.
190188
study_info = self.lookup_study_info(sample_set=sample_set)

0 commit comments

Comments
 (0)