forked from eval-protocol/python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdirectory_utils.py
More file actions
39 lines (28 loc) · 1.07 KB
/
Copy pathdirectory_utils.py
File metadata and controls
39 lines (28 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
from typing import Optional
# Shared constants for directory discovery
EVAL_PROTOCOL_DIR = ".eval_protocol"
PYTHON_FILES = ["pyproject.toml", "requirements.txt"]
DATASETS_DIR = "datasets"
def find_eval_protocol_dir() -> str:
"""
Find the .eval_protocol directory in the user's home folder.
Returns:
Path to the .eval_protocol directory in the user's home folder
"""
# Always use the home folder for .eval_protocol directory
log_dir = os.path.expanduser(os.path.join("~", EVAL_PROTOCOL_DIR))
# create the .eval_protocol directory if it doesn't exist
os.makedirs(log_dir, exist_ok=True)
return log_dir
def find_eval_protocol_datasets_dir() -> str:
"""
Find the .eval_protocol/datasets directory in the user's home folder.
Returns:
Path to the .eval_protocol/datasets directory in the user's home folder
"""
log_dir = find_eval_protocol_dir()
# create the datasets subdirectory
datasets_dir = os.path.join(log_dir, DATASETS_DIR)
os.makedirs(datasets_dir, exist_ok=True)
return datasets_dir