remove quoted strings (#6933)

This commit is contained in:
Jelle Zijlstra
2022-01-16 14:29:13 -08:00
committed by GitHub
parent 85318d1b21
commit 0949e9e90d
7 changed files with 18 additions and 24 deletions

View File

@@ -60,7 +60,7 @@ _T2 = TypeVar("_T2")
_T3 = TypeVar("_T3")
_T4 = TypeVar("_T4")
_T5 = TypeVar("_T5")
_TT = TypeVar("_TT", bound="type")
_TT = TypeVar("_TT", bound=type)
class object:
__doc__: str | None

View File

@@ -60,7 +60,7 @@ _T2 = TypeVar("_T2")
_T3 = TypeVar("_T3")
_T4 = TypeVar("_T4")
_T5 = TypeVar("_T5")
_TT = TypeVar("_TT", bound="type")
_TT = TypeVar("_TT", bound=type)
class object:
__doc__: str | None

View File

@@ -101,9 +101,9 @@ class EventType(str, Enum):
VirtualEvent: str
Visibility: str
_W = TypeVar("_W", bound="Misc")
_W = TypeVar("_W", bound=Misc)
# Events considered covariant because you should never assign to event.widget.
_W_co = TypeVar("_W_co", covariant=True, bound="Misc")
_W_co = TypeVar("_W_co", covariant=True, bound=Misc)
class Event(Generic[_W_co]):
serial: int

View File

@@ -64,8 +64,6 @@ LambdaType = FunctionType
@final
class CodeType:
"""Create a code object. Not for the faint of heart."""
co_argcount: int
if sys.version_info >= (3, 8):
co_posonlyargcount: int
@@ -262,19 +260,15 @@ class CoroutineType(Coroutine[_T_co, _T_contra, _V_co]):
def throw(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ...
class _StaticFunctionType:
"""Fictional type to correct the type of MethodType.__func__.
FunctionType is a descriptor, so mypy follows the descriptor protocol and
converts MethodType.__func__ back to MethodType (the return type of
FunctionType.__get__). But this is actually a special case; MethodType is
implemented in C and its attribute access doesn't go through
__getattribute__.
By wrapping FunctionType in _StaticFunctionType, we get the right result;
similar to wrapping a function in staticmethod() at runtime to prevent it
being bound as a method.
"""
# Fictional type to correct the type of MethodType.__func__.
# FunctionType is a descriptor, so mypy follows the descriptor protocol and
# converts MethodType.__func__ back to MethodType (the return type of
# FunctionType.__get__). But this is actually a special case; MethodType is
# implemented in C and its attribute access doesn't go through
# __getattribute__.
# By wrapping FunctionType in _StaticFunctionType, we get the right result;
# similar to wrapping a function in staticmethod() at runtime to prevent it
# being bound as a method.
def __get__(self, obj: object | None, type: type | None) -> FunctionType: ...
@final

View File

@@ -3,7 +3,7 @@ from _typeshed import Self, StrPath
from datetime import tzinfo
from typing import Any, Iterable, Protocol, Sequence
_T = typing.TypeVar("_T", bound="ZoneInfo")
_T = typing.TypeVar("_T", bound=ZoneInfo)
class _IOBytes(Protocol):
def read(self, __size: int) -> bytes: ...

View File

@@ -282,7 +282,7 @@ class UniformResourceIdentifier(GeneralName):
class ExtensionType(metaclass=ABCMeta):
oid: ObjectIdentifier
_T = TypeVar("_T", bound="ExtensionType")
_T = TypeVar("_T", bound=ExtensionType)
class Extension(Generic[_T]):
critical: bool

View File

@@ -2,9 +2,9 @@ import textwrap
from typing import IO, Any, Callable, Generic, Text, TypeVar, overload
from typing_extensions import SupportsIndex
_TB = TypeVar("_TB", bound="_BaseEntry")
_TP = TypeVar("_TP", bound="POFile")
_TM = TypeVar("_TM", bound="MOFile")
_TB = TypeVar("_TB", bound=_BaseEntry)
_TP = TypeVar("_TP", bound=POFile)
_TM = TypeVar("_TM", bound=MOFile)
default_encoding: str