Skip to content

Commit 6d7d02c

Browse files
committed
Better return type annotation
1 parent dc65cd0 commit 6d7d02c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/pypi_simple/progress.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
from collections.abc import Callable
33
import sys
44
from types import TracebackType
5-
from typing import Any, Optional, TypeVar
5+
from typing import TYPE_CHECKING, Any, Optional
66

77
if sys.version_info[:2] >= (3, 8):
88
from typing import Protocol, runtime_checkable
99
else:
1010
from typing_extensions import Protocol, runtime_checkable
1111

12-
13-
T = TypeVar("T", bound="ProgressTracker")
12+
if TYPE_CHECKING:
13+
from typing_extensions import Self
1414

1515

1616
@runtime_checkable
@@ -23,7 +23,7 @@ class ProgressTracker(Protocol):
2323
that will be called with the size of each downloaded file chunk.
2424
"""
2525

26-
def __enter__(self: T) -> T:
26+
def __enter__(self) -> Self:
2727
...
2828

2929
def __exit__(

0 commit comments

Comments
 (0)