Closed tkmktime closed 5 years ago
To prevent assert exception for some blank or comment cell, how do you think below code.
class LineWatcher(object):
"""Class that implements a basic timer. Notes ----- * Register the `start` and `stop` methods with the IPython events API. """ def __init__(self): self.start_time = 0.0 def start(self): self.start_time = time.time() def stop(self): if self.start_time: diff = time.time() - self.start_time assert diff >= 0 # FIXED from assert diff > 0 print('time: %s' % format_delta(diff))
timer = LineWatcher()
Fixed by a9c7cab
To prevent assert exception for some blank or comment cell, how do you think below code.
class LineWatcher(object):
timer = LineWatcher()