mirror of
https://github.com/OMGeeky/gpt-pilot.git
synced 2026-01-21 09:41:07 +01:00
delete all development steps if project continued from step before 'coding'
This commit is contained in:
@@ -135,6 +135,7 @@ def hash_data(data):
|
||||
serialized_data = json.dumps(replace_functions(data), sort_keys=True).encode('utf-8')
|
||||
return hashlib.sha256(serialized_data).hexdigest()
|
||||
|
||||
|
||||
def replace_functions(obj):
|
||||
if isinstance(obj, dict):
|
||||
return {k: replace_functions(v) for k, v in obj.items()}
|
||||
@@ -145,12 +146,14 @@ def replace_functions(obj):
|
||||
else:
|
||||
return obj
|
||||
|
||||
|
||||
def fix_json(s):
|
||||
s = s.replace('True', 'true')
|
||||
s = s.replace('False', 'false')
|
||||
# s = s.replace('`', '"')
|
||||
return fix_json_newlines(s)
|
||||
|
||||
|
||||
def fix_json_newlines(s):
|
||||
pattern = r'("(?:\\\\n|\\.|[^"\\])*")'
|
||||
|
||||
@@ -159,6 +162,7 @@ def fix_json_newlines(s):
|
||||
|
||||
return re.sub(pattern, replace_newlines, s)
|
||||
|
||||
|
||||
def clean_filename(filename):
|
||||
# Remove invalid characters
|
||||
cleaned_filename = re.sub(r'[<>:"/\\|?*]', '', filename)
|
||||
|
||||
Reference in New Issue
Block a user