Skip to content

Commit b0661de

Browse files
authored
Merge pull request #3078 from A-kirami/fix/progress-type
Fix the return type of `Progress.__enter__`
2 parents d5dcc74 + 096fb21 commit b0661de

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
1011
### Changed
1112

1213
- Rich will display tracebacks with finely grained error locations on python 3.11+ https://github.com/Textualize/rich/pull/3486

rich/progress.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
else:
4040
from typing_extensions import Literal # pragma: no cover
4141

42+
if sys.version_info >= (3, 11):
43+
from typing import Self
44+
else:
45+
from typing_extensions import Self # pragma: no cover
46+
4247
from . import filesize, get_console
4348
from .console import Console, Group, JustifyMethod, RenderableType
4449
from .highlighter import Highlighter
@@ -1170,7 +1175,7 @@ def stop(self) -> None:
11701175
if not self.console.is_interactive and not self.console.is_jupyter:
11711176
self.console.print()
11721177

1173-
def __enter__(self) -> "Progress":
1178+
def __enter__(self) -> Self:
11741179
self.start()
11751180
return self
11761181

0 commit comments

Comments
 (0)