mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Type, TypeVar, Union, overload
|
||||
from typing import Any, Callable, Dict, Iterable, Iterator, List, Tuple, Type, TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -27,11 +27,11 @@ class _Cell:
|
||||
cell_contents: Any
|
||||
|
||||
class FunctionType:
|
||||
func_closure: Optional[Tuple[_Cell, ...]] = ...
|
||||
func_closure: Tuple[_Cell, ...] | None = ...
|
||||
func_code: CodeType = ...
|
||||
func_defaults: Optional[Tuple[Any, ...]] = ...
|
||||
func_defaults: Tuple[Any, ...] | None = ...
|
||||
func_dict: Dict[str, Any] = ...
|
||||
func_doc: Optional[str] = ...
|
||||
func_doc: str | None = ...
|
||||
func_globals: Dict[str, Any] = ...
|
||||
func_name: str = ...
|
||||
__closure__ = func_closure
|
||||
@@ -44,12 +44,12 @@ class FunctionType:
|
||||
self,
|
||||
code: CodeType,
|
||||
globals: Dict[str, Any],
|
||||
name: Optional[str] = ...,
|
||||
argdefs: Optional[Tuple[object, ...]] = ...,
|
||||
closure: Optional[Tuple[_Cell, ...]] = ...,
|
||||
name: str | None = ...,
|
||||
argdefs: Tuple[object, ...] | None = ...,
|
||||
closure: Tuple[_Cell, ...] | None = ...,
|
||||
) -> None: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
def __get__(self, obj: Optional[object], type: Optional[type]) -> UnboundMethodType: ...
|
||||
def __get__(self, obj: object | None, type: type | None) -> UnboundMethodType: ...
|
||||
|
||||
LambdaType = FunctionType
|
||||
|
||||
@@ -95,11 +95,9 @@ class GeneratorType:
|
||||
def next(self) -> Any: ...
|
||||
def send(self, __arg: Any) -> Any: ...
|
||||
@overload
|
||||
def throw(
|
||||
self, __typ: Type[BaseException], __val: Union[BaseException, object] = ..., __tb: Optional[TracebackType] = ...
|
||||
) -> Any: ...
|
||||
def throw(self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...) -> Any: ...
|
||||
@overload
|
||||
def throw(self, __typ: BaseException, __val: None = ..., __tb: Optional[TracebackType] = ...) -> Any: ...
|
||||
def throw(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> Any: ...
|
||||
|
||||
class ClassType: ...
|
||||
|
||||
@@ -118,19 +116,19 @@ class InstanceType(object): ...
|
||||
MethodType = UnboundMethodType
|
||||
|
||||
class BuiltinFunctionType:
|
||||
__self__: Optional[object]
|
||||
__self__: object | None
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
BuiltinMethodType = BuiltinFunctionType
|
||||
|
||||
class ModuleType:
|
||||
__doc__: Optional[str]
|
||||
__file__: Optional[str]
|
||||
__doc__: str | None
|
||||
__file__: str | None
|
||||
__name__: str
|
||||
__package__: Optional[str]
|
||||
__path__: Optional[Iterable[str]]
|
||||
__package__: str | None
|
||||
__path__: Iterable[str] | None
|
||||
__dict__: Dict[str, Any]
|
||||
def __init__(self, name: str, doc: Optional[str] = ...) -> None: ...
|
||||
def __init__(self, name: str, doc: str | None = ...) -> None: ...
|
||||
|
||||
FileType = file
|
||||
XRangeType = xrange
|
||||
@@ -164,7 +162,7 @@ class DictProxyType:
|
||||
# TODO is it possible to have non-string keys?
|
||||
# no __init__
|
||||
def copy(self) -> Dict[Any, Any]: ...
|
||||
def get(self, key: str, default: _T = ...) -> Union[Any, _T]: ...
|
||||
def get(self, key: str, default: _T = ...) -> Any | _T: ...
|
||||
def has_key(self, key: str) -> bool: ...
|
||||
def items(self) -> List[Tuple[str, Any]]: ...
|
||||
def iteritems(self) -> Iterator[Tuple[str, Any]]: ...
|
||||
|
||||
Reference in New Issue
Block a user