mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 03:41:28 +08:00
Avoid using string literals in type annotations (#2294)
This commit is contained in:
committed by
Jelle Zijlstra
parent
25ad95de4f
commit
6192cce9d9
@@ -33,7 +33,7 @@ class FunctionType:
|
||||
__annotations__ = ... # type: Dict[str, Any]
|
||||
__kwdefaults__ = ... # type: Dict[str, Any]
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
def __get__(self, obj: Optional[object], type: Optional[type]) -> 'MethodType': ...
|
||||
def __get__(self, obj: Optional[object], type: Optional[type]) -> MethodType: ...
|
||||
LambdaType = FunctionType
|
||||
|
||||
class CodeType:
|
||||
@@ -89,14 +89,14 @@ class GeneratorType:
|
||||
gi_frame = ... # type: FrameType
|
||||
gi_running = ... # type: bool
|
||||
gi_yieldfrom = ... # type: Optional[GeneratorType]
|
||||
def __iter__(self) -> 'GeneratorType': ...
|
||||
def __iter__(self) -> GeneratorType: ...
|
||||
def __next__(self) -> Any: ...
|
||||
def close(self) -> None: ...
|
||||
def send(self, arg: Any) -> Any: ...
|
||||
@overload
|
||||
def throw(self, val: BaseException) -> Any: ...
|
||||
@overload
|
||||
def throw(self, typ: type, val: BaseException = ..., tb: 'TracebackType' = ...) -> Any: ...
|
||||
def throw(self, typ: type, val: BaseException = ..., tb: TracebackType = ...) -> Any: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
class AsyncGeneratorType(Generic[_T_co, _T_contra]):
|
||||
@@ -123,7 +123,7 @@ class CoroutineType:
|
||||
@overload
|
||||
def throw(self, val: BaseException) -> Any: ...
|
||||
@overload
|
||||
def throw(self, typ: type, val: BaseException = ..., tb: 'TracebackType' = ...) -> Any: ...
|
||||
def throw(self, typ: type, val: BaseException = ..., tb: TracebackType = ...) -> Any: ...
|
||||
|
||||
class _StaticFunctionType:
|
||||
"""Fictional type to correct the type of MethodType.__func__.
|
||||
@@ -138,7 +138,7 @@ class _StaticFunctionType:
|
||||
similar to wrapping a function in staticmethod() at runtime to prevent it
|
||||
being bound as a method.
|
||||
"""
|
||||
def __get__(self, obj: Optional[object], type: Optional[type]) -> 'FunctionType': ...
|
||||
def __get__(self, obj: Optional[object], type: Optional[type]) -> FunctionType: ...
|
||||
|
||||
class MethodType:
|
||||
__func__ = ... # type: _StaticFunctionType
|
||||
|
||||
Reference in New Issue
Block a user