Skip to content

Commit 263a878

Browse files
committed
fix: update PR remplate and tighten file opening
1 parent abe3c8b commit 263a878

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222

2323
- [ ] Have you created a <NewThresholder>.py in ~/pythresh/thresholds/?
2424
- [ ] Have you created a <NewThresholder>\_example.py in ~/examples/?
25-
- [ ] Have you created a test\_<NewThresholder>.py in ~/pythresh/test/?
25+
- [ ] Have you created a test\_<NewThresholder>.py in ~/tests/?
2626
- [ ] Have you lint your code locally prior to submission?
2727
- [ ] Have you added a reference of the new thresholder in your explanation?

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
args: [--fix=lf]
1515

1616
- repo: https://github.com/charliermarsh/ruff-pre-commit
17-
rev: v0.15.13
17+
rev: v0.15.15
1818
hooks:
1919
- id: ruff
2020
name: Fix code

pythresh/models/__init__.py

Whitespace-only changes.

pythresh/thresholds/meta.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from importlib.resources import files
1+
from importlib.resources import as_file, files
22

33
import joblib
44
import numpy as np
@@ -109,8 +109,8 @@ def eval(self, decision):
109109

110110
contam = []
111111
counts = len(decision)
112-
model_path = files("pythresh.models").joinpath(clf)
113-
model = joblib.load(model_path)
112+
with as_file(files("pythresh.models").joinpath(clf)) as model_path:
113+
model = joblib.load(model_path)
114114

115115
# Sklearn 1.8.0 API patch
116116
for e in getattr(model, "estimators_", {}).values():

pythresh/utils/rank.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from importlib.resources import files
1+
from importlib.resources import as_file, files
22

33
import numpy as np
44
import scipy.stats as stats
@@ -174,9 +174,9 @@ def eval(self, X):
174174
if self.method == "model":
175175
# Load trained ranking model
176176
clf = "rank_model_XGB.json"
177-
model_path = files("pythresh.models").joinpath(clf)
178177
ranker = xgb.XGBRanker()
179-
ranker.load_model(model_path)
178+
with as_file(files("pythresh.models").joinpath(clf)) as model_path:
179+
ranker.load_model(model_path)
180180

181181
# Transform data
182182
scaler = MinMaxScaler()

0 commit comments

Comments
 (0)