mirror of
https://github.com/OMGeeky/gpt-pilot.git
synced 2026-01-19 08:44:46 +01:00
Implemented final version of IPC communication
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
# utils/utils.py
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import platform
|
||||
import uuid
|
||||
import distro
|
||||
import json
|
||||
import hashlib
|
||||
@@ -167,3 +169,12 @@ def clean_filename(filename):
|
||||
cleaned_filename = re.sub(r'\s', '_', cleaned_filename)
|
||||
|
||||
return cleaned_filename
|
||||
|
||||
def json_serial(obj):
|
||||
"""JSON serializer for objects not serializable by default json code"""
|
||||
if isinstance(obj, (datetime.datetime, datetime.date)):
|
||||
return obj.isoformat()
|
||||
elif isinstance(obj, uuid.UUID):
|
||||
return str(obj)
|
||||
else:
|
||||
return str(obj)
|
||||
Reference in New Issue
Block a user