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

@@ -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