Skip to content

Commit 2bb113e

Browse files
committed
fix(py/samples): use pathlib consistently for path manipulation
Replace mixed os.path.join/pathlib.Path usage with pure pathlib operators for better readability and modern Python practices.
1 parent 945032c commit 2bb113e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

py/samples/evaluator-demo/evaluator_demo/eval_in_code.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@
1515
"""Evaluation in code sample."""
1616

1717
import json
18-
import os
1918
import pathlib
2019

2120
from evaluator_demo.genkit_demo import ai
2221
from genkit.core.typing import EvalResponse
2322

2423
# Load dataset
25-
DATA_PATH = os.path.join(pathlib.Path(__file__).parent, '..', 'data', 'dogfacts.json')
26-
if pathlib.Path(DATA_PATH).exists():
27-
with pathlib.Path(DATA_PATH).open() as f:
24+
DATA_PATH = pathlib.Path(__file__).parent.parent / 'data' / 'dogfacts.json'
25+
if DATA_PATH.exists():
26+
with DATA_PATH.open() as f:
2827
DOG_DATASET = json.load(f)
2928
else:
3029
DOG_DATASET = []

0 commit comments

Comments
 (0)