Skip to content

Commit

Permalink
Change return type of Live's contextmanager to Self
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick91 authored Aug 20, 2024
1 parent e1e6d74 commit 46969ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rich/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
from types import TracebackType
from typing import IO, Any, Callable, List, Optional, TextIO, Type, cast

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self # pragma: no cover


from . import get_console
from .console import Console, ConsoleRenderable, RenderableType, RenderHook
from .control import Control
Expand Down Expand Up @@ -162,7 +168,7 @@ def stop(self) -> None:
if self.ipy_widget is not None and self.transient:
self.ipy_widget.close() # pragma: no cover

def __enter__(self) -> "Live":
def __enter__(self) -> Self:
self.start(refresh=self._renderable is not None)
return self

Expand Down

0 comments on commit 46969ed

Please sign in to comment.