/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
contrib/python/prompt-toolkit/py2/prompt_toolkit/eventloop/utils.py
23 строки
497 B
wilytiger
support building opensource nbs with ya make
09 окт 2023, 17:33
09 окт 2023, 17:33
759d542
Код
Авторство
О чём код?
from __future__ import unicode_literals import time __all__ = ( 'TimeIt', ) class TimeIt(object): """ Context manager that times the duration of the code body. The `duration` attribute will contain the execution time in seconds. """ def __init__(self): self.duration = None def __enter__(self): self.start = time.time() return self def __exit__(self, *args): self.end = time.time() self.duration = self.end - self.start