Apr-01-2020, 10:39 PM
Here is my code:
I want it to resolve the object at runtime instead of compile time, is there any way to do this?
total_runtime = None
mail_pfx = "dVDS FULL5 CN"
mail_subj = {
'completed' : f"{mail_pfx} : [INFO] Refresh completed successfully in: {total_runtime}.",
'warnissues' : f"{mail_pfx} : [ALERT] Refresh completed with issues in: {total_runtime}"
}
class Stopwatch():
def __init__(self):
self.tick = 0
self.tock = 0
self.time = 0
def start(self):
self.tick = time.perf_counter()
def stop(self):
self.tock = time.perf_counter()
self.time = timedelta(seconds=math.ceil(self.tock-self.tick))
def __str__(self):
return str(self.time)
total_runtime = Stopwatch()
total_runtime.start()
total_runtime.stop()
print(mail_subj['warnissues'])This is printing "dVDS FULL5 CN : [ALERT] Refresh completed with issues in: None"I want it to resolve the object at runtime instead of compile time, is there any way to do this?
