From 476184c1bad69012b785b486130cd05161a0fe80 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Sat, 2 Sep 2023 20:37:22 +0200 Subject: [PATCH] upgraded lollms --- lollms/utilities.py | 16 ++++++++++++++++ setup.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lollms/utilities.py b/lollms/utilities.py index 5494c1f..d40b8b9 100644 --- a/lollms/utilities.py +++ b/lollms/utilities.py @@ -779,3 +779,19 @@ class LOLLMSLocalizer: return localized_string +class File_Path_Generator: + @staticmethod + def generate_unique_file_path(folder_path, file_base_name, file_extension): + folder_path = Path(folder_path) + index = 0 + while True: + # Construct the full file path with the current index + file_name = f"{file_base_name}_{index}.{file_extension}" + full_file_path = folder_path / file_name + + # Check if the file already exists in the folder + if not full_file_path.exists(): + return full_file_path + + # If the file exists, increment the index and try again + index += 1 \ No newline at end of file diff --git a/setup.py b/setup.py index 1e1de5a..efcf8d7 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def get_all_files(path): setuptools.setup( name="lollms", - version="5.0.2", + version="5.1.0", author="Saifeddine ALOUI", author_email="aloui.saifeddine@gmail.com", description="A python library for AI personality definition",