Skip to content

Commit 1ea3d2d

Browse files
authored
Make all single-constraint TypeVars use bound= insteads (plus hack) (#1118)
Another attempt for #804, to unblock python/mypy#2626. There's a work-around here for python/mypy#1551.
1 parent 7c413c9 commit 1ea3d2d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

stdlib/2and3/plistlib.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ from enum import Enum
99
import sys
1010

1111
mm = MutableMapping[str, Any]
12-
_D = TypeVar('_D', mm)
12+
_D = TypeVar('_D', bound=mm)
1313
if sys.version_info >= (3,):
1414
_Path = str
1515
else:

stdlib/3/unittest/__init__.pyi

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ from contextlib import ContextManager
1212

1313

1414
_T = TypeVar('_T')
15-
_FT = TypeVar('_FT', Callable[[Any], Any])
15+
_FT = TypeVar('_FT', bound=Callable[[Any], Any])
1616
_E = TypeVar('_E', bound=Exception)
1717

1818

19-
def skip(reason: str) -> Callable[[_FT], _FT]: ...
20-
def skipIf(condition: object, reason: str) -> Callable[[_FT], _FT]: ...
21-
def skipUnless(condition: object, reason: str) -> Callable[[_FT], _FT]: ...
2219
def expectedFailure(func: _FT) -> _FT: ...
20+
# TODO: Once python/mypy#1551 is fixed, the following need _FT instead of Any
21+
def skip(reason: str) -> Callable[[Any], Any]: ...
22+
def skipIf(condition: object, reason: str) -> Callable[[Any], Any]: ...
23+
def skipUnless(condition: object, reason: str) -> Callable[[Any], Any]: ...
2324

2425
class SkipTest(Exception):
2526
def __init__(self, reason: str) -> None: ...

0 commit comments

Comments
 (0)