8000 Tweaks in response to Jelle's comments · python/typeshed@a654461 · GitHub
[go: up one dir, main page]

Skip to content

Commit a654461

Browse files
committed
Tweaks in response to Jelle's comments
1 parent c37b41a commit a654461

File tree

2 files changed

+6
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ _V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers.
6262
_KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers.
6363
_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers.
6464
_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant.
65+
_TC = TypeVar('_TC', bound=Type[object])
6566

66-
def runtime(cls: _T) -> _T: ...
67+
def runtime(cls: _TC) -> _TC: ...
6768

6869
@runtime
6970
class SupportsInt(Protocol, metaclass=ABCMeta):
@@ -232,7 +233,7 @@ class ContextManager(Protocol[_T_co]):
232233
exc_value: Optional[BaseException],
233234
traceback: Optional[TracebackType]) -> Optional[bool]: ...
234235

235-
@runtime # type: ignore
236+
@runtime
236237
class Mapping(Iterable[_KT], Container[_KT], Sized, Protocol[_KT, _VT_co]):
237238
# TODO: We wish the key type could also be covariant, but that doesn't work,
238239
# see discussion in https: //github.com/python/typing/pull/273.
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ _V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers.
6565
_KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers.
6666
_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers.
6767
_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant.
68+
_TC = TypeVar('_TC', bound=Type[object])
6869

69-
def runtime(cls: _T) -> _T: ...
70+
def runtime(cls: _TC) -> _TC: ...
7071

7172
@runtime
7273
class SupportsInt(Protocol, metaclass=ABCMeta):
@@ -326,7 +327,7 @@ if sys.version_info >= (3, 5):
326327
exc_value: Optional[BaseException],
327328
traceback: Optional[TracebackType]) -> Awaitable[Optional[bool]]: ...
328329

329-
@runtime # type: ignore
330+
@runtime
330331
class Mapping(_Collection[_KT], Protocol[_KT, _VT_co]):
331332
# TODO: We wish the key type could also be covariant, but that doesn't work,
332333
# see discussion in https: //github.com/python/typing/pull/273.