-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathpath_util.py
68 lines (55 loc) · 2.03 KB
/
path_util.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import os
from pathlib import Path
ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) # This is your Project Root
ROOT_DIR = str(Path(ROOT_DIR) / "..")
DATA_DIR = str(Path(ROOT_DIR) / "data") # This is the data of this project
OUTPUT_DIR = str(Path(ROOT_DIR) / "output") # This is the output of this project
LOGS_DIR = str(Path(ROOT_DIR) / "log")
class PathUtil:
@staticmethod
def orig_data_dir():
path = Path(DATA_DIR)
path.mkdir(parents=True, exist_ok=True)
return str(path)
@staticmethod
def model_output_data(filename: str, ext: str):
path = Path(OUTPUT_DIR)/'model_output'
path.mkdir(parents=True, exist_ok=True)
path = path / f'{filename}.{ext}'
return str(path)
@staticmethod
def log_output_data(filename: str, ext: str):
path = Path(LOGS_DIR)
path.mkdir(parents=True, exist_ok=True)
path = path / f'{filename}.{ext}'
return str(path)
@staticmethod
def test_result_data(filename: str, ext: str):
path = Path(OUTPUT_DIR)/'result'
path.mkdir(parents=True, exist_ok=True)
path = path / f'{filename}.{ext}'
return str(path)
@staticmethod
def eval_data(dataset_name: str):
path = Path(DATA_DIR)/f'{dataset_name}.json'
return str(path)
@staticmethod
def benchmark_code_data(filename: str, ext: str):
path = Path(DATA_DIR)/'benchmark_solution_code'
path.mkdir(parents=True, exist_ok=True)
path = path / f'{filename}.{ext}'
return str(path)
@staticmethod
def benchmark_code_file():
path = Path(DATA_DIR) / 'benchmark_solution_code'
return str(path)
@staticmethod
def benchmark_test_file():
path = Path(DATA_DIR) / 'benchmark_test_code'
return str(path)
@staticmethod
def benchmark_test_data(filename: str, ext: str):
path = Path(DATA_DIR)/'benchmark_test_code'
path.mkdir(parents=True, exist_ok=True)
path = path / f'{filename}.{ext}'
return str(path)