Skip to content

Commit ae4a70c

Browse files
committed
Fix the return type of Progress.__enter__
1 parent 720800e commit ae4a70c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
10+
### Fixed
11+
12+
- Fix the return type of `Progress.__enter__`
13+
814
## [13.5.2] - 2023-08-01
915

1016
### Fixed

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
@@ -1164,7 +1169,7 @@ def stop(self) -> None:
11641169
if not self.console.is_interactive:
11651170
self.console.print()
11661171

1167-
def __enter__(self) -> "Progress":
1172+
def __enter__(self) -> Self:
11681173
self.start()
11691174
return self
11701175

0 commit comments

Comments
 (0)