mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-20 07:04:20 +01:00
⏪ fix: fix bring back the test description for func generation
This commit is contained in:
@@ -25,4 +25,27 @@ class ConversationLogger:
|
||||
f.write(json.dumps(self.log_file, indent=2))
|
||||
|
||||
|
||||
import datetime
|
||||
|
||||
class Singleton(type):
|
||||
_instances = {}
|
||||
|
||||
def __call__(cls, *args, **kwargs):
|
||||
if cls not in cls._instances:
|
||||
cls._instances[cls] = super().__call__(*args, **kwargs)
|
||||
return cls._instances[cls]
|
||||
|
||||
class Timer(metaclass=Singleton):
|
||||
def __init__(self):
|
||||
if not hasattr(self, "start_time"):
|
||||
self.start_time = datetime.datetime.now()
|
||||
|
||||
def get_time_since_start(self):
|
||||
now = datetime.datetime.now()
|
||||
time_diff = now - self.start_time
|
||||
minutes, seconds = divmod(time_diff.seconds, 60)
|
||||
|
||||
if minutes > 0:
|
||||
return f"{minutes}m, {seconds}s"
|
||||
else:
|
||||
return f"{seconds}s"
|
||||
|
||||
Reference in New Issue
Block a user