-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPathConfig.py
More file actions
executable file
·32 lines (25 loc) · 1.12 KB
/
PathConfig.py
File metadata and controls
executable file
·32 lines (25 loc) · 1.12 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
from os import path
class FilePaths:
def __init__(self) -> None:
self.base_dir: str = path.dirname(__file__)
self._paths: dict[str, str] = {
"NutriEngine": self.base_dir,
"UsersData.json": path.join(self.base_dir, "Data", "UsersData.json"),
"LogsData.json": path.join(self.base_dir, "Data", "LogsData.json"),
"TestData.json": path.join(self.base_dir, "Data", "TestData", "TestData.json")
}
def get_path(self, file_name: str) -> str:
return self._paths.get(file_name, "")
def get_paths(self) -> dict[str, str]:
return self._paths
class CheckerPaths(FilePaths):
def check_path(self, file_name: str) -> bool:
return path.exists(self.get_path(file_name))
def check_paths(self) -> dict[str, dict[str, bool | str]]:
directory_info: dict[str, dict[str, bool | str]] = {}
for file, file_path in self._paths.items():
directory_info[file] = {
"path": file_path,
"found": path.exists(file_path)
}
return directory_info