Spaces:
Sleeping
Sleeping
made a function that will create a directory
Browse files
innovation_pathfinder_ai/utils/utils.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import hashlib
|
2 |
import datetime
|
|
|
3 |
|
4 |
from innovation_pathfinder_ai.utils import logger
|
5 |
|
@@ -168,4 +169,17 @@ def hash_text(text: str) -> str:
|
|
168 |
|
169 |
|
170 |
def convert_timestamp_to_datetime(timestamp: str) -> str:
|
171 |
-
return datetime.datetime.fromtimestamp(int(timestamp)).strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import hashlib
|
2 |
import datetime
|
3 |
+
import os
|
4 |
|
5 |
from innovation_pathfinder_ai.utils import logger
|
6 |
|
|
|
169 |
|
170 |
|
171 |
def convert_timestamp_to_datetime(timestamp: str) -> str:
|
172 |
+
return datetime.datetime.fromtimestamp(int(timestamp)).strftime("%Y-%m-%d %H:%M:%S")
|
173 |
+
|
174 |
+
def create_folder_if_not_exists(folder_path: str) -> None:
|
175 |
+
"""
|
176 |
+
Create a folder if it doesn't already exist.
|
177 |
+
|
178 |
+
Args:
|
179 |
+
- folder_path (str): The path of the folder to create.
|
180 |
+
"""
|
181 |
+
if not os.path.exists(folder_path):
|
182 |
+
os.makedirs(folder_path)
|
183 |
+
print(f"Folder '{folder_path}' created.")
|
184 |
+
else:
|
185 |
+
print(f"Folder '{folder_path}' already exists.")
|