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
# mypy: allow-untyped-defs | |
from typing import Any | |
from robustmq.consumer import BlockingConsumer | |
class BlockingConsumerExtended(BlockingConsumer): # type: ignore[no-untyped-def] | |
def _declare_queue(self) -> None: | |
assert self.channel is not None |
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
from typing import overload, SupportsInt, TypeVar | |
T = TypeVar('T') | |
@overload | |
def to_int(value: SupportsInt) -> int: ... | |
@overload | |
def to_int(value: T) -> T | int: ... |
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
from typing import Any, SupportsInt, TypeVar, Union, overload | |
T = TypeVar('T') | |
@overload | |
def to_int(value: SupportsInt) -> int: ... | |
@overload | |
def to_int(value: T) -> T: ... |
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
import sys | |
print(sys.version) |
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
from typing import TypeVar, Protocol, Generic, Callable, Any | |
T = TypeVar("T") | |
# MyPy: error: Missing return statement [empty-body] | |
# MyPy: error: A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var] | |
# PyRight: TypeVar "T" appears only once in generic function signature. | |
# Use "object" instead (reportInvalidTypeVarUse) | |
def f_expecting_Nothing_returning_T() -> T:... | |
# PyRight: TypeVar "T" appears only once in generic function signature. |
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
from typing import ( | |
Literal, | |
overload, | |
Sequence, | |
TypeVar, | |
Union, | |
) | |
T1 = TypeVar('T1') | |
T2 = TypeVar('T2') |
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
from typing import ( | |
Literal, | |
overload, | |
Sequence, | |
TypeVar, | |
Union, | |
) | |
T1 = TypeVar('T1') | |
T2 = TypeVar('T2') |
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
from typing import Protocol, Generic, TypeVar, runtime_checkable, Any, get_args, ClassVar | |
from abc import ABC, abstractmethod | |
from collections.abc import Sequence | |
class DeploymentConfig: | |
... | |
class DeploymentProto(Protocol): | |
config: DeploymentConfig |
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
from typing import Protocol, Generic, TypeVar, runtime_checkable, Any, get_args, ClassVar | |
from abc import ABC, abstractmethod | |
from collections.abc import Sequence | |
class DeploymentConfig: | |
... | |
class DeploymentProto(Protocol): | |
config: DeploymentConfig |
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
def foo(myvar: str | None="test") -> str | None: | |
if myvar is None: | |
return None | |
reveal_type(myvar) | |
return myvar.upper() |