mirror of https://github.com/Textualize/rich.git
update timer to generator
This commit is contained in:
parent
fb4217acb1
commit
05843f6f69
|
@ -6,11 +6,11 @@ Timer context manager, only used in debug.
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
from typing import Iterator
|
from typing import Generator
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def timer(subject: str = "time") -> Iterator[None]:
|
def timer(subject: str = "time") -> Generator[None, None, None]:
|
||||||
"""print the elapsed time. (only used in debugging)"""
|
"""print the elapsed time. (only used in debugging)"""
|
||||||
start = time()
|
start = time()
|
||||||
yield
|
yield
|
||||||
|
|
Loading…
Reference in New Issue