mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-28 10:54:20 +01:00
refactor: adjust structure
This commit is contained in:
0
src/utils/__init__.py
Normal file
0
src/utils/__init__.py
Normal file
8
src/utils/io.py
Normal file
8
src/utils/io.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
def recreate_folder(folder_path):
|
||||
if os.path.exists(folder_path) and os.path.isdir(folder_path):
|
||||
shutil.rmtree(folder_path)
|
||||
os.makedirs(folder_path)
|
||||
11
src/utils/string.py
Normal file
11
src/utils/string.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def find_between(input_string, start, end):
|
||||
try:
|
||||
start_index = input_string.index(start) + len(start)
|
||||
end_index = input_string.index(end, start_index)
|
||||
return input_string[start_index:end_index]
|
||||
except ValueError:
|
||||
raise ValueError(f'Could not find {start} and {end} in {input_string}')
|
||||
|
||||
|
||||
def clean_content(content):
|
||||
return content.replace('```', '').strip()
|
||||
Reference in New Issue
Block a user