forked from microsoft/pyright
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efea9b9
commit b0d4080
Showing
93 changed files
with
398 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
# This sample tests a complicated use case involving multiple | ||
# callback protocols. | ||
|
||
from typing import Callable, Protocol, TypeVar, Any | ||
from typing import Protocol, TypeVar, Any | ||
|
||
|
||
_T1 = TypeVar("_T1", contravariant=True) | ||
_T2 = TypeVar("_T2", covariant=True) | ||
_T3 = TypeVar("_T3", covariant=True) | ||
Tv_my_callable = TypeVar("Tv_my_callable", bound="MyCallable[Any]") | ||
|
||
|
||
class MyCallable(Protocol[_T1]): | ||
class Callable1(Protocol[_T1]): | ||
def __call__(self, __x: _T1) -> Any: | ||
... | ||
|
||
|
||
class MyDecorator(Protocol[_T2]): | ||
def __call__(self, __x: MyCallable[_T2]) -> Any: | ||
_T4 = TypeVar("_T4", bound=Callable1[Any]) | ||
|
||
|
||
class Decorator1(Protocol[_T2]): | ||
def __call__(self, __x: Callable1[_T2]) -> Any: | ||
... | ||
|
||
|
||
def decorates_my_callable(__x: MyDecorator[_T3]) -> MyDecorator[_T3]: | ||
def decorator1(__x: Decorator1[_T3]) -> Decorator1[_T3]: | ||
... | ||
|
||
|
||
def my_decorator_inner(__x: Tv_my_callable) -> Tv_my_callable: | ||
def func1(__x: _T4) -> _T4: | ||
... | ||
|
||
|
||
decorates_my_callable(my_decorator_inner) | ||
|
||
decorator1(func1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.