Switch to PEP-604 syntax in python2 stubs (#5915)

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
Oleg Höfling
2021-08-14 11:12:30 +02:00
committed by GitHub
parent 431c4f7fc1
commit ff63953188
235 changed files with 2473 additions and 2768 deletions

View File

@@ -1,6 +1,6 @@
import mimetools
import SocketServer
from typing import Any, BinaryIO, Callable, Mapping, Optional, Tuple, Union
from typing import Any, BinaryIO, Callable, Mapping, Tuple
class HTTPServer(SocketServer.TCPServer):
server_name: str
@@ -27,15 +27,15 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
def __init__(self, request: bytes, client_address: Tuple[str, int], server: SocketServer.BaseServer) -> None: ...
def handle(self) -> None: ...
def handle_one_request(self) -> None: ...
def send_error(self, code: int, message: Optional[str] = ...) -> None: ...
def send_response(self, code: int, message: Optional[str] = ...) -> None: ...
def send_error(self, code: int, message: str | None = ...) -> None: ...
def send_response(self, code: int, message: str | None = ...) -> None: ...
def send_header(self, keyword: str, value: str) -> None: ...
def end_headers(self) -> None: ...
def flush_headers(self) -> None: ...
def log_request(self, code: Union[int, str] = ..., size: Union[int, str] = ...) -> None: ...
def log_request(self, code: int | str = ..., size: int | str = ...) -> None: ...
def log_error(self, format: str, *args: Any) -> None: ...
def log_message(self, format: str, *args: Any) -> None: ...
def version_string(self) -> str: ...
def date_time_string(self, timestamp: Optional[int] = ...) -> str: ...
def date_time_string(self, timestamp: int | None = ...) -> str: ...
def log_date_time_string(self) -> str: ...
def address_string(self) -> str: ...

View File

@@ -1,5 +1,5 @@
from _typeshed import SupportsNoArgReadline
from typing import IO, Any, Dict, List, Optional, Sequence, Tuple, Union
from typing import IO, Any, Dict, List, Sequence, Tuple
DEFAULTSECT: str
MAX_INTERPOLATION_DEPTH: int
@@ -65,7 +65,7 @@ class RawConfigParser:
def add_section(self, section: str) -> None: ...
def has_section(self, section: str) -> bool: ...
def options(self, section: str) -> List[str]: ...
def read(self, filenames: Union[str, Sequence[str]]) -> List[str]: ...
def read(self, filenames: str | Sequence[str]) -> List[str]: ...
def readfp(self, fp: SupportsNoArgReadline[str], filename: str = ...) -> None: ...
def get(self, section: str, option: str) -> str: ...
def items(self, section: str) -> List[Tuple[Any, Any]]: ...
@@ -84,8 +84,8 @@ class RawConfigParser:
class ConfigParser(RawConfigParser):
_KEYCRE: Any
def get(self, section: str, option: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> Any: ...
def items(self, section: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> List[Tuple[str, Any]]: ...
def get(self, section: str, option: str, raw: bool = ..., vars: Dict[Any, Any] | None = ...) -> Any: ...
def items(self, section: str, raw: bool = ..., vars: Dict[Any, Any] | None = ...) -> List[Tuple[str, Any]]: ...
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
def _interpolation_replace(self, match: Any) -> str: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Optional
from typing import Any, Dict
class CookieError(Exception): ...
@@ -10,17 +10,17 @@ class Morsel(Dict[Any, Any]):
value: Any
coded_value: Any
def set(self, key, val, coded_val, LegalChars=..., idmap=..., translate=...): ...
def output(self, attrs: Optional[Any] = ..., header=...): ...
def js_output(self, attrs: Optional[Any] = ...): ...
def OutputString(self, attrs: Optional[Any] = ...): ...
def output(self, attrs: Any | None = ..., header=...): ...
def js_output(self, attrs: Any | None = ...): ...
def OutputString(self, attrs: Any | None = ...): ...
class BaseCookie(Dict[Any, Any]):
def value_decode(self, val): ...
def value_encode(self, val): ...
def __init__(self, input: Optional[Any] = ...): ...
def __init__(self, input: Any | None = ...): ...
def __setitem__(self, key, value): ...
def output(self, attrs: Optional[Any] = ..., header=..., sep=...): ...
def js_output(self, attrs: Optional[Any] = ...): ...
def output(self, attrs: Any | None = ..., header=..., sep=...): ...
def js_output(self, attrs: Any | None = ...): ...
def load(self, rawdata): ...
class SimpleCookie(BaseCookie):
@@ -28,12 +28,12 @@ class SimpleCookie(BaseCookie):
def value_encode(self, val): ...
class SerialCookie(BaseCookie):
def __init__(self, input: Optional[Any] = ...): ...
def __init__(self, input: Any | None = ...): ...
def value_decode(self, val): ...
def value_encode(self, val): ...
class SmartCookie(BaseCookie):
def __init__(self, input: Optional[Any] = ...): ...
def __init__(self, input: Any | None = ...): ...
def value_decode(self, val): ...
def value_encode(self, val): ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Deque, Generic, Optional, TypeVar
from typing import Any, Deque, Generic, TypeVar
_T = TypeVar("_T")
@@ -19,9 +19,9 @@ class Queue(Generic[_T]):
def qsize(self) -> int: ...
def empty(self) -> bool: ...
def full(self) -> bool: ...
def put(self, item: _T, block: bool = ..., timeout: Optional[float] = ...) -> None: ...
def put(self, item: _T, block: bool = ..., timeout: float | None = ...) -> None: ...
def put_nowait(self, item: _T) -> None: ...
def get(self, block: bool = ..., timeout: Optional[float] = ...) -> _T: ...
def get(self, block: bool = ..., timeout: float | None = ...) -> _T: ...
def get_nowait(self) -> _T: ...
class PriorityQueue(Queue[_T]): ...

View File

@@ -1,14 +1,14 @@
import BaseHTTPServer
from StringIO import StringIO
from typing import IO, Any, AnyStr, Mapping, Optional, Union
from typing import IO, Any, AnyStr, Mapping
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
server_version: str
def do_GET(self) -> None: ...
def do_HEAD(self) -> None: ...
def send_head(self) -> Optional[IO[str]]: ...
def list_directory(self, path: Union[str, unicode]) -> Optional[StringIO[Any]]: ...
def send_head(self) -> IO[str] | None: ...
def list_directory(self, path: str | unicode) -> StringIO[Any] | None: ...
def translate_path(self, path: AnyStr) -> AnyStr: ...
def copyfile(self, source: IO[AnyStr], outputfile: IO[AnyStr]): ...
def guess_type(self, path: Union[str, unicode]) -> str: ...
def guess_type(self, path: str | unicode) -> str: ...
extensions_map: Mapping[str, str]

View File

@@ -1,6 +1,6 @@
import sys
from socket import SocketType
from typing import Any, BinaryIO, Callable, ClassVar, List, Optional, Text, Tuple, Union
from typing import Any, BinaryIO, Callable, ClassVar, List, Text, Tuple, Union
class BaseServer:
address_family: int
@@ -10,7 +10,7 @@ class BaseServer:
allow_reuse_address: bool
request_queue_size: int
socket_type: int
timeout: Optional[float]
timeout: float | None
def __init__(self, server_address: Any, RequestHandlerClass: Callable[..., BaseRequestHandler]) -> None: ...
def fileno(self) -> int: ...
def handle_request(self) -> None: ...
@@ -46,22 +46,22 @@ if sys.platform != "win32":
class UnixStreamServer(BaseServer):
def __init__(
self,
server_address: Union[Text, bytes],
server_address: Text | bytes,
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
class UnixDatagramServer(BaseServer):
def __init__(
self,
server_address: Union[Text, bytes],
server_address: Text | bytes,
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
if sys.platform != "win32":
class ForkingMixIn:
timeout: Optional[float] # undocumented
active_children: Optional[List[int]] # undocumented
timeout: float | None # undocumented
active_children: List[int] | None # undocumented
max_children: int # undocumented
def collect_children(self) -> None: ... # undocumented
def handle_timeout(self) -> None: ... # undocumented
@@ -101,7 +101,7 @@ class BaseRequestHandler:
class StreamRequestHandler(BaseRequestHandler):
rbufsize: ClassVar[int] # undocumented
wbufsize: ClassVar[int] # undocumented
timeout: ClassVar[Optional[float]] # undocumented
timeout: ClassVar[float | None] # undocumented
disable_nagle_algorithm: ClassVar[bool] # undocumented
connection: SocketType # undocumented
rfile: BinaryIO

View File

@@ -1,4 +1,4 @@
from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List, Optional
from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List
class StringIO(IO[AnyStr], Generic[AnyStr]):
closed: bool
@@ -15,7 +15,7 @@ class StringIO(IO[AnyStr], Generic[AnyStr]):
def read(self, n: int = ...) -> AnyStr: ...
def readline(self, length: int = ...) -> AnyStr: ...
def readlines(self, sizehint: int = ...) -> List[AnyStr]: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def truncate(self, size: int | None = ...) -> int: ...
def write(self, s: AnyStr) -> int: ...
def writelines(self, iterable: Iterable[AnyStr]) -> None: ...
def flush(self) -> None: ...

View File

@@ -1,19 +1,4 @@
from typing import (
Any,
Container,
Dict,
Generic,
Iterable,
Iterator,
List,
Mapping,
Optional,
Sized,
Tuple,
TypeVar,
Union,
overload,
)
from typing import Any, Container, Dict, Generic, Iterable, Iterator, List, Mapping, Sized, Tuple, TypeVar, overload
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
@@ -33,9 +18,9 @@ class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]):
# From typing.Mapping[_KT, _VT]
# (can't inherit because of keys())
@overload
def get(self, k: _KT) -> Optional[_VT]: ...
def get(self, k: _KT) -> _VT | None: ...
@overload
def get(self, k: _KT, default: Union[_VT, _T]) -> Union[_VT, _T]: ...
def get(self, k: _KT, default: _VT | _T) -> _VT | _T: ...
def values(self) -> List[_VT]: ...
def items(self) -> List[Tuple[_KT, _VT]]: ...
def iterkeys(self) -> Iterator[_KT]: ...

View File

@@ -1,4 +1,4 @@
from typing import Iterable, List, MutableSequence, TypeVar, Union, overload
from typing import Iterable, List, MutableSequence, TypeVar, overload
_T = TypeVar("_T")
_S = TypeVar("_S")
@@ -10,7 +10,7 @@ class UserList(MutableSequence[_T]):
def __setitem__(self, i: int, o: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __delitem__(self, i: int | slice) -> None: ...
def __len__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> _T: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Iterable, List, MutableSequence, Optional, Sequence, Text, Tuple, TypeVar, Union, overload
from typing import Any, Iterable, List, MutableSequence, Sequence, Text, Tuple, TypeVar, overload
_UST = TypeVar("_UST", bound=UserString)
_MST = TypeVar("_MST", bound=MutableString)
@@ -24,9 +24,9 @@ class UserString(Sequence[UserString]):
def capitalize(self: _UST) -> _UST: ...
def center(self: _UST, width: int, *args: Any) -> _UST: ...
def count(self, sub: int, start: int = ..., end: int = ...) -> int: ...
def decode(self: _UST, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UST: ...
def encode(self: _UST, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UST: ...
def endswith(self, suffix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ...
def decode(self: _UST, encoding: str | None = ..., errors: str | None = ...) -> _UST: ...
def encode(self: _UST, encoding: str | None = ..., errors: str | None = ...) -> _UST: ...
def endswith(self, suffix: Text | Tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ...
def expandtabs(self: _UST, tabsize: int = ...) -> _UST: ...
def find(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def index(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
@@ -42,19 +42,19 @@ class UserString(Sequence[UserString]):
def join(self, seq: Iterable[Text]) -> Text: ...
def ljust(self: _UST, width: int, *args: Any) -> _UST: ...
def lower(self: _UST) -> _UST: ...
def lstrip(self: _UST, chars: Optional[Text] = ...) -> _UST: ...
def lstrip(self: _UST, chars: Text | None = ...) -> _UST: ...
def partition(self, sep: Text) -> Tuple[Text, Text, Text]: ...
def replace(self: _UST, old: Text, new: Text, maxsplit: int = ...) -> _UST: ...
def rfind(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def rindex(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def rjust(self: _UST, width: int, *args: Any) -> _UST: ...
def rpartition(self, sep: Text) -> Tuple[Text, Text, Text]: ...
def rstrip(self: _UST, chars: Optional[Text] = ...) -> _UST: ...
def split(self, sep: Optional[Text] = ..., maxsplit: int = ...) -> List[Text]: ...
def rsplit(self, sep: Optional[Text] = ..., maxsplit: int = ...) -> List[Text]: ...
def rstrip(self: _UST, chars: Text | None = ...) -> _UST: ...
def split(self, sep: Text | None = ..., maxsplit: int = ...) -> List[Text]: ...
def rsplit(self, sep: Text | None = ..., maxsplit: int = ...) -> List[Text]: ...
def splitlines(self, keepends: int = ...) -> List[Text]: ...
def startswith(self, prefix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ...
def strip(self: _UST, chars: Optional[Text] = ...) -> _UST: ...
def startswith(self, prefix: Text | Tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ...
def strip(self: _UST, chars: Text | None = ...) -> _UST: ...
def swapcase(self: _UST) -> _UST: ...
def title(self: _UST) -> _UST: ...
def translate(self: _UST, *args: Any) -> _UST: ...
@@ -66,8 +66,8 @@ class MutableString(UserString, MutableSequence[MutableString]):
def __getitem__(self: _MST, i: int) -> _MST: ...
@overload
def __getitem__(self: _MST, s: slice) -> _MST: ...
def __setitem__(self, index: Union[int, slice], sub: Any) -> None: ...
def __delitem__(self, index: Union[int, slice]) -> None: ...
def __setitem__(self, index: int | slice, sub: Any) -> None: ...
def __delitem__(self, index: int | slice) -> None: ...
def immutable(self) -> UserString: ...
def __iadd__(self: _MST, other: Any) -> _MST: ...
def __imul__(self, n: int) -> _MST: ...

View File

@@ -26,7 +26,6 @@ from typing import (
MutableSequence,
MutableSet,
NoReturn,
Optional,
Protocol,
Reversible,
Sequence,
@@ -40,7 +39,6 @@ from typing import (
Tuple,
Type,
TypeVar,
Union,
ValuesView,
overload,
)
@@ -66,9 +64,9 @@ _TT = TypeVar("_TT", bound="type")
_TBE = TypeVar("_TBE", bound="BaseException")
class object:
__doc__: Optional[str]
__doc__: str | None
__dict__: Dict[str, Any]
__slots__: Union[Text, Iterable[Text]]
__slots__: Text | Iterable[Text]
__module__: str
@property
def __class__(self: _T) -> Type[_T]: ...
@@ -86,20 +84,20 @@ class object:
def __getattribute__(self, name: str) -> Any: ...
def __delattr__(self, name: str) -> None: ...
def __sizeof__(self) -> int: ...
def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ...
def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ...
def __reduce__(self) -> str | Tuple[Any, ...]: ...
def __reduce_ex__(self, protocol: int) -> str | Tuple[Any, ...]: ...
class staticmethod(object): # Special, only valid as a decorator.
__func__: Callable[..., Any]
def __init__(self, f: Callable[..., Any]) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ...
class classmethod(object): # Special, only valid as a decorator.
__func__: Callable[..., Any]
def __init__(self, f: Callable[..., Any]) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ...
class type(object):
__base__: type
@@ -137,9 +135,9 @@ class super(object):
class int:
@overload
def __new__(cls: Type[_T], x: Union[Text, bytes, SupportsInt, _SupportsIndex, _SupportsTrunc] = ...) -> _T: ...
def __new__(cls: Type[_T], x: Text | bytes | SupportsInt | _SupportsIndex | _SupportsTrunc = ...) -> _T: ...
@overload
def __new__(cls: Type[_T], x: Union[Text, bytes, bytearray], base: int) -> _T: ...
def __new__(cls: Type[_T], x: Text | bytes | bytearray, base: int) -> _T: ...
@property
def real(self) -> int: ...
@property
@@ -167,10 +165,10 @@ class int:
def __rmod__(self, x: int) -> int: ...
def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
@overload
def __pow__(self, __x: Literal[2], __modulo: Optional[int] = ...) -> int: ...
def __pow__(self, __x: Literal[2], __modulo: int | None = ...) -> int: ...
@overload
def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ... # Return type can be int or float, depending on x.
def __rpow__(self, x: int, mod: Optional[int] = ...) -> Any: ...
def __pow__(self, __x: int, __modulo: int | None = ...) -> Any: ... # Return type can be int or float, depending on x.
def __rpow__(self, x: int, mod: int | None = ...) -> Any: ...
def __and__(self, n: int) -> int: ...
def __or__(self, n: int) -> int: ...
def __xor__(self, n: int) -> int: ...
@@ -201,7 +199,7 @@ class int:
def __index__(self) -> int: ...
class float:
def __new__(cls: Type[_T], x: Union[SupportsFloat, _SupportsIndex, Text, bytes, bytearray] = ...) -> _T: ...
def __new__(cls: Type[_T], x: SupportsFloat | _SupportsIndex | Text | bytes | bytearray = ...) -> _T: ...
def as_integer_ratio(self) -> Tuple[int, int]: ...
def hex(self) -> str: ...
def is_integer(self) -> bool: ...
@@ -253,7 +251,7 @@ class complex:
@overload
def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ...
@overload
def __new__(cls: Type[_T], real: Union[str, SupportsComplex, _SupportsIndex]) -> _T: ...
def __new__(cls: Type[_T], real: str | SupportsComplex | _SupportsIndex) -> _T: ...
@property
def real(self) -> float: ...
@property
@@ -295,9 +293,7 @@ class unicode(basestring, Sequence[unicode]):
def count(self, x: unicode) -> int: ...
def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ...
def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ...
def endswith(
self, __suffix: Union[unicode, Tuple[unicode, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def endswith(self, __suffix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
def expandtabs(self, tabsize: int = ...) -> unicode: ...
def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
def format(self, *args: object, **kwargs: object) -> unicode: ...
@@ -323,17 +319,15 @@ class unicode(basestring, Sequence[unicode]):
def rindex(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
def rjust(self, width: int, fillchar: unicode = ...) -> unicode: ...
def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
def rsplit(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ...
def rsplit(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ...
def rstrip(self, chars: unicode = ...) -> unicode: ...
def split(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ...
def split(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ...
def splitlines(self, keepends: bool = ...) -> List[unicode]: ...
def startswith(
self, __prefix: Union[unicode, Tuple[unicode, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def startswith(self, __prefix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
def strip(self, chars: unicode = ...) -> unicode: ...
def swapcase(self) -> unicode: ...
def title(self) -> unicode: ...
def translate(self, table: Union[Dict[int, Any], unicode]) -> unicode: ...
def translate(self, table: Dict[int, Any] | unicode) -> unicode: ...
def upper(self) -> unicode: ...
def zfill(self, width: int) -> unicode: ...
@overload
@@ -353,7 +347,7 @@ class unicode(basestring, Sequence[unicode]):
def __ge__(self, x: unicode) -> bool: ...
def __len__(self) -> int: ...
# The argument type is incompatible with Sequence
def __contains__(self, s: Union[unicode, bytes]) -> bool: ... # type: ignore
def __contains__(self, s: unicode | bytes) -> bool: ... # type: ignore
def __iter__(self) -> Iterator[unicode]: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
@@ -369,17 +363,15 @@ class str(Sequence[str], basestring):
def __init__(self, o: object = ...) -> None: ...
def capitalize(self) -> str: ...
def center(self, __width: int, __fillchar: str = ...) -> str: ...
def count(self, x: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def count(self, x: Text, __start: int | None = ..., __end: int | None = ...) -> int: ...
def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ...
def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ...
def endswith(
self, __suffix: Union[Text, Tuple[Text, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def endswith(self, __suffix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
def expandtabs(self, tabsize: int = ...) -> str: ...
def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def find(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ...
def format(self, *args: object, **kwargs: object) -> str: ...
def format_map(self, map: _FormatMapMapping) -> str: ...
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def index(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...
def isdigit(self) -> bool: ...
@@ -401,8 +393,8 @@ class str(Sequence[str], basestring):
@overload
def partition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
def replace(self, __old: AnyStr, __new: AnyStr, __count: int = ...) -> AnyStr: ...
def rfind(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def rindex(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def rfind(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ...
def rindex(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ...
def rjust(self, __width: int, __fillchar: str = ...) -> str: ...
@overload
def rpartition(self, __sep: bytearray) -> Tuple[str, bytearray, str]: ...
@@ -411,7 +403,7 @@ class str(Sequence[str], basestring):
@overload
def rpartition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
@overload
def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ...
@overload
def rsplit(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
@overload
@@ -419,28 +411,26 @@ class str(Sequence[str], basestring):
@overload
def rstrip(self, __chars: unicode) -> unicode: ...
@overload
def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
def split(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ...
@overload
def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
def splitlines(self, keepends: bool = ...) -> List[str]: ...
def startswith(
self, __prefix: Union[Text, Tuple[Text, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def startswith(self, __prefix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
@overload
def strip(self, __chars: str = ...) -> str: ...
@overload
def strip(self, chars: unicode) -> unicode: ...
def swapcase(self) -> str: ...
def title(self) -> str: ...
def translate(self, __table: Optional[AnyStr], deletechars: AnyStr = ...) -> AnyStr: ...
def translate(self, __table: AnyStr | None, deletechars: AnyStr = ...) -> AnyStr: ...
def upper(self) -> str: ...
def zfill(self, __width: int) -> str: ...
def __add__(self, s: AnyStr) -> AnyStr: ...
# Incompatible with Sequence.__contains__
def __contains__(self, o: Union[str, Text]) -> bool: ... # type: ignore
def __contains__(self, o: str | Text) -> bool: ... # type: ignore
def __eq__(self, x: object) -> bool: ...
def __ge__(self, x: Text) -> bool: ...
def __getitem__(self, i: Union[int, slice]) -> str: ...
def __getitem__(self, i: int | slice) -> str: ...
def __gt__(self, x: Text) -> bool: ...
def __hash__(self) -> int: ...
def __iter__(self) -> Iterator[str]: ...
@@ -475,11 +465,9 @@ class bytearray(MutableSequence[int], ByteString):
def center(self, __width: int, __fillchar: bytes = ...) -> bytearray: ...
def count(self, __sub: str) -> int: ...
def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ...
def endswith(
self, __suffix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def endswith(self, __suffix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
def expandtabs(self, tabsize: int = ...) -> bytearray: ...
def extend(self, iterable: Union[str, Iterable[int]]) -> None: ...
def extend(self, iterable: str | Iterable[int]) -> None: ...
def find(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ...
def index(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ...
def insert(self, __index: int, __item: int) -> None: ...
@@ -493,21 +481,19 @@ class bytearray(MutableSequence[int], ByteString):
def join(self, __iterable: Iterable[str]) -> bytearray: ...
def ljust(self, __width: int, __fillchar: str = ...) -> bytearray: ...
def lower(self) -> bytearray: ...
def lstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def lstrip(self, __bytes: bytes | None = ...) -> bytearray: ...
def partition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytearray: ...
def rfind(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ...
def rindex(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ...
def rjust(self, __width: int, __fillchar: bytes = ...) -> bytearray: ...
def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def rsplit(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
def rstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
def rsplit(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ...
def rstrip(self, __bytes: bytes | None = ...) -> bytearray: ...
def split(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ...
def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
def startswith(
self, __prefix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def strip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def startswith(self, __prefix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
def strip(self, __bytes: bytes | None = ...) -> bytearray: ...
def swapcase(self) -> bytearray: ...
def title(self) -> bytearray: ...
def translate(self, __table: str) -> bytearray: ...
@@ -529,15 +515,15 @@ class bytearray(MutableSequence[int], ByteString):
@overload
def __setitem__(self, i: int, x: int) -> None: ...
@overload
def __setitem__(self, s: slice, x: Union[Iterable[int], bytes]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __setitem__(self, s: slice, x: Iterable[int] | bytes) -> None: ...
def __delitem__(self, i: int | slice) -> None: ...
def __getslice__(self, start: int, stop: int) -> bytearray: ...
def __setslice__(self, start: int, stop: int, x: Union[Sequence[int], str]) -> None: ...
def __setslice__(self, start: int, stop: int, x: Sequence[int] | str) -> None: ...
def __delslice__(self, start: int, stop: int) -> None: ...
def __add__(self, s: bytes) -> bytearray: ...
def __mul__(self, n: int) -> bytearray: ...
# Incompatible with Sequence.__contains__
def __contains__(self, o: Union[int, bytes]) -> bool: ... # type: ignore
def __contains__(self, o: int | bytes) -> bool: ... # type: ignore
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: bytes) -> bool: ...
@@ -548,9 +534,9 @@ class bytearray(MutableSequence[int], ByteString):
class memoryview(Sized, Container[str]):
format: str
itemsize: int
shape: Optional[Tuple[int, ...]]
strides: Optional[Tuple[int, ...]]
suboffsets: Optional[Tuple[int, ...]]
shape: Tuple[int, ...] | None
strides: Tuple[int, ...] | None
suboffsets: Tuple[int, ...] | None
readonly: bool
ndim: int
def __init__(self, obj: ReadableBuffer) -> None: ...
@@ -662,7 +648,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __setitem__(self, i: int, o: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __delitem__(self, i: int | slice) -> None: ...
def __getslice__(self, start: int, stop: int) -> List[_T]: ...
def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ...
def __delslice__(self, start: int, stop: int) -> None: ...
@@ -743,18 +729,18 @@ class set(MutableSet[_T], Generic[_T]):
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[object]) -> Set[_T]: ...
def __iand__(self, s: AbstractSet[object]) -> Set[_T]: ...
def __or__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __ior__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __or__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __ior__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
@overload
def __sub__(self: Set[str], s: AbstractSet[Optional[Text]]) -> Set[_T]: ...
def __sub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ...
@overload
def __sub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...
def __sub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ...
@overload # type: ignore
def __isub__(self: Set[str], s: AbstractSet[Optional[Text]]) -> Set[_T]: ...
def __isub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ...
@overload
def __isub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __ixor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __isub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __ixor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __le__(self, s: AbstractSet[object]) -> bool: ...
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
@@ -776,9 +762,9 @@ class frozenset(AbstractSet[_T_co], Generic[_T_co]):
def __iter__(self) -> Iterator[_T_co]: ...
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T_co, _S]]: ...
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T_co, _S]]: ...
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
def __le__(self, s: AbstractSet[object]) -> bool: ...
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
@@ -802,15 +788,15 @@ class xrange(Sized, Iterable[int], Reversible[int]):
class property(object):
def __init__(
self,
fget: Optional[Callable[[Any], Any]] = ...,
fset: Optional[Callable[[Any, Any], None]] = ...,
fdel: Optional[Callable[[Any], None]] = ...,
doc: Optional[str] = ...,
fget: Callable[[Any], Any] | None = ...,
fset: Callable[[Any, Any], None] | None = ...,
fdel: Callable[[Any], None] | None = ...,
doc: str | None = ...,
) -> None: ...
def getter(self, fget: Callable[[Any], Any]) -> property: ...
def setter(self, fset: Callable[[Any, Any], None]) -> property: ...
def deleter(self, fdel: Callable[[Any], None]) -> property: ...
def __get__(self, obj: Any, type: Optional[type] = ...) -> Any: ...
def __get__(self, obj: Any, type: type | None = ...) -> Any: ...
def __set__(self, obj: Any, value: Any) -> None: ...
def __delete__(self, obj: Any) -> None: ...
def fget(self) -> Any: ...
@@ -829,8 +815,8 @@ NotImplemented: _NotImplementedType
def abs(__x: SupportsAbs[_T]) -> _T: ...
def all(__iterable: Iterable[object]) -> bool: ...
def any(__iterable: Iterable[object]) -> bool: ...
def apply(__func: Callable[..., _T], __args: Optional[Sequence[Any]] = ..., __kwds: Optional[Mapping[str, Any]] = ...) -> _T: ...
def bin(__number: Union[int, _SupportsIndex]) -> str: ...
def apply(__func: Callable[..., _T], __args: Sequence[Any] | None = ..., __kwds: Mapping[str, Any] | None = ...) -> _T: ...
def bin(__number: int | _SupportsIndex) -> str: ...
def callable(__obj: object) -> bool: ...
def chr(__i: int) -> str: ...
def cmp(__x: Any, __y: Any) -> int: ...
@@ -838,7 +824,7 @@ def cmp(__x: Any, __y: Any) -> int: ...
_N1 = TypeVar("_N1", bool, int, float, complex)
def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ...
def compile(source: Union[Text, mod], filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ...
def compile(source: Text | mod, filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ...
def delattr(__obj: Any, __name: Text) -> None: ...
def dir(__o: object = ...) -> List[str]: ...
@@ -846,18 +832,18 @@ _N2 = TypeVar("_N2", int, float)
def divmod(__x: _N2, __y: _N2) -> Tuple[_N2, _N2]: ...
def eval(
__source: Union[Text, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...
__source: Text | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ...
) -> Any: ...
def execfile(__filename: str, __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Dict[str, Any]] = ...) -> None: ...
def execfile(__filename: str, __globals: Dict[str, Any] | None = ..., __locals: Dict[str, Any] | None = ...) -> None: ...
def exit(code: object = ...) -> NoReturn: ...
@overload
def filter(__function: Callable[[AnyStr], Any], __iterable: AnyStr) -> AnyStr: ... # type: ignore
@overload
def filter(__function: None, __iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ... # type: ignore
def filter(__function: None, __iterable: Tuple[_T | None, ...]) -> Tuple[_T, ...]: ... # type: ignore
@overload
def filter(__function: Callable[[_T], Any], __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... # type: ignore
@overload
def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> List[_T]: ...
def filter(__function: None, __iterable: Iterable[_T | None]) -> List[_T]: ...
@overload
def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ...
def format(__value: object, __format_spec: str = ...) -> str: ... # TODO unicode
@@ -867,26 +853,26 @@ def getattr(__o: Any, name: Text) -> Any: ...
# While technically covered by the last overload, spelling out the types for None and bool
# help mypy out in some tricky situations involving type context (aka bidirectional inference)
@overload
def getattr(__o: Any, name: Text, __default: None) -> Optional[Any]: ...
def getattr(__o: Any, name: Text, __default: None) -> Any | None: ...
@overload
def getattr(__o: Any, name: Text, __default: bool) -> Union[Any, bool]: ...
def getattr(__o: Any, name: Text, __default: bool) -> Any | bool: ...
@overload
def getattr(__o: Any, name: Text, __default: _T) -> Union[Any, _T]: ...
def getattr(__o: Any, name: Text, __default: _T) -> Any | _T: ...
def globals() -> Dict[str, Any]: ...
def hasattr(__obj: Any, __name: Text) -> bool: ...
def hash(__obj: object) -> int: ...
def hex(__number: Union[int, _SupportsIndex]) -> str: ...
def hex(__number: int | _SupportsIndex) -> str: ...
def id(__obj: object) -> int: ...
def input(__prompt: Any = ...) -> Any: ...
def intern(__string: str) -> str: ...
@overload
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def iter(__function: Callable[[], Optional[_T]], __sentinel: None) -> Iterator[_T]: ...
def iter(__function: Callable[[], _T | None], __sentinel: None) -> Iterator[_T]: ...
@overload
def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ...
def isinstance(__obj: object, __class_or_tuple: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def issubclass(__cls: type, __class_or_tuple: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def isinstance(__obj: object, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ...
def issubclass(__cls: type, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ...
def len(__obj: Sized) -> int: ...
def locals() -> Dict[str, Any]: ...
@overload
@@ -966,15 +952,13 @@ def min(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ...
@overload
def next(__i: Iterator[_T]) -> _T: ...
@overload
def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
def oct(__number: Union[int, _SupportsIndex]) -> str: ...
def open(name: Union[unicode, int], mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
def ord(__c: Union[Text, bytes]) -> int: ...
def next(__i: Iterator[_T], default: _VT) -> _T | _VT: ...
def oct(__number: int | _SupportsIndex) -> str: ...
def open(name: unicode | int, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
def ord(__c: Text | bytes) -> int: ...
# This is only available after from __future__ import print_function.
def print(
*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[SupportsWrite[Any]] = ...
) -> None: ...
def print(*values: object, sep: Text | None = ..., end: Text | None = ..., file: SupportsWrite[Any] | None = ...) -> None: ...
_E = TypeVar("_E", contravariant=True)
_M = TypeVar("_M", contravariant=True)
@@ -1018,12 +1002,12 @@ def round(number: SupportsFloat) -> float: ...
def round(number: SupportsFloat, ndigits: int) -> float: ...
def setattr(__obj: Any, __name: Text, __value: Any) -> None: ...
def sorted(
__iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...
__iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Callable[[_T], Any] | None = ..., reverse: bool = ...
) -> List[_T]: ...
@overload
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
def sum(__iterable: Iterable[_T]) -> _T | int: ...
@overload
def sum(__iterable: Iterable[_T], __start: _S) -> Union[_T, _S]: ...
def sum(__iterable: Iterable[_T], __start: _S) -> _T | _S: ...
def unichr(__i: int) -> unicode: ...
def vars(__object: Any = ...) -> Dict[str, Any]: ...
@overload
@@ -1052,8 +1036,8 @@ def zip(
) -> List[Tuple[Any, ...]]: ...
def __import__(
name: Text,
globals: Optional[Mapping[str, Any]] = ...,
locals: Optional[Mapping[str, Any]] = ...,
globals: Mapping[str, Any] | None = ...,
locals: Mapping[str, Any] | None = ...,
fromlist: Sequence[str] = ...,
level: int = ...,
) -> Any: ...
@@ -1071,7 +1055,7 @@ class buffer(Sized):
def __init__(self, object: _AnyBuffer, offset: int = ..., size: int = ...) -> None: ...
def __add__(self, other: _AnyBuffer) -> str: ...
def __cmp__(self, other: _AnyBuffer) -> bool: ...
def __getitem__(self, key: Union[int, slice]) -> str: ...
def __getitem__(self, key: int | slice) -> str: ...
def __getslice__(self, i: int, j: int) -> str: ...
def __len__(self) -> int: ...
def __mul__(self, x: int) -> str: ...
@@ -1119,10 +1103,10 @@ class RuntimeError(_StandardError): ...
class SyntaxError(_StandardError):
msg: str
lineno: Optional[int]
offset: Optional[int]
text: Optional[str]
filename: Optional[str]
lineno: int | None
offset: int | None
text: str | None
filename: str | None
class SystemError(_StandardError): ...
class TypeError(_StandardError): ...
@@ -1181,9 +1165,7 @@ class file(BinaryIO):
def next(self) -> str: ...
def read(self, n: int = ...) -> str: ...
def __enter__(self) -> BinaryIO: ...
def __exit__(
self, t: Optional[type] = ..., exc: Optional[BaseException] = ..., tb: Optional[Any] = ...
) -> Optional[bool]: ...
def __exit__(self, t: type | None = ..., exc: BaseException | None = ..., tb: Any | None = ...) -> bool | None: ...
def flush(self) -> None: ...
def fileno(self) -> int: ...
def isatty(self) -> bool: ...
@@ -1197,4 +1179,4 @@ class file(BinaryIO):
def readlines(self, hint: int = ...) -> List[str]: ...
def write(self, data: str) -> int: ...
def writelines(self, data: Iterable[str]) -> None: ...
def truncate(self, pos: Optional[int] = ...) -> int: ...
def truncate(self, pos: int | None = ...) -> int: ...

View File

@@ -1,5 +1,4 @@
import typing
from typing import Optional
__version__: str
PyCF_ONLY_AST: int
@@ -41,7 +40,7 @@ class ClassDef(stmt):
decorator_list: typing.List[expr]
class Return(stmt):
value: Optional[expr]
value: expr | None
class Delete(stmt):
targets: typing.List[expr]
@@ -56,7 +55,7 @@ class AugAssign(stmt):
value: expr
class Print(stmt):
dest: Optional[expr]
dest: expr | None
values: typing.List[expr]
nl: bool
@@ -78,13 +77,13 @@ class If(stmt):
class With(stmt):
context_expr: expr
optional_vars: Optional[expr]
optional_vars: expr | None
body: typing.List[stmt]
class Raise(stmt):
type: Optional[expr]
inst: Optional[expr]
tback: Optional[expr]
type: expr | None
inst: expr | None
tback: expr | None
class TryExcept(stmt):
body: typing.List[stmt]
@@ -97,20 +96,20 @@ class TryFinally(stmt):
class Assert(stmt):
test: expr
msg: Optional[expr]
msg: expr | None
class Import(stmt):
names: typing.List[alias]
class ImportFrom(stmt):
module: Optional[_identifier]
module: _identifier | None
names: typing.List[alias]
level: Optional[int]
level: int | None
class Exec(stmt):
body: expr
globals: Optional[expr]
locals: Optional[expr]
globals: expr | None
locals: expr | None
class Global(stmt):
names: typing.List[_identifier]
@@ -126,9 +125,9 @@ class slice(AST): ...
_slice = slice # this lets us type the variable named 'slice' below
class Slice(slice):
lower: Optional[expr]
upper: Optional[expr]
step: Optional[expr]
lower: expr | None
upper: expr | None
step: expr | None
class ExtSlice(slice):
dims: typing.List[slice]
@@ -189,7 +188,7 @@ class GeneratorExp(expr):
generators: typing.List[comprehension]
class Yield(expr):
value: Optional[expr]
value: expr | None
class Compare(expr):
left: expr
@@ -200,8 +199,8 @@ class Call(expr):
func: expr
args: typing.List[expr]
keywords: typing.List[keyword]
starargs: Optional[expr]
kwargs: Optional[expr]
starargs: expr | None
kwargs: expr | None
class Repr(expr):
value: expr
@@ -282,16 +281,16 @@ class comprehension(AST):
class excepthandler(AST): ...
class ExceptHandler(excepthandler):
type: Optional[expr]
name: Optional[expr]
type: expr | None
name: expr | None
body: typing.List[stmt]
lineno: int
col_offset: int
class arguments(AST):
args: typing.List[expr]
vararg: Optional[_identifier]
kwarg: Optional[_identifier]
vararg: _identifier | None
kwarg: _identifier | None
defaults: typing.List[expr]
class keyword(AST):
@@ -300,4 +299,4 @@ class keyword(AST):
class alias(AST):
name: _identifier
asname: Optional[_identifier]
asname: _identifier | None

View File

@@ -1,8 +1,8 @@
from typing import MutableSequence, Optional, Sequence, TypeVar
from typing import MutableSequence, Sequence, TypeVar
_T = TypeVar("_T")
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> int: ...
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> int: ...
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> None: ...
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> None: ...
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> int: ...
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> int: ...
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> None: ...
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ...) -> None: ...

View File

@@ -1,6 +1,6 @@
import codecs
import sys
from typing import Any, Callable, Dict, Optional, Text, Tuple, Union
from typing import Any, Callable, Dict, Text, Tuple, Union
# For convenience:
_Handler = Callable[[Exception], Tuple[Text, int]]
@@ -16,17 +16,17 @@ class _EncodingMap(object):
_MapT = Union[Dict[int, int], _EncodingMap]
def register(__search_function: Callable[[str], Any]) -> None: ...
def register_error(__errors: Union[str, Text], __handler: _Handler) -> None: ...
def lookup(__encoding: Union[str, Text]) -> codecs.CodecInfo: ...
def lookup_error(__name: Union[str, Text]) -> _Handler: ...
def decode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ...
def encode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ...
def register_error(__errors: str | Text, __handler: _Handler) -> None: ...
def lookup(__encoding: str | Text) -> codecs.CodecInfo: ...
def lookup_error(__name: str | Text) -> _Handler: ...
def decode(obj: Any, encoding: str | Text = ..., errors: _Errors = ...) -> Any: ...
def encode(obj: Any, encoding: str | Text = ..., errors: _Errors = ...) -> Any: ...
def charmap_build(__map: Text) -> _MapT: ...
def ascii_decode(__data: _Decodable, __errors: _Errors = ...) -> Tuple[Text, int]: ...
def ascii_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def charbuffer_encode(__data: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def charmap_decode(__data: _Decodable, __errors: _Errors = ..., __mapping: Optional[_MapT] = ...) -> Tuple[Text, int]: ...
def charmap_encode(__str: _Encodable, __errors: _Errors = ..., __mapping: Optional[_MapT] = ...) -> Tuple[bytes, int]: ...
def charmap_decode(__data: _Decodable, __errors: _Errors = ..., __mapping: _MapT | None = ...) -> Tuple[Text, int]: ...
def charmap_encode(__str: _Encodable, __errors: _Errors = ..., __mapping: _MapT | None = ...) -> Tuple[bytes, int]: ...
def escape_decode(__data: _String, __errors: _Errors = ...) -> Tuple[str, int]: ...
def escape_encode(__data: bytes, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def latin_1_decode(__data: _Decodable, __errors: _Errors = ...) -> Tuple[Text, int]: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, Generic, Iterator, Optional, TypeVar, Union
from typing import Any, Callable, Dict, Generic, Iterator, TypeVar
_K = TypeVar("_K")
_V = TypeVar("_V")
@@ -13,7 +13,7 @@ class defaultdict(Dict[_K, _V]):
def copy(self: _T) -> _T: ...
class deque(Generic[_T]):
maxlen: Optional[int]
maxlen: int | None
def __init__(self, iterable: Iterator[_T] = ..., maxlen: int = ...) -> None: ...
def append(self, x: _T) -> None: ...
def appendleft(self, x: _T) -> None: ...
@@ -29,7 +29,7 @@ class deque(Generic[_T]):
def __contains__(self, o: Any) -> bool: ...
def __copy__(self) -> deque[_T]: ...
def __getitem__(self, i: int) -> _T: ...
def __iadd__(self, other: deque[_T2]) -> deque[Union[_T, _T2]]: ...
def __iadd__(self, other: deque[_T2]) -> deque[_T | _T2]: ...
def __iter__(self) -> Iterator[_T]: ...
def __len__(self) -> int: ...
def __reversed__(self) -> Iterator[_T]: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Iterable, Iterator, List, Optional, Protocol, Sequence, Text, Type, Union
from typing import Any, Iterable, Iterator, List, Protocol, Sequence, Text, Type, Union
QUOTE_ALL: int
QUOTE_MINIMAL: int
@@ -9,8 +9,8 @@ class Error(Exception): ...
class Dialect:
delimiter: str
quotechar: Optional[str]
escapechar: Optional[str]
quotechar: str | None
escapechar: str | None
doublequote: bool
skipinitialspace: bool
lineterminator: str

View File

@@ -1,4 +1,4 @@
from typing import IO, Any, BinaryIO, Optional, Tuple, Union, overload
from typing import IO, Any, BinaryIO, Tuple, Union, overload
_chtype = Union[str, bytes, int]
@@ -319,7 +319,7 @@ def resize_term(__nlines: int, __ncols: int) -> None: ...
def resizeterm(__nlines: int, __ncols: int) -> None: ...
def savetty() -> None: ...
def setsyx(__y: int, __x: int) -> None: ...
def setupterm(term: Optional[str] = ..., fd: int = ...) -> None: ...
def setupterm(term: str | None = ..., fd: int = ...) -> None: ...
def start_color() -> None: ...
def termattrs() -> int: ...
def termname() -> bytes: ...

View File

@@ -1,5 +1,5 @@
from types import FrameType, TracebackType
from typing import Any, Callable, Iterable, List, Mapping, Optional, Text, Type, TypeVar, Union
from typing import Any, Callable, Iterable, List, Mapping, Optional, Text, Type, TypeVar
# TODO recursive type
_TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
@@ -15,7 +15,7 @@ def current_thread() -> Thread: ...
def currentThread() -> Thread: ...
def enumerate() -> List[Thread]: ...
def settrace(func: _TF) -> None: ...
def setprofile(func: Optional[_PF]) -> None: ...
def setprofile(func: _PF | None) -> None: ...
def stack_size(size: int = ...) -> int: ...
class ThreadError(Exception): ...
@@ -27,19 +27,19 @@ class local(object):
class Thread:
name: str
ident: Optional[int]
ident: int | None
daemon: bool
def __init__(
self,
group: None = ...,
target: Optional[Callable[..., Any]] = ...,
name: Optional[Text] = ...,
target: Callable[..., Any] | None = ...,
name: Text | None = ...,
args: Iterable[Any] = ...,
kwargs: Optional[Mapping[Text, Any]] = ...,
kwargs: Mapping[Text, Any] | None = ...,
) -> None: ...
def start(self) -> None: ...
def run(self) -> None: ...
def join(self, timeout: Optional[float] = ...) -> None: ...
def join(self, timeout: float | None = ...) -> None: ...
def getName(self) -> str: ...
def setName(self, name: Text) -> None: ...
def is_alive(self) -> bool: ...
@@ -53,8 +53,8 @@ class Lock:
def __init__(self) -> None: ...
def __enter__(self) -> bool: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> bool | None: ...
def acquire(self, blocking: bool = ...) -> bool: ...
def release(self) -> None: ...
def locked(self) -> bool: ...
@@ -63,22 +63,22 @@ class _RLock:
def __init__(self) -> None: ...
def __enter__(self) -> bool: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> bool | None: ...
def acquire(self, blocking: bool = ...) -> bool: ...
def release(self) -> None: ...
RLock = _RLock
class Condition:
def __init__(self, lock: Union[Lock, _RLock, None] = ...) -> None: ...
def __init__(self, lock: Lock | _RLock | None = ...) -> None: ...
def __enter__(self) -> bool: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> bool | None: ...
def acquire(self, blocking: bool = ...) -> bool: ...
def release(self) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> bool: ...
def wait(self, timeout: float | None = ...) -> bool: ...
def notify(self, n: int = ...) -> None: ...
def notify_all(self) -> None: ...
def notifyAll(self) -> None: ...
@@ -86,8 +86,8 @@ class Condition:
class Semaphore:
def __init__(self, value: int = ...) -> None: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> bool | None: ...
def acquire(self, blocking: bool = ...) -> bool: ...
def __enter__(self, blocking: bool = ...) -> bool: ...
def release(self) -> None: ...
@@ -100,7 +100,7 @@ class Event:
def isSet(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> bool: ...
def wait(self, timeout: float | None = ...) -> bool: ...
class Timer(Thread):
def __init__(

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Iterable, List, Optional, TypeVar
from typing import Any, Callable, Iterable, List, TypeVar
_T = TypeVar("_T")
@@ -7,5 +7,5 @@ def heappop(__heap: List[_T]) -> _T: ...
def heappush(__heap: List[_T], __item: _T) -> None: ...
def heappushpop(__heap: List[_T], __item: _T) -> _T: ...
def heapreplace(__heap: List[_T], __item: _T) -> _T: ...
def nlargest(__n: int, __iterable: Iterable[_T], __key: Optional[Callable[[_T], Any]] = ...) -> List[_T]: ...
def nsmallest(__n: int, __iterable: Iterable[_T], __key: Optional[Callable[[_T], Any]] = ...) -> List[_T]: ...
def nlargest(__n: int, __iterable: Iterable[_T], __key: Callable[[_T], Any] | None = ...) -> List[_T]: ...
def nsmallest(__n: int, __iterable: Iterable[_T], __key: Callable[[_T], Any] | None = ...) -> List[_T]: ...

View File

@@ -1,6 +1,6 @@
from _typeshed import Self
from mmap import mmap
from typing import IO, Any, BinaryIO, Iterable, List, Optional, Text, TextIO, Tuple, Type, TypeVar, Union
from typing import IO, Any, BinaryIO, Iterable, List, Text, TextIO, Tuple, Type, TypeVar, Union
_bytearray_like = Union[bytearray, mmap]
@@ -16,7 +16,7 @@ _T = TypeVar("_T")
class _IOBase(BinaryIO):
@property
def closed(self) -> bool: ...
def _checkClosed(self, msg: Optional[str] = ...) -> None: ... # undocumented
def _checkClosed(self, msg: str | None = ...) -> None: ... # undocumented
def _checkReadable(self) -> None: ...
def _checkSeekable(self) -> None: ...
def _checkWritable(self) -> None: ...
@@ -29,12 +29,10 @@ class _IOBase(BinaryIO):
def seek(self, offset: int, whence: int = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def truncate(self, size: int | None = ...) -> int: ...
def writable(self) -> bool: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]
) -> Optional[bool]: ...
def __exit__(self, t: Type[BaseException] | None, value: BaseException | None, traceback: Any | None) -> bool | None: ...
def __iter__(self: _T) -> _T: ...
# The parameter type of writelines[s]() is determined by that of write():
def writelines(self, lines: Iterable[bytes]) -> None: ...
@@ -100,12 +98,12 @@ class _RawIOBase(_IOBase):
class FileIO(_RawIOBase, BytesIO):
mode: str
closefd: bool
def __init__(self, file: Union[str, int], mode: str = ..., closefd: bool = ...) -> None: ...
def __init__(self, file: str | int, mode: str = ..., closefd: bool = ...) -> None: ...
def readinto(self, buffer: _bytearray_like) -> int: ...
def write(self, pbuf: str) -> int: ...
class IncrementalNewlineDecoder(object):
newlines: Union[str, unicode]
newlines: str | unicode
def __init__(self, decoder, translate, z=...) -> None: ...
def decode(self, input, final) -> Any: ...
def getstate(self) -> Tuple[Any, int]: ...
@@ -114,9 +112,9 @@ class IncrementalNewlineDecoder(object):
# Note: In the actual _io.py, _TextIOBase inherits from _IOBase.
class _TextIOBase(TextIO):
errors: Optional[str]
errors: str | None
# TODO: On _TextIOBase, this is always None. But it's unicode/bytes in subclasses.
newlines: Union[None, unicode, bytes]
newlines: None | unicode | bytes
encoding: str
@property
def closed(self) -> bool: ...
@@ -137,19 +135,17 @@ class _TextIOBase(TextIO):
def seek(self, offset: int, whence: int = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def truncate(self, size: int | None = ...) -> int: ...
def writable(self) -> bool: ...
def write(self, pbuf: unicode) -> int: ...
def writelines(self, lines: Iterable[unicode]) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]
) -> Optional[bool]: ...
def __exit__(self, t: Type[BaseException] | None, value: BaseException | None, traceback: Any | None) -> bool | None: ...
def __iter__(self: _T) -> _T: ...
class StringIO(_TextIOBase):
line_buffering: bool
def __init__(self, initial_value: Optional[unicode] = ..., newline: Optional[unicode] = ...) -> None: ...
def __init__(self, initial_value: unicode | None = ..., newline: unicode | None = ...) -> None: ...
def __setstate__(self, state: Tuple[Any, ...]) -> None: ...
def __getstate__(self) -> Tuple[Any, ...]: ...
# StringIO does not contain a "name" field. This workaround is necessary
@@ -166,19 +162,19 @@ class TextIOWrapper(_TextIOBase):
def __init__(
self,
buffer: IO[Any],
encoding: Optional[Text] = ...,
errors: Optional[Text] = ...,
newline: Optional[Text] = ...,
encoding: Text | None = ...,
errors: Text | None = ...,
newline: Text | None = ...,
line_buffering: bool = ...,
write_through: bool = ...,
) -> None: ...
def open(
file: Union[str, unicode, int],
file: str | unicode | int,
mode: Text = ...,
buffering: int = ...,
encoding: Optional[Text] = ...,
errors: Optional[Text] = ...,
newline: Optional[Text] = ...,
encoding: Text | None = ...,
errors: Text | None = ...,
newline: Text | None = ...,
closefd: bool = ...,
) -> IO[Any]: ...

View File

@@ -1,11 +1,11 @@
import sys
from typing import List, Optional, Union
from typing import List
if sys.platform == "win32":
# Actual typename View, not exposed by the implementation
class _View:
def Execute(self, params: Optional[_Record] = ...) -> None: ...
def Execute(self, params: _Record | None = ...) -> None: ...
def GetColumnInfo(self, kind: int) -> _Record: ...
def Fetch(self) -> _Record: ...
def Modify(self, mode: int, record: _Record) -> None: ...
@@ -15,9 +15,9 @@ if sys.platform == "win32":
__init__: None # type: ignore
# Actual typename Summary, not exposed by the implementation
class _Summary:
def GetProperty(self, propid: int) -> Optional[Union[str, bytes]]: ...
def GetProperty(self, propid: int) -> str | bytes | None: ...
def GetPropertyCount(self) -> int: ...
def SetProperty(self, propid: int, value: Union[str, bytes]) -> None: ...
def SetProperty(self, propid: int, value: str | bytes) -> None: ...
def Persist(self) -> None: ...
# Don't exist at runtime
__new__: None # type: ignore

View File

@@ -1,4 +1,4 @@
from typing import Dict, Iterable, List, Optional, Sequence, Tuple, TypeVar, Union
from typing import Dict, Iterable, List, Sequence, Tuple, TypeVar
_T = TypeVar("_T")
_K = TypeVar("_K")
@@ -10,11 +10,11 @@ _UNIVERSAL_CONFIG_VARS: Tuple[str, ...] # undocumented
_COMPILER_CONFIG_VARS: Tuple[str, ...] # undocumented
_INITPRE: str # undocumented
def _find_executable(executable: str, path: Optional[str] = ...) -> Optional[str]: ... # undocumented
def _read_output(commandstring: str) -> Optional[str]: ... # undocumented
def _find_executable(executable: str, path: str | None = ...) -> str | None: ... # undocumented
def _read_output(commandstring: str) -> str | None: ... # undocumented
def _find_build_tool(toolname: str) -> str: ... # undocumented
_SYSTEM_VERSION: Optional[str] # undocumented
_SYSTEM_VERSION: str | None # undocumented
def _get_system_version() -> str: ... # undocumented
def _remove_original_values(_config_vars: Dict[str, str]) -> None: ... # undocumented
@@ -30,4 +30,4 @@ def customize_config_vars(_config_vars: Dict[str, str]) -> Dict[str, str]: ...
def customize_compiler(_config_vars: Dict[str, str]) -> Dict[str, str]: ...
def get_platform_osx(
_config_vars: Dict[str, str], osname: _T, release: _K, machine: _V
) -> Tuple[Union[str, _T], Union[str, _K], Union[str, _V]]: ...
) -> Tuple[str | _T, str | _K, str | _V]: ...

View File

@@ -1,11 +1,9 @@
from typing import Optional
class sha224(object):
name: str
block_size: int
digest_size: int
digestsize: int
def __init__(self, init: Optional[str]) -> None: ...
def __init__(self, init: str | None) -> None: ...
def copy(self) -> sha224: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
@@ -16,7 +14,7 @@ class sha256(object):
block_size: int
digest_size: int
digestsize: int
def __init__(self, init: Optional[str]) -> None: ...
def __init__(self, init: str | None) -> None: ...
def copy(self) -> sha256: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...

View File

@@ -1,11 +1,9 @@
from typing import Optional
class sha384(object):
name: str
block_size: int
digest_size: int
digestsize: int
def __init__(self, init: Optional[str]) -> None: ...
def __init__(self, init: str | None) -> None: ...
def copy(self) -> sha384: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
@@ -16,7 +14,7 @@ class sha512(object):
block_size: int
digest_size: int
digestsize: int
def __init__(self, init: Optional[str]) -> None: ...
def __init__(self, init: str | None) -> None: ...
def copy(self) -> sha512: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...

View File

@@ -1,4 +1,4 @@
from typing import IO, Any, Optional, Tuple, Union, overload
from typing import IO, Any, Tuple, overload
AF_APPLETALK: int
AF_ASH: int
@@ -276,6 +276,6 @@ class SocketType(object):
@overload
def sendto(self, data: str, flags: int, address: Tuple[Any, ...]) -> int: ...
def setblocking(self, flag: bool) -> None: ...
def setsockopt(self, level: int, option: int, value: Union[int, str]) -> None: ...
def settimeout(self, value: Optional[float]) -> None: ...
def setsockopt(self, level: int, option: int, value: int | str) -> None: ...
def settimeout(self, value: float | None) -> None: ...
def shutdown(self, flag: int) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union, overload
from typing import Any, Dict, Iterable, List, Mapping, Sequence, Tuple, overload
CODESIZE: int
MAGIC: int
@@ -12,9 +12,9 @@ class SRE_Match(object):
@overload
def group(self) -> str: ...
@overload
def group(self, group: int = ...) -> Optional[str]: ...
def groupdict(self) -> Dict[int, Optional[str]]: ...
def groups(self) -> Tuple[Optional[str], ...]: ...
def group(self, group: int = ...) -> str | None: ...
def groupdict(self) -> Dict[int, str | None]: ...
def groups(self) -> Tuple[str | None, ...]: ...
def span(self) -> Tuple[int, int]: ...
@property
def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented
@@ -30,12 +30,12 @@ class SRE_Pattern(object):
groups: int
groupindex: Mapping[str, int]
indexgroup: Sequence[int]
def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Union[Tuple[Any, ...], str]]: ...
def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Union[Tuple[Any, ...], str]]: ...
def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Tuple[Any, ...] | str]: ...
def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Tuple[Any, ...] | str]: ...
def match(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
def scanner(self, s: str, start: int = ..., end: int = ...) -> SRE_Scanner: ...
def search(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
def split(self, source: str, maxsplit: int = ...) -> List[Optional[str]]: ...
def split(self, source: str, maxsplit: int = ...) -> List[str | None]: ...
def sub(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...
def subn(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...

View File

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import Any, Callable, Dict, NoReturn, Optional, Tuple, Type
from typing import Any, Callable, Dict, NoReturn, Tuple, Type
error = RuntimeError
@@ -13,7 +13,7 @@ class LockType:
def locked(self) -> bool: ...
def __enter__(self) -> bool: ...
def __exit__(
self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]
self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> int: ...

View File

@@ -8,7 +8,7 @@ from typing import Any, Callable, Dict, Iterable, List, Optional, Protocol, Text
class StartResponse(Protocol):
def __call__(
self, status: str, headers: List[Tuple[str, str]], exc_info: Optional[_OptExcInfo] = ...
self, status: str, headers: List[Tuple[str, str]], exc_info: _OptExcInfo | None = ...
) -> Callable[[bytes], Any]: ...
WSGIEnvironment = Dict[Text, Any]

View File

@@ -1,10 +1,10 @@
# Stub-only types. This module does not exist at runtime.
from typing import Any, Optional
from typing import Any
from typing_extensions import Protocol
# As defined https://docs.python.org/3/library/xml.dom.html#domimplementation-objects
class DOMImplementation(Protocol):
def hasFeature(self, feature: str, version: Optional[str]) -> bool: ...
def createDocument(self, namespaceUri: str, qualifiedName: str, doctype: Optional[Any]) -> Any: ...
def hasFeature(self, feature: str, version: str | None) -> bool: ...
def createDocument(self, namespaceUri: str, qualifiedName: str, doctype: Any | None) -> Any: ...
def createDocumentType(self, qualifiedName: str, publicId: str, systemId: str) -> Any: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Optional, Tuple, Type, Union, overload
from typing import Any, Dict, List, Tuple, Type, overload
default_action: str
once_registry: Dict[Any, Any]
@@ -6,7 +6,7 @@ once_registry: Dict[Any, Any]
filters: List[Tuple[Any, ...]]
@overload
def warn(message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ...
def warn(message: str, category: Type[Warning] | None = ..., stacklevel: int = ...) -> None: ...
@overload
def warn(message: Warning, category: Any = ..., stacklevel: int = ...) -> None: ...
@overload
@@ -15,9 +15,9 @@ def warn_explicit(
category: Type[Warning],
filename: str,
lineno: int,
module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...,
module: str | None = ...,
registry: Dict[str | Tuple[str, Type[Warning], int], int] | None = ...,
module_globals: Dict[str, Any] | None = ...,
) -> None: ...
@overload
def warn_explicit(
@@ -25,7 +25,7 @@ def warn_explicit(
category: Any,
filename: str,
lineno: int,
module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...,
module: str | None = ...,
registry: Dict[str | Tuple[str, Type[Warning], int], int] | None = ...,
module_globals: Dict[str, Any] | None = ...,
) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Generic, List, Optional, TypeVar, overload
from typing import Any, Callable, Generic, List, TypeVar, overload
_C = TypeVar("_C", bound=Callable[..., Any])
_T = TypeVar("_T")
@@ -10,8 +10,8 @@ class ProxyType(Generic[_T]): # "weakproxy"
def __getattr__(self, attr: str) -> Any: ...
class ReferenceType(Generic[_T]):
def __init__(self, o: _T, callback: Optional[Callable[[ReferenceType[_T]], Any]] = ...) -> None: ...
def __call__(self) -> Optional[_T]: ...
def __init__(self, o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> None: ...
def __call__(self) -> _T | None: ...
def __hash__(self) -> int: ...
ref = ReferenceType
@@ -19,8 +19,8 @@ ref = ReferenceType
def getweakrefcount(__object: Any) -> int: ...
def getweakrefs(object: Any) -> List[Any]: ...
@overload
def proxy(object: _C, callback: Optional[Callable[[_C], Any]] = ...) -> CallableProxyType[_C]: ...
def proxy(object: _C, callback: Callable[[_C], Any] | None = ...) -> CallableProxyType[_C]: ...
# Return CallableProxyType if object is callable, ProxyType otherwise
@overload
def proxy(object: _T, callback: Optional[Callable[[_T], Any]] = ...) -> Any: ...
def proxy(object: _T, callback: Callable[[_T], Any] | None = ...) -> Any: ...

View File

@@ -1,11 +1,11 @@
from typing import Any, Generic, Iterable, Iterator, MutableSet, Optional, TypeVar, Union
from typing import Any, Generic, Iterable, Iterator, MutableSet, TypeVar
_S = TypeVar("_S")
_T = TypeVar("_T")
_SelfT = TypeVar("_SelfT", bound=WeakSet[Any])
class WeakSet(MutableSet[_T], Generic[_T]):
def __init__(self, data: Optional[Iterable[_T]] = ...) -> None: ...
def __init__(self, data: Iterable[_T] | None = ...) -> None: ...
def add(self, item: _T) -> None: ...
def clear(self) -> None: ...
def discard(self, item: _T) -> None: ...
@@ -16,7 +16,7 @@ class WeakSet(MutableSet[_T], Generic[_T]):
def __contains__(self, item: object) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __ior__(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
def __ior__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ...
def difference(self: _SelfT, other: Iterable[_T]) -> _SelfT: ...
def __sub__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ...
def difference_update(self, other: Iterable[_T]) -> None: ...
@@ -32,10 +32,10 @@ class WeakSet(MutableSet[_T], Generic[_T]):
def __ge__(self, other: Iterable[_T]) -> bool: ...
def __gt__(self, other: Iterable[_T]) -> bool: ...
def __eq__(self, other: object) -> bool: ...
def symmetric_difference(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
def __xor__(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
def symmetric_difference(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ...
def __xor__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ...
def symmetric_difference_update(self, other: Iterable[Any]) -> None: ...
def __ixor__(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
def union(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
def __or__(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
def __ixor__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ...
def union(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ...
def __or__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ...
def isdisjoint(self, other: Iterable[_T]) -> bool: ...

View File

@@ -1,12 +1,12 @@
from types import TracebackType
from typing import Any, Optional, Tuple, Type, Union
from typing import Any, Tuple, Type, Union
_KeyType = Union[HKEYType, int]
def CloseKey(__hkey: _KeyType) -> None: ...
def ConnectRegistry(__computer_name: Optional[str], __key: _KeyType) -> HKEYType: ...
def CreateKey(__key: _KeyType, __sub_key: Optional[str]) -> HKEYType: ...
def CreateKeyEx(key: _KeyType, sub_key: Optional[str], reserved: int = ..., access: int = ...) -> HKEYType: ...
def ConnectRegistry(__computer_name: str | None, __key: _KeyType) -> HKEYType: ...
def CreateKey(__key: _KeyType, __sub_key: str | None) -> HKEYType: ...
def CreateKeyEx(key: _KeyType, sub_key: str | None, reserved: int = ..., access: int = ...) -> HKEYType: ...
def DeleteKey(__key: _KeyType, __sub_key: str) -> None: ...
def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = ..., reserved: int = ...) -> None: ...
def DeleteValue(__key: _KeyType, __value: str) -> None: ...
@@ -18,12 +18,12 @@ def LoadKey(__key: _KeyType, __sub_key: str, __file_name: str) -> None: ...
def OpenKey(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ...
def OpenKeyEx(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ...
def QueryInfoKey(__key: _KeyType) -> Tuple[int, int, int]: ...
def QueryValue(__key: _KeyType, __sub_key: Optional[str]) -> str: ...
def QueryValue(__key: _KeyType, __sub_key: str | None) -> str: ...
def QueryValueEx(__key: _KeyType, __name: str) -> Tuple[Any, int]: ...
def SaveKey(__key: _KeyType, __file_name: str) -> None: ...
def SetValue(__key: _KeyType, __sub_key: str, __type: int, __value: str) -> None: ...
def SetValueEx(
__key: _KeyType, __value_name: Optional[str], __reserved: Any, __type: int, __value: Union[str, int]
__key: _KeyType, __value_name: str | None, __reserved: Any, __type: int, __value: str | int
) -> None: ... # reserved is ignored
def DisableReflectionKey(__key: _KeyType) -> None: ...
def EnableReflectionKey(__key: _KeyType) -> None: ...
@@ -90,7 +90,7 @@ class HKEYType:
def __int__(self) -> int: ...
def __enter__(self) -> HKEYType: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> bool | None: ...
def Close(self) -> None: ...
def Detach(self) -> int: ...

View File

@@ -1,4 +1,4 @@
from typing import IO, Any, List, NamedTuple, Optional, Text, Tuple, Union, overload
from typing import IO, Any, List, NamedTuple, Text, Tuple, Union, overload
from typing_extensions import Literal
class Error(Exception): ...
@@ -28,7 +28,7 @@ class Aifc_read:
def getcomptype(self) -> bytes: ...
def getcompname(self) -> bytes: ...
def getparams(self) -> _aifc_params: ...
def getmarkers(self) -> Optional[List[_Marker]]: ...
def getmarkers(self) -> List[_Marker] | None: ...
def getmark(self, id: int) -> _Marker: ...
def setpos(self, pos: int) -> None: ...
def readframes(self, nframes: int) -> bytes: ...
@@ -54,7 +54,7 @@ class Aifc_write:
def getparams(self) -> _aifc_params: ...
def setmark(self, id: int, pos: int, name: bytes) -> None: ...
def getmark(self, id: int) -> _Marker: ...
def getmarkers(self) -> Optional[List[_Marker]]: ...
def getmarkers(self) -> List[_Marker] | None: ...
def tell(self) -> int: ...
def writeframesraw(self, data: Any) -> None: ... # Actual type for data is Buffer Protocol
def writeframes(self, data: Any) -> None: ...
@@ -65,10 +65,10 @@ def open(f: _File, mode: Literal["r", "rb"]) -> Aifc_read: ...
@overload
def open(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ...
@overload
def open(f: _File, mode: Optional[str] = ...) -> Any: ...
def open(f: _File, mode: str | None = ...) -> Any: ...
@overload
def openfp(f: _File, mode: Literal["r", "rb"]) -> Aifc_read: ...
@overload
def openfp(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ...
@overload
def openfp(f: _File, mode: Optional[str] = ...) -> Any: ...
def openfp(f: _File, mode: str | None = ...) -> Any: ...

View File

@@ -7,7 +7,6 @@ from typing import (
Iterable,
List,
NoReturn,
Optional,
Pattern,
Protocol,
Sequence,
@@ -34,9 +33,9 @@ ZERO_OR_MORE: str
_UNRECOGNIZED_ARGS_ATTR: str # undocumented
class ArgumentError(Exception):
argument_name: Optional[str]
argument_name: str | None
message: str
def __init__(self, argument: Optional[Action], message: str) -> None: ...
def __init__(self, argument: Action | None, message: str) -> None: ...
# undocumented
class _AttributeHolder:
@@ -45,7 +44,7 @@ class _AttributeHolder:
# undocumented
class _ActionsContainer:
description: Optional[_Text]
description: _Text | None
prefix_chars: _Text
argument_default: Any
conflict_handler: _Text
@@ -58,9 +57,7 @@ class _ActionsContainer:
_defaults: Dict[str, Any]
_negative_number_matcher: Pattern[str]
_has_negative_number_optionals: List[bool]
def __init__(
self, description: Optional[Text], prefix_chars: Text, argument_default: Any, conflict_handler: Text
) -> None: ...
def __init__(self, description: Text | None, prefix_chars: Text, argument_default: Any, conflict_handler: Text) -> None: ...
def register(self, registry_name: Text, value: Any, object: Any) -> None: ...
def _registry_get(self, registry_name: Text, value: Any, default: Any = ...) -> Any: ...
def set_defaults(self, **kwargs: Any) -> None: ...
@@ -68,16 +65,16 @@ class _ActionsContainer:
def add_argument(
self,
*name_or_flags: Text,
action: Union[Text, Type[Action]] = ...,
nargs: Union[int, Text] = ...,
action: Text | Type[Action] = ...,
nargs: int | Text = ...,
const: Any = ...,
default: Any = ...,
type: Union[Callable[[Text], _T], Callable[[str], _T], FileType] = ...,
type: Callable[[Text], _T] | Callable[[str], _T] | FileType = ...,
choices: Iterable[_T] = ...,
required: bool = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
dest: Optional[Text] = ...,
help: Text | None = ...,
metavar: Text | Tuple[Text, ...] | None = ...,
dest: Text | None = ...,
version: Text = ...,
**kwargs: Any,
) -> Action: ...
@@ -88,7 +85,7 @@ class _ActionsContainer:
def _add_container_actions(self, container: _ActionsContainer) -> None: ...
def _get_positional_kwargs(self, dest: Text, **kwargs: Any) -> Dict[str, Any]: ...
def _get_optional_kwargs(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ...
def _pop_action_class(self, kwargs: Any, default: Optional[Type[Action]] = ...) -> Type[Action]: ...
def _pop_action_class(self, kwargs: Any, default: Type[Action] | None = ...) -> Type[Action]: ...
def _get_handler(self) -> Callable[[Action, Iterable[Tuple[Text, Action]]], Any]: ...
def _check_conflict(self, action: Action) -> None: ...
def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[Tuple[Text, Action]]) -> NoReturn: ...
@@ -99,26 +96,26 @@ class _FormatterClass(Protocol):
class ArgumentParser(_AttributeHolder, _ActionsContainer):
prog: _Text
usage: Optional[_Text]
epilog: Optional[_Text]
usage: _Text | None
epilog: _Text | None
formatter_class: _FormatterClass
fromfile_prefix_chars: Optional[_Text]
fromfile_prefix_chars: _Text | None
add_help: bool
# undocumented
_positionals: _ArgumentGroup
_optionals: _ArgumentGroup
_subparsers: Optional[_ArgumentGroup]
_subparsers: _ArgumentGroup | None
def __init__(
self,
prog: Optional[Text] = ...,
usage: Optional[Text] = ...,
description: Optional[Text] = ...,
epilog: Optional[Text] = ...,
prog: Text | None = ...,
usage: Text | None = ...,
description: Text | None = ...,
epilog: Text | None = ...,
parents: Sequence[ArgumentParser] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: Text = ...,
fromfile_prefix_chars: Optional[Text] = ...,
fromfile_prefix_chars: Text | None = ...,
argument_default: Any = ...,
conflict_handler: Text = ...,
add_help: bool = ...,
@@ -126,11 +123,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
# The type-ignores in these overloads should be temporary. See:
# https://github.com/python/typeshed/pull/2643#issuecomment-442280277
@overload
def parse_args(self, args: Optional[Sequence[Text]] = ...) -> Namespace: ...
def parse_args(self, args: Sequence[Text] | None = ...) -> Namespace: ...
@overload
def parse_args(self, args: Optional[Sequence[Text]], namespace: None) -> Namespace: ... # type: ignore
def parse_args(self, args: Sequence[Text] | None, namespace: None) -> Namespace: ... # type: ignore
@overload
def parse_args(self, args: Optional[Sequence[Text]], namespace: _N) -> _N: ...
def parse_args(self, args: Sequence[Text] | None, namespace: _N) -> _N: ...
@overload
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore
@overload
@@ -139,24 +136,24 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
self,
*,
title: Text = ...,
description: Optional[Text] = ...,
description: Text | None = ...,
prog: Text = ...,
parser_class: Type[ArgumentParser] = ...,
action: Type[Action] = ...,
option_string: Text = ...,
dest: Optional[Text] = ...,
help: Optional[Text] = ...,
metavar: Optional[Text] = ...,
dest: Text | None = ...,
help: Text | None = ...,
metavar: Text | None = ...,
) -> _SubParsersAction: ...
def print_usage(self, file: Optional[IO[str]] = ...) -> None: ...
def print_help(self, file: Optional[IO[str]] = ...) -> None: ...
def print_usage(self, file: IO[str] | None = ...) -> None: ...
def print_help(self, file: IO[str] | None = ...) -> None: ...
def format_usage(self) -> str: ...
def format_help(self) -> str: ...
def parse_known_args(
self, args: Optional[Sequence[Text]] = ..., namespace: Optional[Namespace] = ...
self, args: Sequence[Text] | None = ..., namespace: Namespace | None = ...
) -> Tuple[Namespace, List[str]]: ...
def convert_arg_line_to_args(self, arg_line: Text) -> List[str]: ...
def exit(self, status: int = ..., message: Optional[Text] = ...) -> NoReturn: ...
def exit(self, status: int = ..., message: Text | None = ...) -> NoReturn: ...
def error(self, message: Text) -> NoReturn: ...
# undocumented
def _get_optional_actions(self) -> List[Action]: ...
@@ -165,14 +162,14 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
def _read_args_from_files(self, arg_strings: List[Text]) -> List[Text]: ...
def _match_argument(self, action: Action, arg_strings_pattern: Text) -> int: ...
def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: Text) -> List[int]: ...
def _parse_optional(self, arg_string: Text) -> Optional[Tuple[Optional[Action], Text, Optional[Text]]]: ...
def _get_option_tuples(self, option_string: Text) -> List[Tuple[Action, Text, Optional[Text]]]: ...
def _parse_optional(self, arg_string: Text) -> Tuple[Action | None, Text, Text | None] | None: ...
def _get_option_tuples(self, option_string: Text) -> List[Tuple[Action, Text, Text | None]]: ...
def _get_nargs_pattern(self, action: Action) -> _Text: ...
def _get_values(self, action: Action, arg_strings: List[Text]) -> Any: ...
def _get_value(self, action: Action, arg_string: Text) -> Any: ...
def _check_value(self, action: Action, value: Any) -> None: ...
def _get_formatter(self) -> HelpFormatter: ...
def _print_message(self, message: str, file: Optional[IO[str]] = ...) -> None: ...
def _print_message(self, message: str, file: IO[str] | None = ...) -> None: ...
class HelpFormatter:
# undocumented
@@ -189,23 +186,23 @@ class HelpFormatter:
_long_break_matcher: Pattern[str]
_Section: Type[Any] # Nested class
def __init__(
self, prog: Text, indent_increment: int = ..., max_help_position: int = ..., width: Optional[int] = ...
self, prog: Text, indent_increment: int = ..., max_help_position: int = ..., width: int | None = ...
) -> None: ...
def _indent(self) -> None: ...
def _dedent(self) -> None: ...
def _add_item(self, func: Callable[..., _Text], args: Iterable[Any]) -> None: ...
def start_section(self, heading: Optional[Text]) -> None: ...
def start_section(self, heading: Text | None) -> None: ...
def end_section(self) -> None: ...
def add_text(self, text: Optional[Text]) -> None: ...
def add_text(self, text: Text | None) -> None: ...
def add_usage(
self, usage: Optional[Text], actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[Text] = ...
self, usage: Text | None, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Text | None = ...
) -> None: ...
def add_argument(self, action: Action) -> None: ...
def add_arguments(self, actions: Iterable[Action]) -> None: ...
def format_help(self) -> _Text: ...
def _join_parts(self, part_strings: Iterable[Text]) -> _Text: ...
def _format_usage(
self, usage: Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[Text]
self, usage: Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Text | None
) -> _Text: ...
def _format_actions_usage(self, actions: Iterable[Action], groups: Iterable[_ArgumentGroup]) -> _Text: ...
def _format_text(self, text: Text) -> _Text: ...
@@ -217,7 +214,7 @@ class HelpFormatter:
def _iter_indented_subactions(self, action: Action) -> Generator[Action, None, None]: ...
def _split_lines(self, text: Text, width: int) -> List[_Text]: ...
def _fill_text(self, text: Text, width: int, indent: Text) -> _Text: ...
def _get_help_string(self, action: Action) -> Optional[_Text]: ...
def _get_help_string(self, action: Action) -> _Text | None: ...
def _get_default_metavar_for_optional(self, action: Action) -> _Text: ...
def _get_default_metavar_for_positional(self, action: Action) -> _Text: ...
@@ -228,33 +225,29 @@ class ArgumentDefaultsHelpFormatter(HelpFormatter): ...
class Action(_AttributeHolder):
option_strings: Sequence[_Text]
dest: _Text
nargs: Optional[Union[int, _Text]]
nargs: int | _Text | None
const: Any
default: Any
type: Union[Callable[[str], Any], FileType, None]
choices: Optional[Iterable[Any]]
type: Callable[[str], Any] | FileType | None
choices: Iterable[Any] | None
required: bool
help: Optional[_Text]
metavar: Optional[Union[_Text, Tuple[_Text, ...]]]
help: _Text | None
metavar: _Text | Tuple[_Text, ...] | None
def __init__(
self,
option_strings: Sequence[Text],
dest: Text,
nargs: Optional[Union[int, Text]] = ...,
const: Optional[_T] = ...,
default: Union[_T, str, None] = ...,
type: Optional[Union[Callable[[Text], _T], Callable[[str], _T], FileType]] = ...,
choices: Optional[Iterable[_T]] = ...,
nargs: int | Text | None = ...,
const: _T | None = ...,
default: _T | str | None = ...,
type: Callable[[Text], _T] | Callable[[str], _T] | FileType | None = ...,
choices: Iterable[_T] | None = ...,
required: bool = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
help: Text | None = ...,
metavar: Text | Tuple[Text, ...] | None = ...,
) -> None: ...
def __call__(
self,
parser: ArgumentParser,
namespace: Namespace,
values: Union[Text, Sequence[Any], None],
option_string: Optional[Text] = ...,
self, parser: ArgumentParser, namespace: Namespace, values: Text | Sequence[Any] | None, option_string: Text | None = ...
) -> None: ...
class Namespace(_AttributeHolder):
@@ -267,15 +260,15 @@ class FileType:
# undocumented
_mode: _Text
_bufsize: int
def __init__(self, mode: Text = ..., bufsize: Optional[int] = ...) -> None: ...
def __init__(self, mode: Text = ..., bufsize: int | None = ...) -> None: ...
def __call__(self, string: Text) -> IO[Any]: ...
# undocumented
class _ArgumentGroup(_ActionsContainer):
title: Optional[_Text]
title: _Text | None
_group_actions: List[Action]
def __init__(
self, container: _ActionsContainer, title: Optional[Text] = ..., description: Optional[Text] = ..., **kwargs: Any
self, container: _ActionsContainer, title: Text | None = ..., description: Text | None = ..., **kwargs: Any
) -> None: ...
# undocumented
@@ -296,20 +289,20 @@ class _StoreConstAction(Action):
const: Any,
default: Any = ...,
required: bool = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
help: Text | None = ...,
metavar: Text | Tuple[Text, ...] | None = ...,
) -> None: ...
# undocumented
class _StoreTrueAction(_StoreConstAction):
def __init__(
self, option_strings: Sequence[Text], dest: Text, default: bool = ..., required: bool = ..., help: Optional[Text] = ...
self, option_strings: Sequence[Text], dest: Text, default: bool = ..., required: bool = ..., help: Text | None = ...
) -> None: ...
# undocumented
class _StoreFalseAction(_StoreConstAction):
def __init__(
self, option_strings: Sequence[Text], dest: Text, default: bool = ..., required: bool = ..., help: Optional[Text] = ...
self, option_strings: Sequence[Text], dest: Text, default: bool = ..., required: bool = ..., help: Text | None = ...
) -> None: ...
# undocumented
@@ -324,32 +317,27 @@ class _AppendConstAction(Action):
const: Any,
default: Any = ...,
required: bool = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
help: Text | None = ...,
metavar: Text | Tuple[Text, ...] | None = ...,
) -> None: ...
# undocumented
class _CountAction(Action):
def __init__(
self, option_strings: Sequence[Text], dest: Text, default: Any = ..., required: bool = ..., help: Optional[Text] = ...
self, option_strings: Sequence[Text], dest: Text, default: Any = ..., required: bool = ..., help: Text | None = ...
) -> None: ...
# undocumented
class _HelpAction(Action):
def __init__(
self, option_strings: Sequence[Text], dest: Text = ..., default: Text = ..., help: Optional[Text] = ...
self, option_strings: Sequence[Text], dest: Text = ..., default: Text = ..., help: Text | None = ...
) -> None: ...
# undocumented
class _VersionAction(Action):
version: Optional[_Text]
version: _Text | None
def __init__(
self,
option_strings: Sequence[Text],
version: Optional[Text] = ...,
dest: Text = ...,
default: Text = ...,
help: Text = ...,
self, option_strings: Sequence[Text], version: Text | None = ..., dest: Text = ..., default: Text = ..., help: Text = ...
) -> None: ...
# undocumented
@@ -366,8 +354,8 @@ class _SubParsersAction(Action):
prog: Text,
parser_class: Type[ArgumentParser],
dest: Text = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
help: Text | None = ...,
metavar: Text | Tuple[Text, ...] | None = ...,
) -> None: ...
# TODO: Type keyword args properly.
def add_parser(self, name: Text, **kwargs: Any) -> ArgumentParser: ...
@@ -380,4 +368,4 @@ class ArgumentTypeError(Exception): ...
def _ensure_value(namespace: Namespace, name: Text, value: Any) -> Any: ...
# undocumented
def _get_action_name(argument: Optional[Action]) -> Optional[str]: ...
def _get_action_name(argument: Action | None) -> str | None: ...

View File

@@ -12,13 +12,13 @@ class array(MutableSequence[_T], Generic[_T]):
typecode: _TypeCode
itemsize: int
@overload
def __init__(self: array[int], typecode: _IntTypeCode, __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
def __init__(self: array[int], typecode: _IntTypeCode, __initializer: bytes | Iterable[_T] = ...) -> None: ...
@overload
def __init__(self: array[float], typecode: _FloatTypeCode, __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
def __init__(self: array[float], typecode: _FloatTypeCode, __initializer: bytes | Iterable[_T] = ...) -> None: ...
@overload
def __init__(self: array[Text], typecode: _UnicodeTypeCode, __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
def __init__(self: array[Text], typecode: _UnicodeTypeCode, __initializer: bytes | Iterable[_T] = ...) -> None: ...
@overload
def __init__(self, typecode: str, __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
def __init__(self, typecode: str, __initializer: bytes | Iterable[_T] = ...) -> None: ...
def append(self, __v: _T) -> None: ...
def buffer_info(self) -> Tuple[int, int]: ...
def byteswap(self) -> None: ...
@@ -48,7 +48,7 @@ class array(MutableSequence[_T], Generic[_T]):
def __setitem__(self, i: int, o: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: array[_T]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __delitem__(self, i: int | slice) -> None: ...
def __add__(self, x: array[_T]) -> array[_T]: ...
def __ge__(self, other: array[_T]) -> bool: ...
def __gt__(self, other: array[_T]) -> bool: ...

View File

@@ -4,12 +4,12 @@
# from _ast below when loaded in an unorthodox way by the Dropbox
# internal Bazel integration.
import typing as _typing
from typing import Any, Iterator, Optional, Union
from typing import Any, Iterator
from _ast import *
from _ast import AST, Module
def parse(source: Union[str, unicode], filename: Union[str, unicode] = ..., mode: Union[str, unicode] = ...) -> Module: ...
def parse(source: str | unicode, filename: str | unicode = ..., mode: str | unicode = ...) -> Module: ...
def copy_location(new_node: AST, old_node: AST) -> AST: ...
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
def fix_missing_locations(node: AST) -> AST: ...
@@ -17,7 +17,7 @@ def get_docstring(node: AST, clean: bool = ...) -> str: ...
def increment_lineno(node: AST, n: int = ...) -> AST: ...
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
def iter_fields(node: AST) -> Iterator[_typing.Tuple[str, Any]]: ...
def literal_eval(node_or_string: Union[str, unicode, AST]) -> Any: ...
def literal_eval(node_or_string: str | unicode | AST) -> Any: ...
def walk(node: AST) -> Iterator[AST]: ...
class NodeVisitor:
@@ -25,4 +25,4 @@ class NodeVisitor:
def generic_visit(self, node: AST) -> Any: ...
class NodeTransformer(NodeVisitor):
def generic_visit(self, node: AST) -> Optional[AST]: ...
def generic_visit(self, node: AST) -> AST | None: ...

View File

@@ -1,7 +1,7 @@
import asyncore
import socket
from abc import abstractmethod
from typing import Optional, Sequence, Tuple, Union
from typing import Sequence, Tuple
class simple_producer:
def __init__(self, data: bytes, buffer_size: int = ...) -> None: ...
@@ -10,13 +10,13 @@ class simple_producer:
class async_chat(asyncore.dispatcher):
ac_in_buffer_size: int
ac_out_buffer_size: int
def __init__(self, sock: Optional[socket.socket] = ..., map: Optional[asyncore._maptype] = ...) -> None: ...
def __init__(self, sock: socket.socket | None = ..., map: asyncore._maptype | None = ...) -> None: ...
@abstractmethod
def collect_incoming_data(self, data: bytes) -> None: ...
@abstractmethod
def found_terminator(self) -> None: ...
def set_terminator(self, term: Union[bytes, int, None]) -> None: ...
def get_terminator(self) -> Union[bytes, int, None]: ...
def set_terminator(self, term: bytes | int | None) -> None: ...
def get_terminator(self) -> bytes | int | None: ...
def handle_read(self) -> None: ...
def handle_write(self) -> None: ...
def handle_close(self) -> None: ...
@@ -29,9 +29,9 @@ class async_chat(asyncore.dispatcher):
def discard_buffers(self) -> None: ...
class fifo:
def __init__(self, list: Sequence[Union[bytes, simple_producer]] = ...) -> None: ...
def __init__(self, list: Sequence[bytes | simple_producer] = ...) -> None: ...
def __len__(self) -> int: ...
def is_empty(self) -> bool: ...
def first(self) -> bytes: ...
def push(self, data: Union[bytes, simple_producer]) -> None: ...
def push(self, data: bytes | simple_producer) -> None: ...
def pop(self) -> Tuple[int, bytes]: ...

View File

@@ -1,7 +1,7 @@
import sys
from _typeshed import FileDescriptorLike
from socket import SocketType
from typing import Any, Dict, Optional, Tuple, Union, overload
from typing import Any, Dict, Optional, Tuple, overload
# cyclic dependence with asynchat
_maptype = Dict[int, Any]
@@ -13,12 +13,12 @@ class ExitNow(Exception): ...
def read(obj: Any) -> None: ...
def write(obj: Any) -> None: ...
def readwrite(obj: Any, flags: int) -> None: ...
def poll(timeout: float = ..., map: Optional[_maptype] = ...) -> None: ...
def poll2(timeout: float = ..., map: Optional[_maptype] = ...) -> None: ...
def poll(timeout: float = ..., map: _maptype | None = ...) -> None: ...
def poll2(timeout: float = ..., map: _maptype | None = ...) -> None: ...
poll3 = poll2
def loop(timeout: float = ..., use_poll: bool = ..., map: Optional[_maptype] = ..., count: Optional[int] = ...) -> None: ...
def loop(timeout: float = ..., use_poll: bool = ..., map: _maptype | None = ..., count: int | None = ...) -> None: ...
# Not really subclass of socket.socket; it's only delegation.
# It is not covariant to it.
@@ -30,19 +30,19 @@ class dispatcher:
connecting: bool
closing: bool
ignore_log_types: frozenset[str]
socket: Optional[SocketType]
def __init__(self, sock: Optional[SocketType] = ..., map: Optional[_maptype] = ...) -> None: ...
def add_channel(self, map: Optional[_maptype] = ...) -> None: ...
def del_channel(self, map: Optional[_maptype] = ...) -> None: ...
socket: SocketType | None
def __init__(self, sock: SocketType | None = ..., map: _maptype | None = ...) -> None: ...
def add_channel(self, map: _maptype | None = ...) -> None: ...
def del_channel(self, map: _maptype | None = ...) -> None: ...
def create_socket(self, family: int = ..., type: int = ...) -> None: ...
def set_socket(self, sock: SocketType, map: Optional[_maptype] = ...) -> None: ...
def set_socket(self, sock: SocketType, map: _maptype | None = ...) -> None: ...
def set_reuse_addr(self) -> None: ...
def readable(self) -> bool: ...
def writable(self) -> bool: ...
def listen(self, num: int) -> None: ...
def bind(self, addr: Union[Tuple[Any, ...], str]) -> None: ...
def connect(self, address: Union[Tuple[Any, ...], str]) -> None: ...
def accept(self) -> Optional[Tuple[SocketType, Any]]: ...
def bind(self, addr: Tuple[Any, ...] | str) -> None: ...
def connect(self, address: Tuple[Any, ...] | str) -> None: ...
def accept(self) -> Tuple[SocketType, Any] | None: ...
def send(self, data: bytes) -> int: ...
def recv(self, buffer_size: int) -> bytes: ...
def close(self) -> None: ...
@@ -83,21 +83,21 @@ class dispatcher:
def recvfrom_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
def recv_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
def sendall(self, data: bytes, flags: int = ...) -> None: ...
def sendto(self, data: bytes, address: Union[Tuple[str, int], str], flags: int = ...) -> int: ...
def sendto(self, data: bytes, address: Tuple[str, int] | str, flags: int = ...) -> int: ...
def setblocking(self, flag: bool) -> None: ...
def settimeout(self, value: Union[float, None]) -> None: ...
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
def settimeout(self, value: float | None) -> None: ...
def setsockopt(self, level: int, optname: int, value: int | bytes) -> None: ...
def shutdown(self, how: int) -> None: ...
class dispatcher_with_send(dispatcher):
def __init__(self, sock: SocketType = ..., map: Optional[_maptype] = ...) -> None: ...
def __init__(self, sock: SocketType = ..., map: _maptype | None = ...) -> None: ...
def initiate_send(self) -> None: ...
def handle_write(self) -> None: ...
# incompatible signature:
# def send(self, data: bytes) -> Optional[int]: ...
def compact_traceback() -> Tuple[Tuple[str, str, str], type, type, str]: ...
def close_all(map: Optional[_maptype] = ..., ignore_all: bool = ...) -> None: ...
def close_all(map: _maptype | None = ..., ignore_all: bool = ...) -> None: ...
if sys.platform != "win32":
class file_wrapper:
@@ -114,5 +114,5 @@ if sys.platform != "win32":
def close(self) -> None: ...
def fileno(self) -> int: ...
class file_dispatcher(dispatcher):
def __init__(self, fd: FileDescriptorLike, map: Optional[_maptype] = ...) -> None: ...
def __init__(self, fd: FileDescriptorLike, map: _maptype | None = ...) -> None: ...
def set_file(self, fd: int) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Optional, Tuple
from typing import Tuple
AdpcmState = Tuple[int, int]
RatecvState = Tuple[int, Tuple[Tuple[int, int], ...]]
@@ -6,7 +6,7 @@ RatecvState = Tuple[int, Tuple[Tuple[int, int], ...]]
class error(Exception): ...
def add(__fragment1: bytes, __fragment2: bytes, __width: int) -> bytes: ...
def adpcm2lin(__fragment: bytes, __width: int, __state: Optional[AdpcmState]) -> Tuple[bytes, AdpcmState]: ...
def adpcm2lin(__fragment: bytes, __width: int, __state: AdpcmState | None) -> Tuple[bytes, AdpcmState]: ...
def alaw2lin(__fragment: bytes, __width: int) -> bytes: ...
def avg(__fragment: bytes, __width: int) -> int: ...
def avgpp(__fragment: bytes, __width: int) -> int: ...
@@ -17,7 +17,7 @@ def findfactor(__fragment: bytes, __reference: bytes) -> float: ...
def findfit(__fragment: bytes, __reference: bytes) -> Tuple[int, float]: ...
def findmax(__fragment: bytes, __length: int) -> int: ...
def getsample(__fragment: bytes, __width: int, __index: int) -> int: ...
def lin2adpcm(__fragment: bytes, __width: int, __state: Optional[AdpcmState]) -> Tuple[bytes, AdpcmState]: ...
def lin2adpcm(__fragment: bytes, __width: int, __state: AdpcmState | None) -> Tuple[bytes, AdpcmState]: ...
def lin2alaw(__fragment: bytes, __width: int) -> bytes: ...
def lin2lin(__fragment: bytes, __width: int, __newwidth: int) -> bytes: ...
def lin2ulaw(__fragment: bytes, __width: int) -> bytes: ...
@@ -31,7 +31,7 @@ def ratecv(
__nchannels: int,
__inrate: int,
__outrate: int,
__state: Optional[RatecvState],
__state: RatecvState | None,
__weightA: int = ...,
__weightB: int = ...,
) -> Tuple[bytes, RatecvState]: ...

View File

@@ -1,16 +1,16 @@
from typing import IO, Optional, Union
from typing import IO, Union
_encodable = Union[bytes, unicode]
_decodable = Union[bytes, unicode]
def b64encode(s: _encodable, altchars: Optional[bytes] = ...) -> bytes: ...
def b64decode(s: _decodable, altchars: Optional[bytes] = ..., validate: bool = ...) -> bytes: ...
def b64encode(s: _encodable, altchars: bytes | None = ...) -> bytes: ...
def b64decode(s: _decodable, altchars: bytes | None = ..., validate: bool = ...) -> bytes: ...
def standard_b64encode(s: _encodable) -> bytes: ...
def standard_b64decode(s: _decodable) -> bytes: ...
def urlsafe_b64encode(s: _encodable) -> bytes: ...
def urlsafe_b64decode(s: _decodable) -> bytes: ...
def b32encode(s: _encodable) -> bytes: ...
def b32decode(s: _decodable, casefold: bool = ..., map01: Optional[bytes] = ...) -> bytes: ...
def b32decode(s: _decodable, casefold: bool = ..., map01: bytes | None = ...) -> bytes: ...
def b16encode(s: _encodable) -> bytes: ...
def b16decode(s: _decodable, casefold: bool = ...) -> bytes: ...
def decode(input: IO[bytes], output: IO[bytes]) -> None: ...

View File

@@ -1,5 +1,5 @@
from types import CodeType, FrameType, TracebackType
from typing import IO, Any, Callable, Dict, Iterable, List, Mapping, Optional, Set, SupportsInt, Tuple, Type, TypeVar, Union
from typing import IO, Any, Callable, Dict, Iterable, List, Mapping, Set, SupportsInt, Tuple, Type, TypeVar
_T = TypeVar("_T")
_TraceDispatch = Callable[[FrameType, str, Any], Any] # TODO: Recursive type
@@ -11,16 +11,16 @@ class BdbQuit(Exception): ...
class Bdb:
skip: Optional[Set[str]]
skip: Set[str] | None
breaks: Dict[str, List[int]]
fncache: Dict[str, str]
frame_returning: Optional[FrameType]
botframe: Optional[FrameType]
frame_returning: FrameType | None
botframe: FrameType | None
quitting: bool
stopframe: Optional[FrameType]
returnframe: Optional[FrameType]
stopframe: FrameType | None
returnframe: FrameType | None
stoplineno: int
def __init__(self, skip: Optional[Iterable[str]] = ...) -> None: ...
def __init__(self, skip: Iterable[str] | None = ...) -> None: ...
def canonic(self, filename: str) -> str: ...
def reset(self) -> None: ...
def trace_dispatch(self, frame: FrameType, event: str, arg: Any) -> _TraceDispatch: ...
@@ -31,21 +31,21 @@ class Bdb:
def is_skipped_module(self, module_name: str) -> bool: ...
def stop_here(self, frame: FrameType) -> bool: ...
def break_here(self, frame: FrameType) -> bool: ...
def do_clear(self, arg: Any) -> Optional[bool]: ...
def do_clear(self, arg: Any) -> bool | None: ...
def break_anywhere(self, frame: FrameType) -> bool: ...
def user_call(self, frame: FrameType, argument_list: None) -> None: ...
def user_line(self, frame: FrameType) -> None: ...
def user_return(self, frame: FrameType, return_value: Any) -> None: ...
def user_exception(self, frame: FrameType, exc_info: _ExcInfo) -> None: ...
def set_until(self, frame: FrameType, lineno: Optional[int] = ...) -> None: ...
def set_until(self, frame: FrameType, lineno: int | None = ...) -> None: ...
def set_step(self) -> None: ...
def set_next(self, frame: FrameType) -> None: ...
def set_return(self, frame: FrameType) -> None: ...
def set_trace(self, frame: Optional[FrameType] = ...) -> None: ...
def set_trace(self, frame: FrameType | None = ...) -> None: ...
def set_continue(self) -> None: ...
def set_quit(self) -> None: ...
def set_break(
self, filename: str, lineno: int, temporary: bool = ..., cond: Optional[str] = ..., funcname: Optional[str] = ...
self, filename: str, lineno: int, temporary: bool = ..., cond: str | None = ..., funcname: str | None = ...
) -> None: ...
def clear_break(self, filename: str, lineno: int) -> None: ...
def clear_bpbynumber(self, arg: SupportsInt) -> None: ...
@@ -56,43 +56,39 @@ class Bdb:
def get_breaks(self, filename: str, lineno: int) -> List[Breakpoint]: ...
def get_file_breaks(self, filename: str) -> List[Breakpoint]: ...
def get_all_breaks(self) -> List[Breakpoint]: ...
def get_stack(self, f: Optional[FrameType], t: Optional[TracebackType]) -> Tuple[List[Tuple[FrameType, int]], int]: ...
def get_stack(self, f: FrameType | None, t: TracebackType | None) -> Tuple[List[Tuple[FrameType, int]], int]: ...
def format_stack_entry(self, frame_lineno: int, lprefix: str = ...) -> str: ...
def run(
self, cmd: Union[str, CodeType], globals: Optional[Dict[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...
) -> None: ...
def runeval(self, expr: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> None: ...
def runctx(
self, cmd: Union[str, CodeType], globals: Optional[Dict[str, Any]], locals: Optional[Mapping[str, Any]]
) -> None: ...
def runcall(self, __func: Callable[..., _T], *args: Any, **kwds: Any) -> Optional[_T]: ...
def run(self, cmd: str | CodeType, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ...
def runeval(self, expr: str, globals: Dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ...
def runctx(self, cmd: str | CodeType, globals: Dict[str, Any] | None, locals: Mapping[str, Any] | None) -> None: ...
def runcall(self, __func: Callable[..., _T], *args: Any, **kwds: Any) -> _T | None: ...
class Breakpoint:
next: int = ...
bplist: Dict[Tuple[str, int], List[Breakpoint]] = ...
bpbynumber: List[Optional[Breakpoint]] = ...
bpbynumber: List[Breakpoint | None] = ...
funcname: Optional[str]
func_first_executable_line: Optional[int]
funcname: str | None
func_first_executable_line: int | None
file: str
line: int
temporary: bool
cond: Optional[str]
cond: str | None
enabled: bool
ignore: int
hits: int
number: int
def __init__(
self, file: str, line: int, temporary: bool = ..., cond: Optional[str] = ..., funcname: Optional[str] = ...
self, file: str, line: int, temporary: bool = ..., cond: str | None = ..., funcname: str | None = ...
) -> None: ...
def deleteMe(self) -> None: ...
def enable(self) -> None: ...
def disable(self) -> None: ...
def bpprint(self, out: Optional[IO[str]] = ...) -> None: ...
def bpprint(self, out: IO[str] | None = ...) -> None: ...
def bpformat(self) -> str: ...
def __str__(self) -> str: ...
def checkfuncname(b: Breakpoint, frame: FrameType) -> bool: ...
def effective(file: str, line: int, frame: FrameType) -> Union[Tuple[Breakpoint, bool], Tuple[None, None]]: ...
def effective(file: str, line: int, frame: FrameType) -> Tuple[Breakpoint, bool] | Tuple[None, None]: ...
def set_trace() -> None: ...

View File

@@ -26,7 +26,6 @@ from typing import (
MutableSequence,
MutableSet,
NoReturn,
Optional,
Protocol,
Reversible,
Sequence,
@@ -40,7 +39,6 @@ from typing import (
Tuple,
Type,
TypeVar,
Union,
ValuesView,
overload,
)
@@ -66,9 +64,9 @@ _TT = TypeVar("_TT", bound="type")
_TBE = TypeVar("_TBE", bound="BaseException")
class object:
__doc__: Optional[str]
__doc__: str | None
__dict__: Dict[str, Any]
__slots__: Union[Text, Iterable[Text]]
__slots__: Text | Iterable[Text]
__module__: str
@property
def __class__(self: _T) -> Type[_T]: ...
@@ -86,20 +84,20 @@ class object:
def __getattribute__(self, name: str) -> Any: ...
def __delattr__(self, name: str) -> None: ...
def __sizeof__(self) -> int: ...
def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ...
def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ...
def __reduce__(self) -> str | Tuple[Any, ...]: ...
def __reduce_ex__(self, protocol: int) -> str | Tuple[Any, ...]: ...
class staticmethod(object): # Special, only valid as a decorator.
__func__: Callable[..., Any]
def __init__(self, f: Callable[..., Any]) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ...
class classmethod(object): # Special, only valid as a decorator.
__func__: Callable[..., Any]
def __init__(self, f: Callable[..., Any]) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ...
class type(object):
__base__: type
@@ -137,9 +135,9 @@ class super(object):
class int:
@overload
def __new__(cls: Type[_T], x: Union[Text, bytes, SupportsInt, _SupportsIndex, _SupportsTrunc] = ...) -> _T: ...
def __new__(cls: Type[_T], x: Text | bytes | SupportsInt | _SupportsIndex | _SupportsTrunc = ...) -> _T: ...
@overload
def __new__(cls: Type[_T], x: Union[Text, bytes, bytearray], base: int) -> _T: ...
def __new__(cls: Type[_T], x: Text | bytes | bytearray, base: int) -> _T: ...
@property
def real(self) -> int: ...
@property
@@ -167,10 +165,10 @@ class int:
def __rmod__(self, x: int) -> int: ...
def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
@overload
def __pow__(self, __x: Literal[2], __modulo: Optional[int] = ...) -> int: ...
def __pow__(self, __x: Literal[2], __modulo: int | None = ...) -> int: ...
@overload
def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ... # Return type can be int or float, depending on x.
def __rpow__(self, x: int, mod: Optional[int] = ...) -> Any: ...
def __pow__(self, __x: int, __modulo: int | None = ...) -> Any: ... # Return type can be int or float, depending on x.
def __rpow__(self, x: int, mod: int | None = ...) -> Any: ...
def __and__(self, n: int) -> int: ...
def __or__(self, n: int) -> int: ...
def __xor__(self, n: int) -> int: ...
@@ -201,7 +199,7 @@ class int:
def __index__(self) -> int: ...
class float:
def __new__(cls: Type[_T], x: Union[SupportsFloat, _SupportsIndex, Text, bytes, bytearray] = ...) -> _T: ...
def __new__(cls: Type[_T], x: SupportsFloat | _SupportsIndex | Text | bytes | bytearray = ...) -> _T: ...
def as_integer_ratio(self) -> Tuple[int, int]: ...
def hex(self) -> str: ...
def is_integer(self) -> bool: ...
@@ -253,7 +251,7 @@ class complex:
@overload
def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ...
@overload
def __new__(cls: Type[_T], real: Union[str, SupportsComplex, _SupportsIndex]) -> _T: ...
def __new__(cls: Type[_T], real: str | SupportsComplex | _SupportsIndex) -> _T: ...
@property
def real(self) -> float: ...
@property
@@ -295,9 +293,7 @@ class unicode(basestring, Sequence[unicode]):
def count(self, x: unicode) -> int: ...
def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ...
def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ...
def endswith(
self, __suffix: Union[unicode, Tuple[unicode, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def endswith(self, __suffix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
def expandtabs(self, tabsize: int = ...) -> unicode: ...
def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
def format(self, *args: object, **kwargs: object) -> unicode: ...
@@ -323,17 +319,15 @@ class unicode(basestring, Sequence[unicode]):
def rindex(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
def rjust(self, width: int, fillchar: unicode = ...) -> unicode: ...
def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
def rsplit(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ...
def rsplit(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ...
def rstrip(self, chars: unicode = ...) -> unicode: ...
def split(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ...
def split(self, sep: unicode | None = ..., maxsplit: int = ...) -> List[unicode]: ...
def splitlines(self, keepends: bool = ...) -> List[unicode]: ...
def startswith(
self, __prefix: Union[unicode, Tuple[unicode, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def startswith(self, __prefix: unicode | Tuple[unicode, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
def strip(self, chars: unicode = ...) -> unicode: ...
def swapcase(self) -> unicode: ...
def title(self) -> unicode: ...
def translate(self, table: Union[Dict[int, Any], unicode]) -> unicode: ...
def translate(self, table: Dict[int, Any] | unicode) -> unicode: ...
def upper(self) -> unicode: ...
def zfill(self, width: int) -> unicode: ...
@overload
@@ -353,7 +347,7 @@ class unicode(basestring, Sequence[unicode]):
def __ge__(self, x: unicode) -> bool: ...
def __len__(self) -> int: ...
# The argument type is incompatible with Sequence
def __contains__(self, s: Union[unicode, bytes]) -> bool: ... # type: ignore
def __contains__(self, s: unicode | bytes) -> bool: ... # type: ignore
def __iter__(self) -> Iterator[unicode]: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
@@ -369,17 +363,15 @@ class str(Sequence[str], basestring):
def __init__(self, o: object = ...) -> None: ...
def capitalize(self) -> str: ...
def center(self, __width: int, __fillchar: str = ...) -> str: ...
def count(self, x: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def count(self, x: Text, __start: int | None = ..., __end: int | None = ...) -> int: ...
def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ...
def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ...
def endswith(
self, __suffix: Union[Text, Tuple[Text, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def endswith(self, __suffix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
def expandtabs(self, tabsize: int = ...) -> str: ...
def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def find(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ...
def format(self, *args: object, **kwargs: object) -> str: ...
def format_map(self, map: _FormatMapMapping) -> str: ...
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def index(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...
def isdigit(self) -> bool: ...
@@ -401,8 +393,8 @@ class str(Sequence[str], basestring):
@overload
def partition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
def replace(self, __old: AnyStr, __new: AnyStr, __count: int = ...) -> AnyStr: ...
def rfind(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def rindex(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def rfind(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ...
def rindex(self, sub: Text, __start: int | None = ..., __end: int | None = ...) -> int: ...
def rjust(self, __width: int, __fillchar: str = ...) -> str: ...
@overload
def rpartition(self, __sep: bytearray) -> Tuple[str, bytearray, str]: ...
@@ -411,7 +403,7 @@ class str(Sequence[str], basestring):
@overload
def rpartition(self, __sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
@overload
def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ...
@overload
def rsplit(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
@overload
@@ -419,28 +411,26 @@ class str(Sequence[str], basestring):
@overload
def rstrip(self, __chars: unicode) -> unicode: ...
@overload
def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
def split(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ...
@overload
def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
def splitlines(self, keepends: bool = ...) -> List[str]: ...
def startswith(
self, __prefix: Union[Text, Tuple[Text, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def startswith(self, __prefix: Text | Tuple[Text, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
@overload
def strip(self, __chars: str = ...) -> str: ...
@overload
def strip(self, chars: unicode) -> unicode: ...
def swapcase(self) -> str: ...
def title(self) -> str: ...
def translate(self, __table: Optional[AnyStr], deletechars: AnyStr = ...) -> AnyStr: ...
def translate(self, __table: AnyStr | None, deletechars: AnyStr = ...) -> AnyStr: ...
def upper(self) -> str: ...
def zfill(self, __width: int) -> str: ...
def __add__(self, s: AnyStr) -> AnyStr: ...
# Incompatible with Sequence.__contains__
def __contains__(self, o: Union[str, Text]) -> bool: ... # type: ignore
def __contains__(self, o: str | Text) -> bool: ... # type: ignore
def __eq__(self, x: object) -> bool: ...
def __ge__(self, x: Text) -> bool: ...
def __getitem__(self, i: Union[int, slice]) -> str: ...
def __getitem__(self, i: int | slice) -> str: ...
def __gt__(self, x: Text) -> bool: ...
def __hash__(self) -> int: ...
def __iter__(self) -> Iterator[str]: ...
@@ -475,11 +465,9 @@ class bytearray(MutableSequence[int], ByteString):
def center(self, __width: int, __fillchar: bytes = ...) -> bytearray: ...
def count(self, __sub: str) -> int: ...
def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ...
def endswith(
self, __suffix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def endswith(self, __suffix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
def expandtabs(self, tabsize: int = ...) -> bytearray: ...
def extend(self, iterable: Union[str, Iterable[int]]) -> None: ...
def extend(self, iterable: str | Iterable[int]) -> None: ...
def find(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ...
def index(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ...
def insert(self, __index: int, __item: int) -> None: ...
@@ -493,21 +481,19 @@ class bytearray(MutableSequence[int], ByteString):
def join(self, __iterable: Iterable[str]) -> bytearray: ...
def ljust(self, __width: int, __fillchar: str = ...) -> bytearray: ...
def lower(self) -> bytearray: ...
def lstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def lstrip(self, __bytes: bytes | None = ...) -> bytearray: ...
def partition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytearray: ...
def rfind(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ...
def rindex(self, __sub: bytes, __start: int = ..., __end: int = ...) -> int: ...
def rjust(self, __width: int, __fillchar: bytes = ...) -> bytearray: ...
def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def rsplit(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
def rstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
def rsplit(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ...
def rstrip(self, __bytes: bytes | None = ...) -> bytearray: ...
def split(self, sep: bytes | None = ..., maxsplit: int = ...) -> List[bytearray]: ...
def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
def startswith(
self, __prefix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def strip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def startswith(self, __prefix: bytes | Tuple[bytes, ...], __start: int | None = ..., __end: int | None = ...) -> bool: ...
def strip(self, __bytes: bytes | None = ...) -> bytearray: ...
def swapcase(self) -> bytearray: ...
def title(self) -> bytearray: ...
def translate(self, __table: str) -> bytearray: ...
@@ -529,15 +515,15 @@ class bytearray(MutableSequence[int], ByteString):
@overload
def __setitem__(self, i: int, x: int) -> None: ...
@overload
def __setitem__(self, s: slice, x: Union[Iterable[int], bytes]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __setitem__(self, s: slice, x: Iterable[int] | bytes) -> None: ...
def __delitem__(self, i: int | slice) -> None: ...
def __getslice__(self, start: int, stop: int) -> bytearray: ...
def __setslice__(self, start: int, stop: int, x: Union[Sequence[int], str]) -> None: ...
def __setslice__(self, start: int, stop: int, x: Sequence[int] | str) -> None: ...
def __delslice__(self, start: int, stop: int) -> None: ...
def __add__(self, s: bytes) -> bytearray: ...
def __mul__(self, n: int) -> bytearray: ...
# Incompatible with Sequence.__contains__
def __contains__(self, o: Union[int, bytes]) -> bool: ... # type: ignore
def __contains__(self, o: int | bytes) -> bool: ... # type: ignore
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: bytes) -> bool: ...
@@ -548,9 +534,9 @@ class bytearray(MutableSequence[int], ByteString):
class memoryview(Sized, Container[str]):
format: str
itemsize: int
shape: Optional[Tuple[int, ...]]
strides: Optional[Tuple[int, ...]]
suboffsets: Optional[Tuple[int, ...]]
shape: Tuple[int, ...] | None
strides: Tuple[int, ...] | None
suboffsets: Tuple[int, ...] | None
readonly: bool
ndim: int
def __init__(self, obj: ReadableBuffer) -> None: ...
@@ -662,7 +648,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __setitem__(self, i: int, o: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __delitem__(self, i: int | slice) -> None: ...
def __getslice__(self, start: int, stop: int) -> List[_T]: ...
def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ...
def __delslice__(self, start: int, stop: int) -> None: ...
@@ -743,18 +729,18 @@ class set(MutableSet[_T], Generic[_T]):
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[object]) -> Set[_T]: ...
def __iand__(self, s: AbstractSet[object]) -> Set[_T]: ...
def __or__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __ior__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __or__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __ior__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
@overload
def __sub__(self: Set[str], s: AbstractSet[Optional[Text]]) -> Set[_T]: ...
def __sub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ...
@overload
def __sub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...
def __sub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ...
@overload # type: ignore
def __isub__(self: Set[str], s: AbstractSet[Optional[Text]]) -> Set[_T]: ...
def __isub__(self: Set[str], s: AbstractSet[Text | None]) -> Set[_T]: ...
@overload
def __isub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __ixor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __isub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __ixor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __le__(self, s: AbstractSet[object]) -> bool: ...
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
@@ -776,9 +762,9 @@ class frozenset(AbstractSet[_T_co], Generic[_T_co]):
def __iter__(self) -> Iterator[_T_co]: ...
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T_co, _S]]: ...
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T_co, _S]]: ...
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
def __le__(self, s: AbstractSet[object]) -> bool: ...
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
@@ -802,15 +788,15 @@ class xrange(Sized, Iterable[int], Reversible[int]):
class property(object):
def __init__(
self,
fget: Optional[Callable[[Any], Any]] = ...,
fset: Optional[Callable[[Any, Any], None]] = ...,
fdel: Optional[Callable[[Any], None]] = ...,
doc: Optional[str] = ...,
fget: Callable[[Any], Any] | None = ...,
fset: Callable[[Any, Any], None] | None = ...,
fdel: Callable[[Any], None] | None = ...,
doc: str | None = ...,
) -> None: ...
def getter(self, fget: Callable[[Any], Any]) -> property: ...
def setter(self, fset: Callable[[Any, Any], None]) -> property: ...
def deleter(self, fdel: Callable[[Any], None]) -> property: ...
def __get__(self, obj: Any, type: Optional[type] = ...) -> Any: ...
def __get__(self, obj: Any, type: type | None = ...) -> Any: ...
def __set__(self, obj: Any, value: Any) -> None: ...
def __delete__(self, obj: Any) -> None: ...
def fget(self) -> Any: ...
@@ -829,8 +815,8 @@ NotImplemented: _NotImplementedType
def abs(__x: SupportsAbs[_T]) -> _T: ...
def all(__iterable: Iterable[object]) -> bool: ...
def any(__iterable: Iterable[object]) -> bool: ...
def apply(__func: Callable[..., _T], __args: Optional[Sequence[Any]] = ..., __kwds: Optional[Mapping[str, Any]] = ...) -> _T: ...
def bin(__number: Union[int, _SupportsIndex]) -> str: ...
def apply(__func: Callable[..., _T], __args: Sequence[Any] | None = ..., __kwds: Mapping[str, Any] | None = ...) -> _T: ...
def bin(__number: int | _SupportsIndex) -> str: ...
def callable(__obj: object) -> bool: ...
def chr(__i: int) -> str: ...
def cmp(__x: Any, __y: Any) -> int: ...
@@ -838,7 +824,7 @@ def cmp(__x: Any, __y: Any) -> int: ...
_N1 = TypeVar("_N1", bool, int, float, complex)
def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ...
def compile(source: Union[Text, mod], filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ...
def compile(source: Text | mod, filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ...
def delattr(__obj: Any, __name: Text) -> None: ...
def dir(__o: object = ...) -> List[str]: ...
@@ -846,18 +832,18 @@ _N2 = TypeVar("_N2", int, float)
def divmod(__x: _N2, __y: _N2) -> Tuple[_N2, _N2]: ...
def eval(
__source: Union[Text, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...
__source: Text | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ...
) -> Any: ...
def execfile(__filename: str, __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Dict[str, Any]] = ...) -> None: ...
def execfile(__filename: str, __globals: Dict[str, Any] | None = ..., __locals: Dict[str, Any] | None = ...) -> None: ...
def exit(code: object = ...) -> NoReturn: ...
@overload
def filter(__function: Callable[[AnyStr], Any], __iterable: AnyStr) -> AnyStr: ... # type: ignore
@overload
def filter(__function: None, __iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ... # type: ignore
def filter(__function: None, __iterable: Tuple[_T | None, ...]) -> Tuple[_T, ...]: ... # type: ignore
@overload
def filter(__function: Callable[[_T], Any], __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... # type: ignore
@overload
def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> List[_T]: ...
def filter(__function: None, __iterable: Iterable[_T | None]) -> List[_T]: ...
@overload
def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ...
def format(__value: object, __format_spec: str = ...) -> str: ... # TODO unicode
@@ -867,26 +853,26 @@ def getattr(__o: Any, name: Text) -> Any: ...
# While technically covered by the last overload, spelling out the types for None and bool
# help mypy out in some tricky situations involving type context (aka bidirectional inference)
@overload
def getattr(__o: Any, name: Text, __default: None) -> Optional[Any]: ...
def getattr(__o: Any, name: Text, __default: None) -> Any | None: ...
@overload
def getattr(__o: Any, name: Text, __default: bool) -> Union[Any, bool]: ...
def getattr(__o: Any, name: Text, __default: bool) -> Any | bool: ...
@overload
def getattr(__o: Any, name: Text, __default: _T) -> Union[Any, _T]: ...
def getattr(__o: Any, name: Text, __default: _T) -> Any | _T: ...
def globals() -> Dict[str, Any]: ...
def hasattr(__obj: Any, __name: Text) -> bool: ...
def hash(__obj: object) -> int: ...
def hex(__number: Union[int, _SupportsIndex]) -> str: ...
def hex(__number: int | _SupportsIndex) -> str: ...
def id(__obj: object) -> int: ...
def input(__prompt: Any = ...) -> Any: ...
def intern(__string: str) -> str: ...
@overload
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def iter(__function: Callable[[], Optional[_T]], __sentinel: None) -> Iterator[_T]: ...
def iter(__function: Callable[[], _T | None], __sentinel: None) -> Iterator[_T]: ...
@overload
def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ...
def isinstance(__obj: object, __class_or_tuple: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def issubclass(__cls: type, __class_or_tuple: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def isinstance(__obj: object, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ...
def issubclass(__cls: type, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ...
def len(__obj: Sized) -> int: ...
def locals() -> Dict[str, Any]: ...
@overload
@@ -966,15 +952,13 @@ def min(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ...
@overload
def next(__i: Iterator[_T]) -> _T: ...
@overload
def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
def oct(__number: Union[int, _SupportsIndex]) -> str: ...
def open(name: Union[unicode, int], mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
def ord(__c: Union[Text, bytes]) -> int: ...
def next(__i: Iterator[_T], default: _VT) -> _T | _VT: ...
def oct(__number: int | _SupportsIndex) -> str: ...
def open(name: unicode | int, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
def ord(__c: Text | bytes) -> int: ...
# This is only available after from __future__ import print_function.
def print(
*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[SupportsWrite[Any]] = ...
) -> None: ...
def print(*values: object, sep: Text | None = ..., end: Text | None = ..., file: SupportsWrite[Any] | None = ...) -> None: ...
_E = TypeVar("_E", contravariant=True)
_M = TypeVar("_M", contravariant=True)
@@ -1018,12 +1002,12 @@ def round(number: SupportsFloat) -> float: ...
def round(number: SupportsFloat, ndigits: int) -> float: ...
def setattr(__obj: Any, __name: Text, __value: Any) -> None: ...
def sorted(
__iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...
__iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Callable[[_T], Any] | None = ..., reverse: bool = ...
) -> List[_T]: ...
@overload
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
def sum(__iterable: Iterable[_T]) -> _T | int: ...
@overload
def sum(__iterable: Iterable[_T], __start: _S) -> Union[_T, _S]: ...
def sum(__iterable: Iterable[_T], __start: _S) -> _T | _S: ...
def unichr(__i: int) -> unicode: ...
def vars(__object: Any = ...) -> Dict[str, Any]: ...
@overload
@@ -1052,8 +1036,8 @@ def zip(
) -> List[Tuple[Any, ...]]: ...
def __import__(
name: Text,
globals: Optional[Mapping[str, Any]] = ...,
locals: Optional[Mapping[str, Any]] = ...,
globals: Mapping[str, Any] | None = ...,
locals: Mapping[str, Any] | None = ...,
fromlist: Sequence[str] = ...,
level: int = ...,
) -> Any: ...
@@ -1071,7 +1055,7 @@ class buffer(Sized):
def __init__(self, object: _AnyBuffer, offset: int = ..., size: int = ...) -> None: ...
def __add__(self, other: _AnyBuffer) -> str: ...
def __cmp__(self, other: _AnyBuffer) -> bool: ...
def __getitem__(self, key: Union[int, slice]) -> str: ...
def __getitem__(self, key: int | slice) -> str: ...
def __getslice__(self, i: int, j: int) -> str: ...
def __len__(self) -> int: ...
def __mul__(self, x: int) -> str: ...
@@ -1119,10 +1103,10 @@ class RuntimeError(_StandardError): ...
class SyntaxError(_StandardError):
msg: str
lineno: Optional[int]
offset: Optional[int]
text: Optional[str]
filename: Optional[str]
lineno: int | None
offset: int | None
text: str | None
filename: str | None
class SystemError(_StandardError): ...
class TypeError(_StandardError): ...
@@ -1181,9 +1165,7 @@ class file(BinaryIO):
def next(self) -> str: ...
def read(self, n: int = ...) -> str: ...
def __enter__(self) -> BinaryIO: ...
def __exit__(
self, t: Optional[type] = ..., exc: Optional[BaseException] = ..., tb: Optional[Any] = ...
) -> Optional[bool]: ...
def __exit__(self, t: type | None = ..., exc: BaseException | None = ..., tb: Any | None = ...) -> bool | None: ...
def flush(self) -> None: ...
def fileno(self) -> int: ...
def isatty(self) -> bool: ...
@@ -1197,4 +1179,4 @@ class file(BinaryIO):
def readlines(self, hint: int = ...) -> List[str]: ...
def write(self, data: str) -> int: ...
def writelines(self, data: Iterable[str]) -> None: ...
def truncate(self, pos: Optional[int] = ...) -> int: ...
def truncate(self, pos: int | None = ...) -> int: ...

View File

@@ -1,6 +1,6 @@
import io
from _typeshed import ReadableBuffer, WriteableBuffer
from typing import IO, Any, Iterable, List, Optional, Text, TypeVar, Union
from typing import IO, Any, Iterable, List, Text, TypeVar, Union
from typing_extensions import SupportsIndex
_PathOrFile = Union[Text, IO[bytes]]
@@ -11,10 +11,8 @@ def decompress(data: bytes) -> bytes: ...
class BZ2File(io.BufferedIOBase, IO[bytes]):
def __enter__(self: _T) -> _T: ...
def __init__(
self, filename: _PathOrFile, mode: str = ..., buffering: Optional[Any] = ..., compresslevel: int = ...
) -> None: ...
def read(self, size: Optional[int] = ...) -> bytes: ...
def __init__(self, filename: _PathOrFile, mode: str = ..., buffering: Any | None = ..., compresslevel: int = ...) -> None: ...
def read(self, size: int | None = ...) -> bytes: ...
def read1(self, size: int = ...) -> bytes: ...
def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore
def readinto(self, b: WriteableBuffer) -> int: ...

View File

@@ -1,9 +1,9 @@
from types import CodeType
from typing import Any, Callable, Dict, Optional, Text, Tuple, TypeVar, Union
from typing import Any, Callable, Dict, Text, Tuple, TypeVar
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ...
def runctx(
statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: Optional[str] = ..., sort: Union[str, int] = ...
statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: str | None = ..., sort: str | int = ...
) -> None: ...
_SelfT = TypeVar("_SelfT", bound=Profile)
@@ -17,7 +17,7 @@ class Profile:
) -> None: ...
def enable(self) -> None: ...
def disable(self) -> None: ...
def print_stats(self, sort: Union[str, int] = ...) -> None: ...
def print_stats(self, sort: str | int = ...) -> None: ...
def dump_stats(self, file: Text) -> None: ...
def create_stats(self) -> None: ...
def snapshot_stats(self) -> None: ...
@@ -25,4 +25,4 @@ class Profile:
def runctx(self: _SelfT, cmd: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> _SelfT: ...
def runcall(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ...
def label(code: Union[str, CodeType]) -> _Label: ... # undocumented
def label(code: str | CodeType) -> _Label: ... # undocumented

View File

@@ -1,5 +1,5 @@
from abc import ABCMeta
from typing import IO, Iterable, Iterator, List, Optional, Union, overload
from typing import IO, Iterable, Iterator, List, overload
# This class isn't actually abstract, but you can't instantiate it
# directly, so we might as well treat it as abstract in the stub.
@@ -15,7 +15,7 @@ class InputType(IO[str], Iterator[str], metaclass=ABCMeta):
def readlines(self, hint: int = ...) -> List[str]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def truncate(self, size: int | None = ...) -> int: ...
def __iter__(self) -> InputType: ...
def next(self) -> str: ...
def reset(self) -> None: ...
@@ -34,12 +34,12 @@ class OutputType(IO[str], Iterator[str], metaclass=ABCMeta):
def readlines(self, hint: int = ...) -> List[str]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def truncate(self, size: int | None = ...) -> int: ...
def __iter__(self) -> OutputType: ...
def next(self) -> str: ...
def reset(self) -> None: ...
def write(self, b: Union[str, unicode]) -> int: ...
def writelines(self, lines: Iterable[Union[str, unicode]]) -> None: ...
def write(self, b: str | unicode) -> int: ...
def writelines(self, lines: Iterable[str | unicode]) -> None: ...
@overload
def StringIO() -> OutputType: ...

View File

@@ -1,6 +1,6 @@
import datetime
from time import struct_time
from typing import Any, Iterable, List, Optional, Sequence, Tuple, Union
from typing import Any, Iterable, List, Optional, Sequence, Tuple
_LocaleType = Tuple[Optional[str], Optional[str]]
@@ -63,7 +63,7 @@ class HTMLCalendar(Calendar):
def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
def formatmonth(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
def formatyear(self, theyear: int, width: int = ...) -> str: ...
def formatyearpage(self, theyear: int, width: int = ..., css: Optional[str] = ..., encoding: Optional[str] = ...) -> str: ...
def formatyearpage(self, theyear: int, width: int = ..., css: str | None = ..., encoding: str | None = ...) -> str: ...
class TimeEncoding:
def __init__(self, locale: _LocaleType) -> None: ...
@@ -71,12 +71,12 @@ class TimeEncoding:
def __exit__(self, *args: Any) -> None: ...
class LocaleTextCalendar(TextCalendar):
def __init__(self, firstweekday: int = ..., locale: Optional[_LocaleType] = ...) -> None: ...
def __init__(self, firstweekday: int = ..., locale: _LocaleType | None = ...) -> None: ...
def formatweekday(self, day: int, width: int) -> str: ...
def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ...
class LocaleHTMLCalendar(HTMLCalendar):
def __init__(self, firstweekday: int = ..., locale: Optional[_LocaleType] = ...) -> None: ...
def __init__(self, firstweekday: int = ..., locale: _LocaleType | None = ...) -> None: ...
def formatweekday(self, day: int) -> str: ...
def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
@@ -85,7 +85,7 @@ c: TextCalendar
def setfirstweekday(firstweekday: int) -> None: ...
def format(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ...
def formatstring(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ...
def timegm(tuple: Union[Tuple[int, ...], struct_time]) -> int: ...
def timegm(tuple: Tuple[int, ...] | struct_time) -> int: ...
# Data attributes
day_name: Sequence[str]

View File

@@ -1,12 +1,12 @@
from _typeshed import SupportsGetItem, SupportsItemAccess
from builtins import type as _type
from typing import IO, Any, AnyStr, Iterable, Iterator, List, Mapping, Optional, Protocol, TypeVar, Union
from typing import IO, Any, AnyStr, Iterable, Iterator, List, Mapping, Protocol, TypeVar
from UserDict import UserDict
_T = TypeVar("_T", bound=FieldStorage)
def parse(
fp: Optional[IO[Any]] = ...,
fp: IO[Any] | None = ...,
environ: SupportsItemAccess[str, str] = ...,
keep_blank_values: bool = ...,
strict_parsing: bool = ...,
@@ -32,7 +32,7 @@ class MiniFieldStorage:
filename: Any
list: Any
type: Any
file: Optional[IO[bytes]]
file: IO[bytes] | None
type_options: dict[Any, Any]
disposition: Any
disposition_options: dict[Any, Any]
@@ -43,28 +43,28 @@ class MiniFieldStorage:
def __repr__(self) -> str: ...
class FieldStorage(object):
FieldStorageClass: Optional[_type]
FieldStorageClass: _type | None
keep_blank_values: int
strict_parsing: int
qs_on_post: Optional[str]
qs_on_post: str | None
headers: Mapping[str, str]
fp: IO[bytes]
encoding: str
errors: str
outerboundary: bytes
bytes_read: int
limit: Optional[int]
limit: int | None
disposition: str
disposition_options: dict[str, str]
filename: Optional[str]
file: Optional[IO[bytes]]
filename: str | None
file: IO[bytes] | None
type: str
type_options: dict[str, str]
innerboundary: bytes
length: int
done: int
list: Optional[List[Any]]
value: Union[None, bytes, List[Any]]
list: List[Any] | None
value: None | bytes | List[Any]
def __init__(
self,
fp: IO[Any] = ...,

View File

@@ -7,26 +7,19 @@ def reset() -> str: ... # undocumented
def small(text: str) -> str: ... # undocumented
def strong(text: str) -> str: ... # undocumented
def grey(text: str) -> str: ... # undocumented
def lookup(name: str, frame: FrameType, locals: Dict[str, Any]) -> Tuple[Optional[str], Any]: ... # undocumented
def lookup(name: str, frame: FrameType, locals: Dict[str, Any]) -> Tuple[str | None, Any]: ... # undocumented
def scanvars(
reader: Callable[[], bytes], frame: FrameType, locals: Dict[str, Any]
) -> List[Tuple[str, Optional[str], Any]]: ... # undocumented
) -> List[Tuple[str, str | None, Any]]: ... # undocumented
def html(einfo: _ExcInfo, context: int = ...) -> str: ...
def text(einfo: _ExcInfo, context: int = ...) -> str: ...
class Hook: # undocumented
def __init__(
self,
display: int = ...,
logdir: Optional[Text] = ...,
context: int = ...,
file: Optional[IO[str]] = ...,
format: str = ...,
self, display: int = ..., logdir: Text | None = ..., context: int = ..., file: IO[str] | None = ..., format: str = ...
) -> None: ...
def __call__(
self, etype: Optional[Type[BaseException]], evalue: Optional[BaseException], etb: Optional[TracebackType]
) -> None: ...
def handle(self, info: Optional[_ExcInfo] = ...) -> None: ...
def __call__(self, etype: Type[BaseException] | None, evalue: BaseException | None, etb: TracebackType | None) -> None: ...
def handle(self, info: _ExcInfo | None = ...) -> None: ...
def handler(info: Optional[_ExcInfo] = ...) -> None: ...
def enable(display: int = ..., logdir: Optional[Text] = ..., context: int = ..., format: str = ...) -> None: ...
def handler(info: _ExcInfo | None = ...) -> None: ...
def enable(display: int = ..., logdir: Text | None = ..., context: int = ..., format: str = ...) -> None: ...

View File

@@ -1,11 +1,11 @@
from typing import IO, Any, Callable, List, Optional, Tuple
from typing import IO, Any, Callable, List, Tuple
class Cmd:
prompt: str
identchars: str
ruler: str
lastcmd: str
intro: Optional[Any]
intro: Any | None
doc_leader: str
doc_header: str
misc_header: str
@@ -16,24 +16,24 @@ class Cmd:
stdout: IO[str]
cmdqueue: List[str]
completekey: str
def __init__(self, completekey: str = ..., stdin: Optional[IO[str]] = ..., stdout: Optional[IO[str]] = ...) -> None: ...
old_completer: Optional[Callable[[str, int], Optional[str]]]
def cmdloop(self, intro: Optional[Any] = ...) -> None: ...
def __init__(self, completekey: str = ..., stdin: IO[str] | None = ..., stdout: IO[str] | None = ...) -> None: ...
old_completer: Callable[[str, int], str | None] | None
def cmdloop(self, intro: Any | None = ...) -> None: ...
def precmd(self, line: str) -> str: ...
def postcmd(self, stop: bool, line: str) -> bool: ...
def preloop(self) -> None: ...
def postloop(self) -> None: ...
def parseline(self, line: str) -> Tuple[Optional[str], Optional[str], str]: ...
def parseline(self, line: str) -> Tuple[str | None, str | None, str]: ...
def onecmd(self, line: str) -> bool: ...
def emptyline(self) -> bool: ...
def default(self, line: str) -> bool: ...
def completedefault(self, *ignored: Any) -> List[str]: ...
def completenames(self, text: str, *ignored: Any) -> List[str]: ...
completion_matches: Optional[List[str]]
def complete(self, text: str, state: int) -> Optional[List[str]]: ...
completion_matches: List[str] | None
def complete(self, text: str, state: int) -> List[str] | None: ...
def get_names(self) -> List[str]: ...
# Only the first element of args matters.
def complete_help(self, *args: Any) -> List[str]: ...
def do_help(self, arg: str) -> Optional[bool]: ...
def print_topics(self, header: str, cmds: Optional[List[str]], cmdlen: Any, maxcol: int) -> None: ...
def columnize(self, list: Optional[List[str]], displaywidth: int = ...) -> None: ...
def do_help(self, arg: str) -> bool | None: ...
def print_topics(self, header: str, cmds: List[str] | None, cmdlen: Any, maxcol: int) -> None: ...
def columnize(self, list: List[str] | None, displaywidth: int = ...) -> None: ...

View File

@@ -1,22 +1,22 @@
from types import CodeType
from typing import Any, Callable, Mapping, Optional
from typing import Any, Callable, Mapping
class InteractiveInterpreter:
def __init__(self, locals: Optional[Mapping[str, Any]] = ...) -> None: ...
def __init__(self, locals: Mapping[str, Any] | None = ...) -> None: ...
def runsource(self, source: str, filename: str = ..., symbol: str = ...) -> bool: ...
def runcode(self, code: CodeType) -> None: ...
def showsyntaxerror(self, filename: Optional[str] = ...) -> None: ...
def showsyntaxerror(self, filename: str | None = ...) -> None: ...
def showtraceback(self) -> None: ...
def write(self, data: str) -> None: ...
class InteractiveConsole(InteractiveInterpreter):
def __init__(self, locals: Optional[Mapping[str, Any]] = ..., filename: str = ...) -> None: ...
def interact(self, banner: Optional[str] = ...) -> None: ...
def __init__(self, locals: Mapping[str, Any] | None = ..., filename: str = ...) -> None: ...
def interact(self, banner: str | None = ...) -> None: ...
def push(self, line: str) -> bool: ...
def resetbuffer(self) -> None: ...
def raw_input(self, prompt: str = ...) -> str: ...
def interact(
banner: Optional[str] = ..., readfunc: Optional[Callable[[str], str]] = ..., local: Optional[Mapping[str, Any]] = ...
banner: str | None = ..., readfunc: Callable[[str], str] | None = ..., local: Mapping[str, Any] | None = ...
) -> None: ...
def compile_command(source: str, filename: str = ..., symbol: str = ...) -> Optional[CodeType]: ...
def compile_command(source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ...

View File

@@ -9,7 +9,6 @@ from typing import (
Iterable,
Iterator,
List,
Optional,
Protocol,
Text,
TextIO,
@@ -83,9 +82,9 @@ def decode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = .
def decode(obj: _Encoded, encoding: str = ..., errors: str = ...) -> _Decoded: ...
def lookup(__encoding: str) -> CodecInfo: ...
def utf_16_be_decode(
__data: _Encoded, __errors: Optional[str] = ..., __final: bool = ...
__data: _Encoded, __errors: str | None = ..., __final: bool = ...
) -> Tuple[_Decoded, int]: ... # undocumented
def utf_16_be_encode(__str: _Decoded, __errors: Optional[str] = ...) -> Tuple[_Encoded, int]: ... # undocumented
def utf_16_be_encode(__str: _Decoded, __errors: str | None = ...) -> Tuple[_Encoded, int]: ... # undocumented
class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
@property
@@ -105,13 +104,13 @@ class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
cls,
encode: _Encoder,
decode: _Decoder,
streamreader: Optional[_StreamReader] = ...,
streamwriter: Optional[_StreamWriter] = ...,
incrementalencoder: Optional[_IncrementalEncoder] = ...,
incrementaldecoder: Optional[_IncrementalDecoder] = ...,
name: Optional[str] = ...,
streamreader: _StreamReader | None = ...,
streamwriter: _StreamWriter | None = ...,
incrementalencoder: _IncrementalEncoder | None = ...,
incrementaldecoder: _IncrementalDecoder | None = ...,
name: str | None = ...,
*,
_is_text_encoding: Optional[bool] = ...,
_is_text_encoding: bool | None = ...,
) -> CodecInfo: ...
def getencoder(encoding: str) -> _Encoder: ...
@@ -120,13 +119,11 @@ def getincrementalencoder(encoding: str) -> _IncrementalEncoder: ...
def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ...
def getreader(encoding: str) -> _StreamReader: ...
def getwriter(encoding: str) -> _StreamWriter: ...
def register(__search_function: Callable[[str], Optional[CodecInfo]]) -> None: ...
def register(__search_function: Callable[[str], CodecInfo | None]) -> None: ...
def open(
filename: str, mode: str = ..., encoding: Optional[str] = ..., errors: str = ..., buffering: int = ...
filename: str, mode: str = ..., encoding: str | None = ..., errors: str = ..., buffering: int = ...
) -> StreamReaderWriter: ...
def EncodedFile(
file: IO[_Encoded], data_encoding: str, file_encoding: Optional[str] = ..., errors: str = ...
) -> StreamRecoder: ...
def EncodedFile(file: IO[_Encoded], data_encoding: str, file_encoding: str | None = ..., errors: str = ...) -> StreamRecoder: ...
def iterencode(iterator: Iterable[_Decoded], encoding: str, errors: str = ...) -> Generator[_Encoded, None, None]: ...
def iterdecode(iterator: Iterable[_Encoded], encoding: str, errors: str = ...) -> Generator[_Decoded, None, None]: ...
@@ -144,13 +141,13 @@ BOM_UTF32_LE: bytes
# It is expected that different actions be taken depending on which of the
# three subclasses of `UnicodeError` is actually ...ed. However, the Union
# is still needed for at least one of the cases.
def register_error(__errors: str, __handler: Callable[[UnicodeError], Tuple[Union[str, bytes], int]]) -> None: ...
def lookup_error(__name: str) -> Callable[[UnicodeError], Tuple[Union[str, bytes], int]]: ...
def strict_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]: ...
def replace_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]: ...
def ignore_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]: ...
def xmlcharrefreplace_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]: ...
def backslashreplace_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]: ...
def register_error(__errors: str, __handler: Callable[[UnicodeError], Tuple[str | bytes, int]]) -> None: ...
def lookup_error(__name: str) -> Callable[[UnicodeError], Tuple[str | bytes, int]]: ...
def strict_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ...
def replace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ...
def ignore_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ...
def xmlcharrefreplace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ...
def backslashreplace_errors(exception: UnicodeError) -> Tuple[str | bytes, int]: ...
class Codec:
# These are sort of @abstractmethod but sort of not.
@@ -165,8 +162,8 @@ class IncrementalEncoder:
def encode(self, input: _Decoded, final: bool = ...) -> _Encoded: ...
def reset(self) -> None: ...
# documentation says int but str is needed for the subclass.
def getstate(self) -> Union[int, _Decoded]: ...
def setstate(self, state: Union[int, _Decoded]) -> None: ...
def getstate(self) -> int | _Decoded: ...
def setstate(self, state: int | _Decoded) -> None: ...
class IncrementalDecoder:
errors: str
@@ -203,9 +200,7 @@ class StreamWriter(Codec):
def writelines(self, list: Iterable[_Decoded]) -> None: ...
def reset(self) -> None: ...
def __enter__(self: _SW) -> _SW: ...
def __exit__(
self, typ: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[types.TracebackType]
) -> None: ...
def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ...
_SR = TypeVar("_SR", bound=StreamReader)
@@ -214,13 +209,11 @@ class StreamReader(Codec):
errors: str
def __init__(self, stream: IO[_Encoded], errors: str = ...) -> None: ...
def read(self, size: int = ..., chars: int = ..., firstline: bool = ...) -> _Decoded: ...
def readline(self, size: Optional[int] = ..., keepends: bool = ...) -> _Decoded: ...
def readlines(self, sizehint: Optional[int] = ..., keepends: bool = ...) -> List[_Decoded]: ...
def readline(self, size: int | None = ..., keepends: bool = ...) -> _Decoded: ...
def readlines(self, sizehint: int | None = ..., keepends: bool = ...) -> List[_Decoded]: ...
def reset(self) -> None: ...
def __enter__(self: _SR) -> _SR: ...
def __exit__(
self, typ: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[types.TracebackType]
) -> None: ...
def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
def __iter__(self) -> Iterator[_Decoded]: ...
def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ...
@@ -231,8 +224,8 @@ _T = TypeVar("_T", bound=StreamReaderWriter)
class StreamReaderWriter(TextIO):
def __init__(self, stream: IO[_Encoded], Reader: _StreamReader, Writer: _StreamWriter, errors: str = ...) -> None: ...
def read(self, size: int = ...) -> _Decoded: ...
def readline(self, size: Optional[int] = ...) -> _Decoded: ...
def readlines(self, sizehint: Optional[int] = ...) -> List[_Decoded]: ...
def readline(self, size: int | None = ...) -> _Decoded: ...
def readlines(self, sizehint: int | None = ...) -> List[_Decoded]: ...
def next(self) -> Text: ...
def __iter__(self: _T) -> _T: ...
# This actually returns None, but that's incompatible with the supertype
@@ -242,9 +235,7 @@ class StreamReaderWriter(TextIO):
# Same as write()
def seek(self, offset: int, whence: int = ...) -> int: ...
def __enter__(self: _T) -> _T: ...
def __exit__(
self, typ: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[types.TracebackType]
) -> None: ...
def __exit__(self, typ: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
def __getattr__(self, name: str) -> Any: ...
# These methods don't actually exist directly, but they are needed to satisfy the TextIO
# interface. At runtime, they are delegated through __getattr__.
@@ -253,7 +244,7 @@ class StreamReaderWriter(TextIO):
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def readable(self) -> bool: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def truncate(self, size: int | None = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def writable(self) -> bool: ...
@@ -271,8 +262,8 @@ class StreamRecoder(BinaryIO):
errors: str = ...,
) -> None: ...
def read(self, size: int = ...) -> bytes: ...
def readline(self, size: Optional[int] = ...) -> bytes: ...
def readlines(self, sizehint: Optional[int] = ...) -> List[bytes]: ...
def readline(self, size: int | None = ...) -> bytes: ...
def readlines(self, sizehint: int | None = ...) -> List[bytes]: ...
def next(self) -> bytes: ...
def __iter__(self: _SRT) -> _SRT: ...
def write(self, data: bytes) -> int: ...
@@ -280,9 +271,7 @@ class StreamRecoder(BinaryIO):
def reset(self) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def __enter__(self: _SRT) -> _SRT: ...
def __exit__(
self, type: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType]
) -> None: ...
def __exit__(self, type: Type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
# These methods don't actually exist directly, but they are needed to satisfy the BinaryIO
# interface. At runtime, they are delegated through __getattr__.
def seek(self, offset: int, whence: int = ...) -> int: ...
@@ -291,7 +280,7 @@ class StreamRecoder(BinaryIO):
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def readable(self) -> bool: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def truncate(self, size: int | None = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def writable(self) -> bool: ...

View File

@@ -1,7 +1,6 @@
from types import CodeType
from typing import Optional
def compile_command(source: str, filename: str = ..., symbol: str = ...) -> Optional[CodeType]: ...
def compile_command(source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ...
class Compile:
flags: int
@@ -11,4 +10,4 @@ class Compile:
class CommandCompiler:
compiler: Compile
def __init__(self) -> None: ...
def __call__(self, source: str, filename: str = ..., symbol: str = ...) -> Optional[CodeType]: ...
def __call__(self, source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ...

View File

@@ -16,14 +16,12 @@ from typing import (
MutableMapping as MutableMapping,
MutableSequence as MutableSequence,
MutableSet as MutableSet,
Optional,
Reversible,
Sequence as Sequence,
Sized as Sized,
Tuple,
Type,
TypeVar,
Union,
ValuesView as ValuesView,
overload,
)
@@ -37,16 +35,13 @@ _VT = TypeVar("_VT")
# namedtuple is special-cased in the type checker; the initializer is ignored.
def namedtuple(
typename: Union[str, unicode],
field_names: Union[str, unicode, Iterable[Union[str, unicode]]],
verbose: bool = ...,
rename: bool = ...,
typename: str | unicode, field_names: str | unicode | Iterable[str | unicode], verbose: bool = ..., rename: bool = ...
) -> Type[Tuple[Any, ...]]: ...
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ..., maxlen: int = ...) -> None: ...
@property
def maxlen(self) -> Optional[int]: ...
def maxlen(self) -> int | None: ...
def append(self, x: _T) -> None: ...
def appendleft(self, x: _T) -> None: ...
def clear(self) -> None: ...
@@ -77,7 +72,7 @@ class Counter(Dict[_T, int], Generic[_T]):
def __init__(self, iterable: Iterable[_T]) -> None: ...
def copy(self: _S) -> _S: ...
def elements(self) -> Iterator[_T]: ...
def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ...
def most_common(self, n: int | None = ...) -> List[Tuple[_T, int]]: ...
@overload
def subtract(self, __mapping: Mapping[_T, int]) -> None: ...
@overload
@@ -90,7 +85,7 @@ class Counter(Dict[_T, int], Generic[_T]):
@overload
def update(self, __m: Mapping[_T, int], **kwargs: int) -> None: ...
@overload
def update(self, __m: Union[Iterable[_T], Iterable[Tuple[_T, int]]], **kwargs: int) -> None: ...
def update(self, __m: Iterable[_T] | Iterable[Tuple[_T, int]], **kwargs: int) -> None: ...
@overload
def update(self, **kwargs: int) -> None: ...
def __add__(self, other: Counter[_T]) -> Counter[_T]: ...
@@ -112,18 +107,16 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
@overload
def __init__(self, **kwargs: _VT) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]]) -> None: ...
def __init__(self, default_factory: Callable[[], _VT] | None) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], **kwargs: _VT) -> None: ...
def __init__(self, default_factory: Callable[[], _VT] | None, **kwargs: _VT) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT]) -> None: ...
def __init__(self, default_factory: Callable[[], _VT] | None, map: Mapping[_KT, _VT]) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
def __init__(self, default_factory: Callable[[], _VT] | None, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
@overload
def __init__(
self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT
) -> None: ...
def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
def __missing__(self, key: _KT) -> _VT: ...
def copy(self: _S) -> _S: ...

View File

@@ -1,15 +1,10 @@
from typing import Any, Optional, Pattern, Text
from typing import Any, Pattern, Text
# rx can be any object with a 'search' method; once we have Protocols we can change the type
def compile_dir(
dir: Text,
maxlevels: int = ...,
ddir: Optional[Text] = ...,
force: bool = ...,
rx: Optional[Pattern[Any]] = ...,
quiet: int = ...,
dir: Text, maxlevels: int = ..., ddir: Text | None = ..., force: bool = ..., rx: Pattern[Any] | None = ..., quiet: int = ...
) -> int: ...
def compile_file(
fullname: Text, ddir: Optional[Text] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...
fullname: Text, ddir: Text | None = ..., force: bool = ..., rx: Pattern[Any] | None = ..., quiet: int = ...
) -> int: ...
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any
class Cookie:
version: Any
@@ -38,9 +38,9 @@ class Cookie:
rfc2109: bool = ...,
): ...
def has_nonstandard_attr(self, name): ...
def get_nonstandard_attr(self, name, default: Optional[Any] = ...): ...
def get_nonstandard_attr(self, name, default: Any | None = ...): ...
def set_nonstandard_attr(self, name, value): ...
def is_expired(self, now: Optional[Any] = ...): ...
def is_expired(self, now: Any | None = ...): ...
class CookiePolicy:
def set_ok(self, cookie, request): ...
@@ -66,11 +66,11 @@ class DefaultCookiePolicy(CookiePolicy):
strict_ns_set_path: Any
def __init__(
self,
blocked_domains: Optional[Any] = ...,
allowed_domains: Optional[Any] = ...,
blocked_domains: Any | None = ...,
allowed_domains: Any | None = ...,
netscape: bool = ...,
rfc2965: bool = ...,
rfc2109_as_netscape: Optional[Any] = ...,
rfc2109_as_netscape: Any | None = ...,
hide_cookie2: bool = ...,
strict_domain: bool = ...,
strict_rfc2965_unverifiable: bool = ...,
@@ -111,14 +111,14 @@ class CookieJar:
domain_re: Any
dots_re: Any
magic_re: Any
def __init__(self, policy: Optional[Any] = ...): ...
def __init__(self, policy: Any | None = ...): ...
def set_policy(self, policy): ...
def add_cookie_header(self, request): ...
def make_cookies(self, response, request): ...
def set_cookie_if_ok(self, cookie, request): ...
def set_cookie(self, cookie): ...
def extract_cookies(self, response, request): ...
def clear(self, domain: Optional[Any] = ..., path: Optional[Any] = ..., name: Optional[Any] = ...): ...
def clear(self, domain: Any | None = ..., path: Any | None = ..., name: Any | None = ...): ...
def clear_session_cookies(self): ...
def clear_expired_cookies(self): ...
def __iter__(self): ...
@@ -129,10 +129,10 @@ class LoadError(IOError): ...
class FileCookieJar(CookieJar):
filename: Any
delayload: Any
def __init__(self, filename: Optional[Any] = ..., delayload: bool = ..., policy: Optional[Any] = ...): ...
def save(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
def load(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
def revert(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
def __init__(self, filename: Any | None = ..., delayload: bool = ..., policy: Any | None = ...): ...
def save(self, filename: Any | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
def load(self, filename: Any | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
def revert(self, filename: Any | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
class LWPCookieJar(FileCookieJar):
def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Optional, TypeVar
from typing import Any, Dict, TypeVar
_T = TypeVar("_T")
@@ -6,7 +6,7 @@ _T = TypeVar("_T")
PyStringMap: Any
# Note: memo and _nil are internal kwargs.
def deepcopy(x: _T, memo: Optional[Dict[int, Any]] = ..., _nil: Any = ...) -> _T: ...
def deepcopy(x: _T, memo: Dict[int, Any] | None = ..., _nil: Any = ...) -> _T: ...
def copy(x: _T) -> _T: ...
class Error(Exception): ...

View File

@@ -7,8 +7,8 @@ __all__: List[str]
def pickle(
ob_type: _TypeT,
pickle_function: Callable[[_TypeT], Union[str, _Reduce[_TypeT]]],
constructor_ob: Optional[Callable[[_Reduce[_TypeT]], _TypeT]] = ...,
pickle_function: Callable[[_TypeT], str | _Reduce[_TypeT]],
constructor_ob: Callable[[_Reduce[_TypeT]], _TypeT] | None = ...,
) -> None: ...
def constructor(object: Callable[[_Reduce[_TypeT]], _TypeT]) -> None: ...
def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ...

View File

@@ -7,8 +7,8 @@ __all__: List[str]
def pickle(
ob_type: _TypeT,
pickle_function: Callable[[_TypeT], Union[str, _Reduce[_TypeT]]],
constructor_ob: Optional[Callable[[_Reduce[_TypeT]], _TypeT]] = ...,
pickle_function: Callable[[_TypeT], str | _Reduce[_TypeT]],
constructor_ob: Callable[[_Reduce[_TypeT]], _TypeT] | None = ...,
) -> None: ...
def constructor(object: Callable[[_Reduce[_TypeT]], _TypeT]) -> None: ...
def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ...

View File

@@ -24,7 +24,6 @@ from typing import (
Iterator,
List,
Mapping,
Optional,
Sequence,
Text,
Type,
@@ -46,9 +45,9 @@ class excel_tab(excel):
delimiter: str
class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
fieldnames: Optional[Sequence[_T]]
restkey: Optional[str]
restval: Optional[str]
fieldnames: Sequence[_T] | None
restkey: str | None
restval: str | None
reader: _reader
dialect: _DialectLike
line_num: int
@@ -57,8 +56,8 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
self,
f: Iterable[Text],
fieldnames: Sequence[_T],
restkey: Optional[str] = ...,
restval: Optional[str] = ...,
restkey: str | None = ...,
restval: str | None = ...,
dialect: _DialectLike = ...,
*args: Any,
**kwds: Any,
@@ -67,9 +66,9 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
def __init__(
self: DictReader[str],
f: Iterable[Text],
fieldnames: Optional[Sequence[str]] = ...,
restkey: Optional[str] = ...,
restval: Optional[str] = ...,
fieldnames: Sequence[str] | None = ...,
restkey: str | None = ...,
restval: str | None = ...,
dialect: _DialectLike = ...,
*args: Any,
**kwds: Any,
@@ -79,14 +78,14 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
class DictWriter(Generic[_T]):
fieldnames: Sequence[_T]
restval: Optional[Any]
restval: Any | None
extrasaction: str
writer: _writer
def __init__(
self,
f: Any,
fieldnames: Sequence[_T],
restval: Optional[Any] = ...,
restval: Any | None = ...,
extrasaction: str = ...,
dialect: _DialectLike = ...,
*args: Any,
@@ -99,5 +98,5 @@ class DictWriter(Generic[_T]):
class Sniffer(object):
preferred: List[str]
def __init__(self) -> None: ...
def sniff(self, sample: str, delimiters: Optional[str] = ...) -> Type[Dialect]: ...
def sniff(self, sample: str, delimiters: str | None = ...) -> Type[Dialect]: ...
def has_header(self, sample: str) -> bool: ...

View File

@@ -34,7 +34,7 @@ class CDLL(object):
_handle: int = ...
_FuncPtr: Type[_FuncPointer] = ...
def __init__(
self, name: Optional[str], mode: int = ..., handle: Optional[int] = ..., use_errno: bool = ..., use_last_error: bool = ...
self, name: str | None, mode: int = ..., handle: int | None = ..., use_errno: bool = ..., use_last_error: bool = ...
) -> None: ...
def __getattr__(self, name: str) -> _NamedFuncPointer: ...
def __getitem__(self, name: str) -> _NamedFuncPointer: ...
@@ -75,7 +75,7 @@ class _CDataMeta(type):
class _CData(metaclass=_CDataMeta):
_b_base: int = ...
_b_needsfree_: bool = ...
_objects: Optional[Mapping[Any, int]] = ...
_objects: Mapping[Any, int] | None = ...
@classmethod
def from_buffer(cls: Type[_CT], source: _WritableBuffer, offset: int = ...) -> _CT: ...
@classmethod
@@ -113,15 +113,15 @@ class _NamedFuncPointer(_FuncPointer):
class ArgumentError(Exception): ...
def CFUNCTYPE(
restype: Optional[Type[_CData]], *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ...
restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ...
) -> Type[_FuncPointer]: ...
if sys.platform == "win32":
def WINFUNCTYPE(
restype: Optional[Type[_CData]], *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ...
restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ...
) -> Type[_FuncPointer]: ...
def PYFUNCTYPE(restype: Optional[Type[_CData]], *argtypes: Type[_CData]) -> Type[_FuncPointer]: ...
def PYFUNCTYPE(restype: Type[_CData] | None, *argtypes: Type[_CData]) -> Type[_FuncPointer]: ...
class _CArgObject: ...
@@ -141,11 +141,11 @@ def byref(obj: _CData, offset: int = ...) -> _CArgObject: ...
_CastT = TypeVar("_CastT", bound=_CanCastTo)
def cast(obj: _UnionT[_CData, _CArgObject, int], typ: Type[_CastT]) -> _CastT: ...
def create_string_buffer(init: _UnionT[int, bytes], size: Optional[int] = ...) -> Array[c_char]: ...
def create_string_buffer(init: _UnionT[int, bytes], size: int | None = ...) -> Array[c_char]: ...
c_buffer = create_string_buffer
def create_unicode_buffer(init: _UnionT[int, Text], size: Optional[int] = ...) -> Array[c_wchar]: ...
def create_unicode_buffer(init: _UnionT[int, Text], size: int | None = ...) -> Array[c_wchar]: ...
if sys.platform == "win32":
def DllCanUnloadNow() -> int: ...
@@ -189,7 +189,7 @@ def sizeof(obj_or_type: _UnionT[_CData, Type[_CData]]) -> int: ...
def string_at(address: _CVoidConstPLike, size: int = ...) -> bytes: ...
if sys.platform == "win32":
def WinError(code: Optional[int] = ..., descr: Optional[str] = ...) -> OSError: ...
def WinError(code: int | None = ..., descr: str | None = ...) -> OSError: ...
def wstring_at(address: _CVoidConstPLike, size: int = ...) -> str: ...
@@ -203,7 +203,7 @@ class c_char(_SimpleCData[bytes]):
def __init__(self, value: _UnionT[int, bytes] = ...) -> None: ...
class c_char_p(_PointerLike, _SimpleCData[Optional[bytes]]):
def __init__(self, value: Optional[_UnionT[int, bytes]] = ...) -> None: ...
def __init__(self, value: _UnionT[int, bytes] | None = ...) -> None: ...
class c_double(_SimpleCData[float]): ...
class c_longdouble(_SimpleCData[float]): ...
@@ -231,7 +231,7 @@ class c_void_p(_PointerLike, _SimpleCData[Optional[int]]): ...
class c_wchar(_SimpleCData[Text]): ...
class c_wchar_p(_PointerLike, _SimpleCData[Optional[Text]]):
def __init__(self, value: Optional[_UnionT[int, Text]] = ...) -> None: ...
def __init__(self, value: _UnionT[int, Text] | None = ...) -> None: ...
class c_bool(_SimpleCData[bool]):
def __init__(self, value: bool = ...) -> None: ...

View File

@@ -1,7 +1,6 @@
import sys
from typing import Optional
def find_library(name: str) -> Optional[str]: ...
def find_library(name: str) -> str | None: ...
if sys.platform == "win32":
def find_msvcrt() -> Optional[str]: ...
def find_msvcrt() -> str | None: ...

View File

@@ -1,4 +1,4 @@
from typing import List, TypeVar, Union
from typing import List, TypeVar
_CharT = TypeVar("_CharT", str, int)
@@ -41,22 +41,22 @@ DEL: int
controlnames: List[int]
def isalnum(c: Union[str, int]) -> bool: ...
def isalpha(c: Union[str, int]) -> bool: ...
def isascii(c: Union[str, int]) -> bool: ...
def isblank(c: Union[str, int]) -> bool: ...
def iscntrl(c: Union[str, int]) -> bool: ...
def isdigit(c: Union[str, int]) -> bool: ...
def isgraph(c: Union[str, int]) -> bool: ...
def islower(c: Union[str, int]) -> bool: ...
def isprint(c: Union[str, int]) -> bool: ...
def ispunct(c: Union[str, int]) -> bool: ...
def isspace(c: Union[str, int]) -> bool: ...
def isupper(c: Union[str, int]) -> bool: ...
def isxdigit(c: Union[str, int]) -> bool: ...
def isctrl(c: Union[str, int]) -> bool: ...
def ismeta(c: Union[str, int]) -> bool: ...
def isalnum(c: str | int) -> bool: ...
def isalpha(c: str | int) -> bool: ...
def isascii(c: str | int) -> bool: ...
def isblank(c: str | int) -> bool: ...
def iscntrl(c: str | int) -> bool: ...
def isdigit(c: str | int) -> bool: ...
def isgraph(c: str | int) -> bool: ...
def islower(c: str | int) -> bool: ...
def isprint(c: str | int) -> bool: ...
def ispunct(c: str | int) -> bool: ...
def isspace(c: str | int) -> bool: ...
def isupper(c: str | int) -> bool: ...
def isxdigit(c: str | int) -> bool: ...
def isctrl(c: str | int) -> bool: ...
def ismeta(c: str | int) -> bool: ...
def ascii(c: _CharT) -> _CharT: ...
def ctrl(c: _CharT) -> _CharT: ...
def alt(c: _CharT) -> _CharT: ...
def unctrl(c: Union[str, int]) -> str: ...
def unctrl(c: str | int) -> str: ...

View File

@@ -1,11 +1,11 @@
from _curses import _CursesWindow
from typing import Callable, Optional, Union
from typing import Callable
def rectangle(win: _CursesWindow, uly: int, ulx: int, lry: int, lrx: int) -> None: ...
class Textbox:
stripspaces: bool
def __init__(self, win: _CursesWindow, insert_mode: bool = ...) -> None: ...
def edit(self, validate: Optional[Callable[[int], int]] = ...) -> str: ...
def do_command(self, ch: Union[str, int]) -> None: ...
def edit(self, validate: Callable[[int], int] | None = ...) -> str: ...
def do_command(self, ch: str | int) -> None: ...
def gather(self) -> str: ...

View File

@@ -1,5 +1,5 @@
from time import struct_time
from typing import AnyStr, ClassVar, Optional, SupportsAbs, Tuple, Type, TypeVar, Union, overload
from typing import AnyStr, ClassVar, SupportsAbs, Tuple, Type, TypeVar, Union, overload
_S = TypeVar("_S")
@@ -9,9 +9,9 @@ MINYEAR: int
MAXYEAR: int
class tzinfo:
def tzname(self, dt: Optional[datetime]) -> Optional[str]: ...
def utcoffset(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
def dst(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
def tzname(self, dt: datetime | None) -> str | None: ...
def utcoffset(self, dt: datetime | None) -> timedelta | None: ...
def dst(self, dt: datetime | None) -> timedelta | None: ...
def fromutc(self, dt: datetime) -> datetime: ...
_tzinfo = tzinfo
@@ -60,12 +60,7 @@ class time:
max: ClassVar[time]
resolution: ClassVar[timedelta]
def __new__(
cls: Type[_S],
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
cls: Type[_S], hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: _tzinfo | None = ...
) -> _S: ...
@property
def hour(self) -> int: ...
@@ -76,7 +71,7 @@ class time:
@property
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> Optional[_tzinfo]: ...
def tzinfo(self) -> _tzinfo | None: ...
def __le__(self, other: time) -> bool: ...
def __lt__(self, other: time) -> bool: ...
def __ge__(self, other: time) -> bool: ...
@@ -85,11 +80,11 @@ class time:
def isoformat(self) -> str: ...
def strftime(self, fmt: _Text) -> str: ...
def __format__(self, fmt: AnyStr) -> AnyStr: ...
def utcoffset(self) -> Optional[timedelta]: ...
def tzname(self) -> Optional[str]: ...
def dst(self) -> Optional[timedelta]: ...
def utcoffset(self) -> timedelta | None: ...
def tzname(self) -> str | None: ...
def dst(self) -> timedelta | None: ...
def replace(
self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: Optional[_tzinfo] = ...
self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: _tzinfo | None = ...
) -> time: ...
_date = date
@@ -152,7 +147,7 @@ class datetime(date):
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
tzinfo: _tzinfo | None = ...,
) -> _S: ...
@property
def year(self) -> int: ...
@@ -169,9 +164,9 @@ class datetime(date):
@property
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> Optional[_tzinfo]: ...
def tzinfo(self) -> _tzinfo | None: ...
@classmethod
def fromtimestamp(cls: Type[_S], t: float, tz: Optional[_tzinfo] = ...) -> _S: ...
def fromtimestamp(cls: Type[_S], t: float, tz: _tzinfo | None = ...) -> _S: ...
@classmethod
def utcfromtimestamp(cls: Type[_S], t: float) -> _S: ...
@classmethod
@@ -205,16 +200,16 @@ class datetime(date):
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
tzinfo: _tzinfo | None = ...,
) -> datetime: ...
def astimezone(self, tz: _tzinfo) -> datetime: ...
def ctime(self) -> str: ...
def isoformat(self, sep: str = ...) -> str: ...
@classmethod
def strptime(cls, date_string: _Text, format: _Text) -> datetime: ...
def utcoffset(self) -> Optional[timedelta]: ...
def tzname(self) -> Optional[str]: ...
def dst(self) -> Optional[timedelta]: ...
def utcoffset(self) -> timedelta | None: ...
def tzname(self) -> str | None: ...
def dst(self) -> timedelta | None: ...
def __le__(self, other: datetime) -> bool: ... # type: ignore
def __lt__(self, other: datetime) -> bool: ... # type: ignore
def __ge__(self, other: datetime) -> bool: ... # type: ignore

View File

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import Iterator, MutableMapping, Optional, Tuple, Type, Union
from typing import Iterator, MutableMapping, Tuple, Type, Union
from typing_extensions import Literal
_KeyType = Union[str, bytes]
@@ -15,7 +15,7 @@ class _Database(MutableMapping[_KeyType, bytes]):
def __del__(self) -> None: ...
def __enter__(self) -> _Database: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class _error(Exception): ...

View File

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import Iterator, MutableMapping, Optional, Type, Union
from typing import Iterator, MutableMapping, Type, Union
_KeyType = Union[str, bytes]
_ValueType = Union[str, bytes]
@@ -19,7 +19,7 @@ class _Database(MutableMapping[_KeyType, bytes]):
def __del__(self) -> None: ...
def __enter__(self) -> _Database: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def open(file: str, flag: str = ..., mode: int = ...) -> _Database: ...

View File

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import List, Optional, Type, TypeVar, Union, overload
from typing import List, Type, TypeVar, Union, overload
_T = TypeVar("_T")
_KeyType = Union[str, bytes]
@@ -9,8 +9,8 @@ class error(OSError): ...
# Actual typename gdbm, not exposed by the implementation
class _gdbm:
def firstkey(self) -> Optional[bytes]: ...
def nextkey(self, key: _KeyType) -> Optional[bytes]: ...
def firstkey(self) -> bytes | None: ...
def nextkey(self, key: _KeyType) -> bytes | None: ...
def reorganize(self) -> None: ...
def sync(self) -> None: ...
def close(self) -> None: ...
@@ -20,12 +20,12 @@ class _gdbm:
def __len__(self) -> int: ...
def __enter__(self) -> _gdbm: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
@overload
def get(self, k: _KeyType) -> Optional[bytes]: ...
def get(self, k: _KeyType) -> bytes | None: ...
@overload
def get(self, k: _KeyType, default: Union[bytes, _T]) -> Union[bytes, _T]: ...
def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ...
def keys(self) -> List[bytes]: ...
def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ...
# Don't exist at runtime

View File

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import List, Optional, Type, TypeVar, Union, overload
from typing import List, Type, TypeVar, Union, overload
_T = TypeVar("_T")
_KeyType = Union[str, bytes]
@@ -19,12 +19,12 @@ class _dbm:
def __del__(self) -> None: ...
def __enter__(self) -> _dbm: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
@overload
def get(self, k: _KeyType) -> Optional[bytes]: ...
def get(self, k: _KeyType) -> bytes | None: ...
@overload
def get(self, k: _KeyType, default: Union[bytes, _T]) -> Union[bytes, _T]: ...
def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ...
def keys(self) -> List[bytes]: ...
def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ...
# Don't exist at runtime

View File

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import Any, Container, Dict, List, NamedTuple, Optional, Sequence, Text, Tuple, Type, TypeVar, Union
from typing import Any, Container, Dict, List, NamedTuple, Sequence, Text, Tuple, Type, TypeVar, Union
_Decimal = Union[Decimal, int]
_DecimalNew = Union[Decimal, float, Text, Tuple[int, Sequence[int], int]]
@@ -21,7 +21,7 @@ ROUND_HALF_DOWN: str
ROUND_05UP: str
class DecimalException(ArithmeticError):
def handle(self, context: Context, *args: Any) -> Optional[Decimal]: ...
def handle(self, context: Context, *args: Any) -> Decimal | None: ...
class Clamped(DecimalException): ...
class InvalidOperation(DecimalException): ...
@@ -38,45 +38,45 @@ class Underflow(Inexact, Rounded, Subnormal): ...
def setcontext(__context: Context) -> None: ...
def getcontext() -> Context: ...
def localcontext(ctx: Optional[Context] = ...) -> _ContextManager: ...
def localcontext(ctx: Context | None = ...) -> _ContextManager: ...
class Decimal(object):
def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Optional[Context] = ...) -> _DecimalT: ...
def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Context | None = ...) -> _DecimalT: ...
@classmethod
def from_float(cls, __f: float) -> Decimal: ...
def __nonzero__(self) -> bool: ...
def __div__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rdiv__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __ne__(self, other: object, context: Optional[Context] = ...) -> bool: ...
def compare(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __div__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __rdiv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __ne__(self, other: object, context: Context | None = ...) -> bool: ...
def compare(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __hash__(self) -> int: ...
def as_tuple(self) -> DecimalTuple: ...
def to_eng_string(self, context: Optional[Context] = ...) -> str: ...
def __abs__(self, round: bool = ..., context: Optional[Context] = ...) -> Decimal: ...
def __add__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __divmod__(self, other: _Decimal, context: Optional[Context] = ...) -> Tuple[Decimal, Decimal]: ...
def __eq__(self, other: object, context: Optional[Context] = ...) -> bool: ...
def __floordiv__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __ge__(self, other: _ComparableNum, context: Optional[Context] = ...) -> bool: ...
def __gt__(self, other: _ComparableNum, context: Optional[Context] = ...) -> bool: ...
def __le__(self, other: _ComparableNum, context: Optional[Context] = ...) -> bool: ...
def __lt__(self, other: _ComparableNum, context: Optional[Context] = ...) -> bool: ...
def __mod__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __mul__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __neg__(self, context: Optional[Context] = ...) -> Decimal: ...
def __pos__(self, context: Optional[Context] = ...) -> Decimal: ...
def __pow__(self, other: _Decimal, modulo: Optional[_Decimal] = ..., context: Optional[Context] = ...) -> Decimal: ...
def __radd__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rdivmod__(self, other: _Decimal, context: Optional[Context] = ...) -> Tuple[Decimal, Decimal]: ...
def __rfloordiv__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rmod__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rmul__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rsub__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rtruediv__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __str__(self, eng: bool = ..., context: Optional[Context] = ...) -> str: ...
def __sub__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __truediv__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def remainder_near(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def to_eng_string(self, context: Context | None = ...) -> str: ...
def __abs__(self, round: bool = ..., context: Context | None = ...) -> Decimal: ...
def __add__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __divmod__(self, other: _Decimal, context: Context | None = ...) -> Tuple[Decimal, Decimal]: ...
def __eq__(self, other: object, context: Context | None = ...) -> bool: ...
def __floordiv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __ge__(self, other: _ComparableNum, context: Context | None = ...) -> bool: ...
def __gt__(self, other: _ComparableNum, context: Context | None = ...) -> bool: ...
def __le__(self, other: _ComparableNum, context: Context | None = ...) -> bool: ...
def __lt__(self, other: _ComparableNum, context: Context | None = ...) -> bool: ...
def __mod__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __mul__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __neg__(self, context: Context | None = ...) -> Decimal: ...
def __pos__(self, context: Context | None = ...) -> Decimal: ...
def __pow__(self, other: _Decimal, modulo: _Decimal | None = ..., context: Context | None = ...) -> Decimal: ...
def __radd__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __rdivmod__(self, other: _Decimal, context: Context | None = ...) -> Tuple[Decimal, Decimal]: ...
def __rfloordiv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __rmod__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __rmul__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __rsub__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __rtruediv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __str__(self, eng: bool = ..., context: Context | None = ...) -> str: ...
def __sub__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __truediv__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def remainder_near(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __float__(self) -> float: ...
def __int__(self) -> int: ...
def __trunc__(self) -> int: ...
@@ -87,66 +87,66 @@ class Decimal(object):
def conjugate(self) -> Decimal: ...
def __complex__(self) -> complex: ...
def __long__(self) -> long: ...
def fma(self, other: _Decimal, third: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __rpow__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def normalize(self, context: Optional[Context] = ...) -> Decimal: ...
def fma(self, other: _Decimal, third: _Decimal, context: Context | None = ...) -> Decimal: ...
def __rpow__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def normalize(self, context: Context | None = ...) -> Decimal: ...
def quantize(
self, exp: _Decimal, rounding: Optional[str] = ..., context: Optional[Context] = ..., watchexp: bool = ...
self, exp: _Decimal, rounding: str | None = ..., context: Context | None = ..., watchexp: bool = ...
) -> Decimal: ...
def same_quantum(self, other: _Decimal) -> bool: ...
def to_integral_exact(self, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
def to_integral_value(self, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
def to_integral(self, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
def sqrt(self, context: Optional[Context] = ...) -> Decimal: ...
def max(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def min(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def to_integral_exact(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ...
def to_integral_value(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ...
def to_integral(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ...
def sqrt(self, context: Context | None = ...) -> Decimal: ...
def max(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def min(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def adjusted(self) -> int: ...
def canonical(self, context: Optional[Context] = ...) -> Decimal: ...
def compare_signal(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def canonical(self, context: Context | None = ...) -> Decimal: ...
def compare_signal(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def compare_total(self, other: _Decimal) -> Decimal: ...
def compare_total_mag(self, other: _Decimal) -> Decimal: ...
def copy_abs(self) -> Decimal: ...
def copy_negate(self) -> Decimal: ...
def copy_sign(self, other: _Decimal) -> Decimal: ...
def exp(self, context: Optional[Context] = ...) -> Decimal: ...
def exp(self, context: Context | None = ...) -> Decimal: ...
def is_canonical(self) -> bool: ...
def is_finite(self) -> bool: ...
def is_infinite(self) -> bool: ...
def is_nan(self) -> bool: ...
def is_normal(self, context: Optional[Context] = ...) -> bool: ...
def is_normal(self, context: Context | None = ...) -> bool: ...
def is_qnan(self) -> bool: ...
def is_signed(self) -> bool: ...
def is_snan(self) -> bool: ...
def is_subnormal(self, context: Optional[Context] = ...) -> bool: ...
def is_subnormal(self, context: Context | None = ...) -> bool: ...
def is_zero(self) -> bool: ...
def ln(self, context: Optional[Context] = ...) -> Decimal: ...
def log10(self, context: Optional[Context] = ...) -> Decimal: ...
def logb(self, context: Optional[Context] = ...) -> Decimal: ...
def logical_and(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def logical_invert(self, context: Optional[Context] = ...) -> Decimal: ...
def logical_or(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def logical_xor(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def max_mag(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def min_mag(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def next_minus(self, context: Optional[Context] = ...) -> Decimal: ...
def next_plus(self, context: Optional[Context] = ...) -> Decimal: ...
def next_toward(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def number_class(self, context: Optional[Context] = ...) -> str: ...
def ln(self, context: Context | None = ...) -> Decimal: ...
def log10(self, context: Context | None = ...) -> Decimal: ...
def logb(self, context: Context | None = ...) -> Decimal: ...
def logical_and(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def logical_invert(self, context: Context | None = ...) -> Decimal: ...
def logical_or(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def logical_xor(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def max_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def min_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def next_minus(self, context: Context | None = ...) -> Decimal: ...
def next_plus(self, context: Context | None = ...) -> Decimal: ...
def next_toward(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def number_class(self, context: Context | None = ...) -> str: ...
def radix(self) -> Decimal: ...
def rotate(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def scaleb(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def shift(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def rotate(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def scaleb(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def shift(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __reduce__(self) -> Tuple[Type[Decimal], Tuple[str]]: ...
def __copy__(self) -> Decimal: ...
def __deepcopy__(self, memo: Any) -> Decimal: ...
def __format__(self, specifier: str, context: Optional[Context] = ...) -> str: ...
def __format__(self, specifier: str, context: Context | None = ...) -> str: ...
class _ContextManager(object):
new_context: Context
saved_context: Context
def __init__(self, new_context: Context) -> None: ...
def __enter__(self) -> Context: ...
def __exit__(self, t: Optional[Type[BaseException]], v: Optional[BaseException], tb: Optional[TracebackType]) -> None: ...
def __exit__(self, t: Type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
_TrapType = Type[DecimalException]
@@ -161,15 +161,15 @@ class Context(object):
flags: Dict[_TrapType, bool]
def __init__(
self,
prec: Optional[int] = ...,
rounding: Optional[str] = ...,
traps: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
flags: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
Emin: Optional[int] = ...,
Emax: Optional[int] = ...,
capitals: Optional[int] = ...,
_clamp: Optional[int] = ...,
_ignored_flags: Optional[List[_TrapType]] = ...,
prec: int | None = ...,
rounding: str | None = ...,
traps: None | Dict[_TrapType, bool] | Container[_TrapType] = ...,
flags: None | Dict[_TrapType, bool] | Container[_TrapType] = ...,
Emin: int | None = ...,
Emax: int | None = ...,
capitals: int | None = ...,
_clamp: int | None = ...,
_ignored_flags: List[_TrapType] | None = ...,
) -> None: ...
def clear_flags(self) -> None: ...
def copy(self) -> Context: ...
@@ -224,7 +224,7 @@ class Context(object):
def normalize(self, __x: _Decimal) -> Decimal: ...
def number_class(self, __x: _Decimal) -> str: ...
def plus(self, __x: _Decimal) -> Decimal: ...
def power(self, a: _Decimal, b: _Decimal, modulo: Optional[_Decimal] = ...) -> Decimal: ...
def power(self, a: _Decimal, b: _Decimal, modulo: _Decimal | None = ...) -> Decimal: ...
def quantize(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def radix(self) -> Decimal: ...
def remainder(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...

View File

@@ -7,7 +7,6 @@ from typing import (
Iterator,
List,
NamedTuple,
Optional,
Sequence,
Text,
Tuple,
@@ -30,7 +29,7 @@ class Match(NamedTuple):
class SequenceMatcher(Generic[_T]):
def __init__(
self, isjunk: Optional[Callable[[_T], bool]] = ..., a: Sequence[_T] = ..., b: Sequence[_T] = ..., autojunk: bool = ...
self, isjunk: Callable[[_T], bool] | None = ..., a: Sequence[_T] = ..., b: Sequence[_T] = ..., autojunk: bool = ...
) -> None: ...
def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ...
def set_seq1(self, a: Sequence[_T]) -> None: ...
@@ -54,7 +53,7 @@ def get_close_matches(
) -> List[Sequence[_T]]: ...
class Differ:
def __init__(self, linejunk: Optional[_JunkCallback] = ..., charjunk: Optional[_JunkCallback] = ...) -> None: ...
def __init__(self, linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...) -> None: ...
def compare(self, a: Sequence[_StrType], b: Sequence[_StrType]) -> Iterator[_StrType]: ...
def IS_LINE_JUNK(line: _StrType, pat: Any = ...) -> bool: ... # pat is undocumented
@@ -80,16 +79,16 @@ def context_diff(
lineterm: _StrType = ...,
) -> Iterator[_StrType]: ...
def ndiff(
a: Sequence[_StrType], b: Sequence[_StrType], linejunk: Optional[_JunkCallback] = ..., charjunk: Optional[_JunkCallback] = ...
a: Sequence[_StrType], b: Sequence[_StrType], linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...
) -> Iterator[_StrType]: ...
class HtmlDiff(object):
def __init__(
self,
tabsize: int = ...,
wrapcolumn: Optional[int] = ...,
linejunk: Optional[_JunkCallback] = ...,
charjunk: Optional[_JunkCallback] = ...,
wrapcolumn: int | None = ...,
linejunk: _JunkCallback | None = ...,
charjunk: _JunkCallback | None = ...,
) -> None: ...
def make_file(
self,

View File

@@ -1,8 +1,8 @@
from typing import List, MutableSequence, Text, Union
from typing import List, MutableSequence, Text
def reset() -> None: ...
def listdir(path: Text) -> List[str]: ...
opendir = listdir
def annotate(head: Text, list: Union[MutableSequence[str], MutableSequence[Text], MutableSequence[Union[str, Text]]]) -> None: ...
def annotate(head: Text, list: MutableSequence[str] | MutableSequence[Text] | MutableSequence[str | Text]) -> None: ...

View File

@@ -1,12 +1,5 @@
from typing import Optional
def make_archive(
base_name: str,
format: str,
root_dir: Optional[str] = ...,
base_dir: Optional[str] = ...,
verbose: int = ...,
dry_run: int = ...,
base_name: str, format: str, root_dir: str | None = ..., base_dir: str | None = ..., verbose: int = ..., dry_run: int = ...
) -> str: ...
def make_tarball(base_name: str, base_dir: str, compress: Optional[str] = ..., verbose: int = ..., dry_run: int = ...) -> str: ...
def make_tarball(base_name: str, base_dir: str, compress: str | None = ..., verbose: int = ..., dry_run: int = ...) -> str: ...
def make_zipfile(base_name: str, base_dir: str, verbose: int = ..., dry_run: int = ...) -> str: ...

View File

@@ -6,9 +6,9 @@ def gen_lib_options(
compiler: CCompiler, library_dirs: List[str], runtime_library_dirs: List[str], libraries: List[str]
) -> List[str]: ...
def gen_preprocess_options(macros: List[_Macro], include_dirs: List[str]) -> List[str]: ...
def get_default_compiler(osname: Optional[str] = ..., platform: Optional[str] = ...) -> str: ...
def get_default_compiler(osname: str | None = ..., platform: str | None = ...) -> str: ...
def new_compiler(
plat: Optional[str] = ..., compiler: Optional[str] = ..., verbose: int = ..., dry_run: int = ..., force: int = ...
plat: str | None = ..., compiler: str | None = ..., verbose: int = ..., dry_run: int = ..., force: int = ...
) -> CCompiler: ...
def show_compilers() -> None: ...
@@ -16,7 +16,7 @@ class CCompiler:
dry_run: bool
force: bool
verbose: bool
output_dir: Optional[str]
output_dir: str | None
macros: List[_Macro]
include_dirs: List[str]
libraries: List[str]
@@ -32,19 +32,19 @@ class CCompiler:
def set_library_dirs(self, dirs: List[str]) -> None: ...
def add_runtime_library_dir(self, dir: str) -> None: ...
def set_runtime_library_dirs(self, dirs: List[str]) -> None: ...
def define_macro(self, name: str, value: Optional[str] = ...) -> None: ...
def define_macro(self, name: str, value: str | None = ...) -> None: ...
def undefine_macro(self, name: str) -> None: ...
def add_link_object(self, object: str) -> None: ...
def set_link_objects(self, objects: List[str]) -> None: ...
def detect_language(self, sources: Union[str, List[str]]) -> Optional[str]: ...
def find_library_file(self, dirs: List[str], lib: str, debug: bool = ...) -> Optional[str]: ...
def detect_language(self, sources: str | List[str]) -> str | None: ...
def find_library_file(self, dirs: List[str], lib: str, debug: bool = ...) -> str | None: ...
def has_function(
self,
funcname: str,
includes: Optional[List[str]] = ...,
include_dirs: Optional[List[str]] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
includes: List[str] | None = ...,
include_dirs: List[str] | None = ...,
libraries: List[str] | None = ...,
library_dirs: List[str] | None = ...,
) -> bool: ...
def library_dir_option(self, dir: str) -> str: ...
def library_option(self, lib: str) -> str: ...
@@ -53,95 +53,95 @@ class CCompiler:
def compile(
self,
sources: List[str],
output_dir: Optional[str] = ...,
macros: Optional[_Macro] = ...,
include_dirs: Optional[List[str]] = ...,
output_dir: str | None = ...,
macros: _Macro | None = ...,
include_dirs: List[str] | None = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
depends: Optional[List[str]] = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
depends: List[str] | None = ...,
) -> List[str]: ...
def create_static_lib(
self,
objects: List[str],
output_libname: str,
output_dir: Optional[str] = ...,
output_dir: str | None = ...,
debug: bool = ...,
target_lang: Optional[str] = ...,
target_lang: str | None = ...,
) -> None: ...
def link(
self,
target_desc: str,
objects: List[str],
output_filename: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
output_dir: str | None = ...,
libraries: List[str] | None = ...,
library_dirs: List[str] | None = ...,
runtime_library_dirs: List[str] | None = ...,
export_symbols: List[str] | None = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
build_temp: str | None = ...,
target_lang: str | None = ...,
) -> None: ...
def link_executable(
self,
objects: List[str],
output_progname: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
output_dir: str | None = ...,
libraries: List[str] | None = ...,
library_dirs: List[str] | None = ...,
runtime_library_dirs: List[str] | None = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
target_lang: Optional[str] = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
target_lang: str | None = ...,
) -> None: ...
def link_shared_lib(
self,
objects: List[str],
output_libname: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
output_dir: str | None = ...,
libraries: List[str] | None = ...,
library_dirs: List[str] | None = ...,
runtime_library_dirs: List[str] | None = ...,
export_symbols: List[str] | None = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
build_temp: str | None = ...,
target_lang: str | None = ...,
) -> None: ...
def link_shared_object(
self,
objects: List[str],
output_filename: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
output_dir: str | None = ...,
libraries: List[str] | None = ...,
library_dirs: List[str] | None = ...,
runtime_library_dirs: List[str] | None = ...,
export_symbols: List[str] | None = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
build_temp: str | None = ...,
target_lang: str | None = ...,
) -> None: ...
def preprocess(
self,
source: str,
output_file: Optional[str] = ...,
macros: Optional[List[_Macro]] = ...,
include_dirs: Optional[List[str]] = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
output_file: str | None = ...,
macros: List[_Macro] | None = ...,
include_dirs: List[str] | None = ...,
extra_preargs: List[str] | None = ...,
extra_postargs: List[str] | None = ...,
) -> None: ...
def executable_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ...
def library_filename(self, libname: str, lib_type: str = ..., strip_dir: int = ..., output_dir: str = ...) -> str: ...
def object_filenames(self, source_filenames: List[str], strip_dir: int = ..., output_dir: str = ...) -> List[str]: ...
def shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ...
def execute(self, func: Callable[..., None], args: Tuple[Any, ...], msg: Optional[str] = ..., level: int = ...) -> None: ...
def execute(self, func: Callable[..., None], args: Tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ...
def spawn(self, cmd: List[str]) -> None: ...
def mkpath(self, name: str, mode: int = ...) -> None: ...
def move_file(self, src: str, dst: str) -> str: ...

View File

@@ -1,9 +1,9 @@
from abc import abstractmethod
from distutils.dist import Distribution
from typing import Any, Callable, Iterable, List, Optional, Text, Tuple, Union
from typing import Any, Callable, Iterable, List, Text, Tuple
class Command:
sub_commands: List[Tuple[str, Optional[Callable[[Command], bool]]]]
sub_commands: List[Tuple[str, Callable[[Command], bool] | None]]
def __init__(self, dist: Distribution) -> None: ...
@abstractmethod
def initialize_options(self) -> None: ...
@@ -13,18 +13,18 @@ class Command:
def run(self) -> None: ...
def announce(self, msg: Text, level: int = ...) -> None: ...
def debug_print(self, msg: Text) -> None: ...
def ensure_string(self, option: str, default: Optional[str] = ...) -> None: ...
def ensure_string_list(self, option: Union[str, List[str]]) -> None: ...
def ensure_string(self, option: str, default: str | None = ...) -> None: ...
def ensure_string_list(self, option: str | List[str]) -> None: ...
def ensure_filename(self, option: str) -> None: ...
def ensure_dirname(self, option: str) -> None: ...
def get_command_name(self) -> str: ...
def set_undefined_options(self, src_cmd: Text, *option_pairs: Tuple[str, str]) -> None: ...
def get_finalized_command(self, command: Text, create: int = ...) -> Command: ...
def reinitialize_command(self, command: Union[Command, Text], reinit_subcommands: int = ...) -> Command: ...
def reinitialize_command(self, command: Command | Text, reinit_subcommands: int = ...) -> Command: ...
def run_command(self, command: Text) -> None: ...
def get_sub_commands(self) -> List[str]: ...
def warn(self, msg: Text) -> None: ...
def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: Optional[Text] = ..., level: int = ...) -> None: ...
def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: Text | None = ..., level: int = ...) -> None: ...
def mkpath(self, name: str, mode: int = ...) -> None: ...
def copy_file(
self,
@@ -32,7 +32,7 @@ class Command:
outfile: str,
preserve_mode: int = ...,
preserve_times: int = ...,
link: Optional[str] = ...,
link: str | None = ...,
level: Any = ...,
) -> Tuple[str, bool]: ... # level is not used
def copy_tree(
@@ -50,18 +50,18 @@ class Command:
self,
base_name: str,
format: str,
root_dir: Optional[str] = ...,
base_dir: Optional[str] = ...,
owner: Optional[str] = ...,
group: Optional[str] = ...,
root_dir: str | None = ...,
base_dir: str | None = ...,
owner: str | None = ...,
group: str | None = ...,
) -> str: ...
def make_file(
self,
infiles: Union[str, List[str], Tuple[str]],
infiles: str | List[str] | Tuple[str],
outfile: str,
func: Callable[..., Any],
args: List[Any],
exec_msg: Optional[str] = ...,
skip_msg: Optional[str] = ...,
exec_msg: str | None = ...,
skip_msg: str | None = ...,
level: Any = ...,
) -> None: ... # level is not used

View File

@@ -3,19 +3,19 @@ from distutils.ccompiler import CCompiler
from distutils.core import Command as Command
from distutils.errors import DistutilsExecError as DistutilsExecError
from distutils.sysconfig import customize_compiler as customize_compiler
from typing import Dict, List, Optional, Pattern, Sequence, Tuple, Union
from typing import Dict, List, Pattern, Sequence, Tuple
LANG_EXT: Dict[str, str]
class config(Command):
description: str = ...
# Tuple is full name, short name, description
user_options: Sequence[Tuple[str, Optional[str], str]] = ...
compiler: Optional[Union[str, CCompiler]] = ...
cc: Optional[str] = ...
include_dirs: Optional[Sequence[str]] = ...
libraries: Optional[Sequence[str]] = ...
library_dirs: Optional[Sequence[str]] = ...
user_options: Sequence[Tuple[str, str | None, str]] = ...
compiler: str | CCompiler | None = ...
cc: str | None = ...
include_dirs: Sequence[str] | None = ...
libraries: Sequence[str] | None = ...
library_dirs: Sequence[str] | None = ...
noisy: int = ...
dump_source: int = ...
temp_files: Sequence[str] = ...
@@ -24,64 +24,60 @@ class config(Command):
def run(self) -> None: ...
def try_cpp(
self,
body: Optional[str] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
body: str | None = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
lang: str = ...,
) -> bool: ...
def search_cpp(
self,
pattern: Union[Pattern[str], str],
body: Optional[str] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
pattern: Pattern[str] | str,
body: str | None = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
lang: str = ...,
) -> bool: ...
def try_compile(
self, body: str, headers: Optional[Sequence[str]] = ..., include_dirs: Optional[Sequence[str]] = ..., lang: str = ...
self, body: str, headers: Sequence[str] | None = ..., include_dirs: Sequence[str] | None = ..., lang: str = ...
) -> bool: ...
def try_link(
self,
body: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
libraries: Sequence[str] | None = ...,
library_dirs: Sequence[str] | None = ...,
lang: str = ...,
) -> bool: ...
def try_run(
self,
body: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
libraries: Sequence[str] | None = ...,
library_dirs: Sequence[str] | None = ...,
lang: str = ...,
) -> bool: ...
def check_func(
self,
func: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
libraries: Sequence[str] | None = ...,
library_dirs: Sequence[str] | None = ...,
decl: int = ...,
call: int = ...,
) -> bool: ...
def check_lib(
self,
library: str,
library_dirs: Optional[Sequence[str]] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
library_dirs: Sequence[str] | None = ...,
headers: Sequence[str] | None = ...,
include_dirs: Sequence[str] | None = ...,
other_libraries: List[str] = ...,
) -> bool: ...
def check_header(
self,
header: str,
include_dirs: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
self, header: str, include_dirs: Sequence[str] | None = ..., library_dirs: Sequence[str] | None = ..., lang: str = ...
) -> bool: ...
def dump_file(filename: str, head: Optional[str] = ...) -> None: ...
def dump_file(filename: str, head: str | None = ...) -> None: ...

View File

@@ -1,12 +1,12 @@
from distutils.cmd import Command
from typing import Optional, Text
from typing import Text
class install(Command):
user: bool
prefix: Optional[Text]
home: Optional[Text]
root: Optional[Text]
install_lib: Optional[Text]
prefix: Text | None
home: Text | None
root: Text | None
install_lib: Text | None
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...

View File

@@ -1,9 +1,9 @@
from distutils.cmd import Command
from typing import ClassVar, List, Optional, Tuple
from typing import ClassVar, List, Tuple
class install_egg_info(Command):
description: ClassVar[str]
user_options: ClassVar[List[Tuple[str, Optional[str], str]]]
user_options: ClassVar[List[Tuple[str, str | None, str]]]
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...

View File

@@ -1,5 +1,5 @@
from distutils.config import PyPIRCCommand
from typing import ClassVar, List, Optional, Tuple
from typing import ClassVar, List, Tuple
class upload(PyPIRCCommand):
description: ClassVar[str]

View File

@@ -1,6 +1,6 @@
from abc import abstractmethod
from distutils.cmd import Command
from typing import ClassVar, List, Optional, Tuple
from typing import ClassVar, List, Tuple
DEFAULT_PYPIRC: str
@@ -9,7 +9,7 @@ class PyPIRCCommand(Command):
DEFAULT_REALM: ClassVar[str]
repository: None
realm: None
user_options: ClassVar[List[Tuple[str, Optional[str], str]]]
user_options: ClassVar[List[Tuple[str, str | None, str]]]
boolean_options: ClassVar[List[str]]
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...

View File

@@ -1,7 +1,7 @@
from distutils.cmd import Command as Command
from distutils.dist import Distribution as Distribution
from distutils.extension import Extension as Extension
from typing import Any, List, Mapping, Optional, Tuple, Type, Union
from typing import Any, List, Mapping, Tuple, Type
def setup(
*,
@@ -25,8 +25,8 @@ def setup(
script_args: List[str] = ...,
options: Mapping[str, Any] = ...,
license: str = ...,
keywords: Union[List[str], str] = ...,
platforms: Union[List[str], str] = ...,
keywords: List[str] | str = ...,
platforms: List[str] | str = ...,
cmdclass: Mapping[str, Type[Command]] = ...,
data_files: List[Tuple[str, List[str]]] = ...,
package_dir: Mapping[str, str] = ...,
@@ -45,4 +45,4 @@ def setup(
fullname: str = ...,
**attrs: Any,
) -> None: ...
def run_setup(script_name: str, script_args: Optional[List[str]] = ..., stop_after: str = ...) -> Distribution: ...
def run_setup(script_name: str, script_args: List[str] | None = ..., stop_after: str = ...) -> Distribution: ...

View File

@@ -1,9 +1,9 @@
from distutils.cmd import Command
from typing import Any, Dict, Iterable, Mapping, Optional, Text, Tuple, Type
from typing import Any, Dict, Iterable, Mapping, Text, Tuple, Type
class Distribution:
cmdclass: Dict[str, Type[Command]]
def __init__(self, attrs: Optional[Mapping[str, Any]] = ...) -> None: ...
def __init__(self, attrs: Mapping[str, Any] | None = ...) -> None: ...
def get_option_dict(self, command: str) -> Dict[str, Tuple[str, Text]]: ...
def parse_config_files(self, filenames: Optional[Iterable[Text]] = ...) -> None: ...
def get_command_obj(self, command: str, create: bool = ...) -> Optional[Command]: ...
def parse_config_files(self, filenames: Iterable[Text] | None = ...) -> None: ...
def get_command_obj(self, command: str, create: bool = ...) -> Command | None: ...

View File

@@ -1,4 +1,4 @@
from typing import List, Optional, Tuple
from typing import List, Tuple
class Extension:
def __init__(
@@ -6,7 +6,7 @@ class Extension:
name: str,
sources: List[str],
include_dirs: List[str] = ...,
define_macros: List[Tuple[str, Optional[str]]] = ...,
define_macros: List[Tuple[str, str | None]] = ...,
undef_macros: List[str] = ...,
library_dirs: List[str] = ...,
libraries: List[str] = ...,
@@ -15,7 +15,7 @@ class Extension:
extra_compile_args: List[str] = ...,
extra_link_args: List[str] = ...,
export_symbols: List[str] = ...,
swig_opts: Optional[str] = ..., # undocumented
swig_opts: str | None = ..., # undocumented
depends: List[str] = ...,
language: str = ...,
) -> None: ...

View File

@@ -1,21 +1,21 @@
from typing import Any, List, Mapping, Optional, Tuple, Union, overload
from typing import Any, List, Mapping, Optional, Tuple, overload
_Option = Tuple[str, Optional[str], str]
_GR = Tuple[List[str], OptionDummy]
def fancy_getopt(
options: List[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: Optional[List[str]]
) -> Union[List[str], _GR]: ...
options: List[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: List[str] | None
) -> List[str] | _GR: ...
def wrap_text(text: str, width: int) -> List[str]: ...
class FancyGetopt:
def __init__(self, option_table: Optional[List[_Option]] = ...) -> None: ...
def __init__(self, option_table: List[_Option] | None = ...) -> None: ...
# TODO kinda wrong, `getopt(object=object())` is invalid
@overload
def getopt(self, args: Optional[List[str]] = ...) -> _GR: ...
def getopt(self, args: List[str] | None = ...) -> _GR: ...
@overload
def getopt(self, args: Optional[List[str]], object: Any) -> List[str]: ...
def getopt(self, args: List[str] | None, object: Any) -> List[str]: ...
def get_option_order(self) -> List[Tuple[str, str]]: ...
def generate_help(self, header: Optional[str] = ...) -> List[str]: ...
def generate_help(self, header: str | None = ...) -> List[str]: ...
class OptionDummy: ...

View File

@@ -1,4 +1,4 @@
from typing import Optional, Sequence, Tuple
from typing import Sequence, Tuple
def copy_file(
src: str,
@@ -6,7 +6,7 @@ def copy_file(
preserve_mode: bool = ...,
preserve_times: bool = ...,
update: bool = ...,
link: Optional[str] = ...,
link: str | None = ...,
verbose: bool = ...,
dry_run: bool = ...,
) -> Tuple[str, str]: ...

View File

@@ -1,4 +1,4 @@
from typing import List, Optional
from typing import List
def spawn(cmd: List[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ...
def find_executable(executable: str, path: Optional[str] = ...) -> Optional[str]: ...
def find_executable(executable: str, path: str | None = ...) -> str | None: ...

View File

@@ -1,14 +1,14 @@
from distutils.ccompiler import CCompiler
from typing import Mapping, Optional, Union
from typing import Mapping
PREFIX: str
EXEC_PREFIX: str
def get_config_var(name: str) -> Union[int, str, None]: ...
def get_config_vars(*args: str) -> Mapping[str, Union[int, str]]: ...
def get_config_var(name: str) -> int | str | None: ...
def get_config_vars(*args: str) -> Mapping[str, int | str]: ...
def get_config_h_filename() -> str: ...
def get_makefile_filename() -> str: ...
def get_python_inc(plat_specific: bool = ..., prefix: Optional[str] = ...) -> str: ...
def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., prefix: Optional[str] = ...) -> str: ...
def get_python_inc(plat_specific: bool = ..., prefix: str | None = ...) -> str: ...
def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., prefix: str | None = ...) -> str: ...
def customize_compiler(compiler: CCompiler) -> None: ...
def set_python_build() -> None: ...

View File

@@ -1,10 +1,10 @@
from typing import IO, List, Optional, Tuple, Union
from typing import IO, List, Tuple
class TextFile:
def __init__(
self,
filename: Optional[str] = ...,
file: Optional[IO[str]] = ...,
filename: str | None = ...,
file: IO[str] | None = ...,
*,
strip_comments: bool = ...,
lstrip_ws: bool = ...,
@@ -15,7 +15,7 @@ class TextFile:
) -> None: ...
def open(self, filename: str) -> None: ...
def close(self) -> None: ...
def warn(self, msg: str, line: Union[List[int], Tuple[int, int], int] = ...) -> None: ...
def readline(self) -> Optional[str]: ...
def warn(self, msg: str, line: List[int] | Tuple[int, int] | int = ...) -> None: ...
def readline(self) -> str | None: ...
def readlines(self) -> List[str]: ...
def unreadline(self, line: str) -> str: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, List, Mapping, Optional, Tuple
from typing import Any, Callable, List, Mapping, Tuple
def get_platform() -> str: ...
def convert_path(pathname: str) -> str: ...
@@ -7,17 +7,17 @@ def check_environ() -> None: ...
def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ...
def split_quoted(s: str) -> List[str]: ...
def execute(
func: Callable[..., None], args: Tuple[Any, ...], msg: Optional[str] = ..., verbose: bool = ..., dry_run: bool = ...
func: Callable[..., None], args: Tuple[Any, ...], msg: str | None = ..., verbose: bool = ..., dry_run: bool = ...
) -> None: ...
def strtobool(val: str) -> bool: ...
def byte_compile(
py_files: List[str],
optimize: int = ...,
force: bool = ...,
prefix: Optional[str] = ...,
base_dir: Optional[str] = ...,
prefix: str | None = ...,
base_dir: str | None = ...,
verbose: bool = ...,
dry_run: bool = ...,
direct: Optional[bool] = ...,
direct: bool | None = ...,
) -> None: ...
def rfc822_escape(header: str) -> str: ...

View File

@@ -1,33 +1,33 @@
from abc import abstractmethod
from typing import Optional, Pattern, Text, Tuple, TypeVar, Union
from typing import Pattern, Text, Tuple, TypeVar
_T = TypeVar("_T", bound=Version)
class Version:
def __repr__(self) -> str: ...
@abstractmethod
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
def __init__(self, vstring: Text | None = ...) -> None: ...
@abstractmethod
def parse(self: _T, vstring: Text) -> _T: ...
@abstractmethod
def __str__(self) -> str: ...
@abstractmethod
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
def __cmp__(self: _T, other: _T | str) -> bool: ...
class StrictVersion(Version):
version_re: Pattern[str]
version: Tuple[int, int, int]
prerelease: Optional[Tuple[Text, int]]
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
prerelease: Tuple[Text, int] | None
def __init__(self, vstring: Text | None = ...) -> None: ...
def parse(self: _T, vstring: Text) -> _T: ...
def __str__(self) -> str: ...
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
def __cmp__(self: _T, other: _T | str) -> bool: ...
class LooseVersion(Version):
component_re: Pattern[str]
vstring: Text
version: Tuple[Union[Text, int], ...]
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
version: Tuple[Text | int, ...]
def __init__(self, vstring: Text | None = ...) -> None: ...
def parse(self: _T, vstring: Text) -> _T: ...
def __str__(self) -> str: ...
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
def __cmp__(self: _T, other: _T | str) -> bool: ...

View File

@@ -1,6 +1,6 @@
import types
import unittest
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Type, Union
from typing import Any, Callable, Dict, List, NamedTuple, Tuple, Type
class TestResults(NamedTuple):
failed: int
@@ -31,7 +31,7 @@ ELLIPSIS_MARKER: str
class Example:
source: str
want: str
exc_msg: Optional[str]
exc_msg: str | None
lineno: int
indent: int
options: Dict[int, bool]
@@ -39,10 +39,10 @@ class Example:
self,
source: str,
want: str,
exc_msg: Optional[str] = ...,
exc_msg: str | None = ...,
lineno: int = ...,
indent: int = ...,
options: Optional[Dict[int, bool]] = ...,
options: Dict[int, bool] | None = ...,
) -> None: ...
def __hash__(self) -> int: ...
@@ -50,26 +50,24 @@ class DocTest:
examples: List[Example]
globs: Dict[str, Any]
name: str
filename: Optional[str]
lineno: Optional[int]
docstring: Optional[str]
filename: str | None
lineno: int | None
docstring: str | None
def __init__(
self,
examples: List[Example],
globs: Dict[str, Any],
name: str,
filename: Optional[str],
lineno: Optional[int],
docstring: Optional[str],
filename: str | None,
lineno: int | None,
docstring: str | None,
) -> None: ...
def __hash__(self) -> int: ...
def __lt__(self, other: DocTest) -> bool: ...
class DocTestParser:
def parse(self, string: str, name: str = ...) -> List[Union[str, Example]]: ...
def get_doctest(
self, string: str, globs: Dict[str, Any], name: str, filename: Optional[str], lineno: Optional[int]
) -> DocTest: ...
def parse(self, string: str, name: str = ...) -> List[str | Example]: ...
def get_doctest(self, string: str, globs: Dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: ...
def get_examples(self, string: str, name: str = ...) -> List[Example]: ...
class DocTestFinder:
@@ -79,10 +77,10 @@ class DocTestFinder:
def find(
self,
obj: object,
name: Optional[str] = ...,
module: Union[None, bool, types.ModuleType] = ...,
globs: Optional[Dict[str, Any]] = ...,
extraglobs: Optional[Dict[str, Any]] = ...,
name: str | None = ...,
module: None | bool | types.ModuleType = ...,
globs: Dict[str, Any] | None = ...,
extraglobs: Dict[str, Any] | None = ...,
) -> List[DocTest]: ...
_Out = Callable[[str], Any]
@@ -95,15 +93,15 @@ class DocTestRunner:
tries: int
failures: int
test: DocTest
def __init__(self, checker: Optional[OutputChecker] = ..., verbose: Optional[bool] = ..., optionflags: int = ...) -> None: ...
def __init__(self, checker: OutputChecker | None = ..., verbose: bool | None = ..., optionflags: int = ...) -> None: ...
def report_start(self, out: _Out, test: DocTest, example: Example) -> None: ...
def report_success(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
def report_failure(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ...
def run(
self, test: DocTest, compileflags: Optional[int] = ..., out: Optional[_Out] = ..., clear_globs: bool = ...
self, test: DocTest, compileflags: int | None = ..., out: _Out | None = ..., clear_globs: bool = ...
) -> TestResults: ...
def summarize(self, verbose: Optional[bool] = ...) -> TestResults: ...
def summarize(self, verbose: bool | None = ...) -> TestResults: ...
def merge(self, other: DocTestRunner) -> None: ...
class OutputChecker:
@@ -124,40 +122,35 @@ class UnexpectedException(Exception):
class DebugRunner(DocTestRunner): ...
master: Optional[DocTestRunner]
master: DocTestRunner | None
def testmod(
m: Optional[types.ModuleType] = ...,
name: Optional[str] = ...,
globs: Optional[Dict[str, Any]] = ...,
verbose: Optional[bool] = ...,
m: types.ModuleType | None = ...,
name: str | None = ...,
globs: Dict[str, Any] | None = ...,
verbose: bool | None = ...,
report: bool = ...,
optionflags: int = ...,
extraglobs: Optional[Dict[str, Any]] = ...,
extraglobs: Dict[str, Any] | None = ...,
raise_on_error: bool = ...,
exclude_empty: bool = ...,
) -> TestResults: ...
def testfile(
filename: str,
module_relative: bool = ...,
name: Optional[str] = ...,
package: Union[None, str, types.ModuleType] = ...,
globs: Optional[Dict[str, Any]] = ...,
verbose: Optional[bool] = ...,
name: str | None = ...,
package: None | str | types.ModuleType = ...,
globs: Dict[str, Any] | None = ...,
verbose: bool | None = ...,
report: bool = ...,
optionflags: int = ...,
extraglobs: Optional[Dict[str, Any]] = ...,
extraglobs: Dict[str, Any] | None = ...,
raise_on_error: bool = ...,
parser: DocTestParser = ...,
encoding: Optional[str] = ...,
encoding: str | None = ...,
) -> TestResults: ...
def run_docstring_examples(
f: object,
globs: Dict[str, Any],
verbose: bool = ...,
name: str = ...,
compileflags: Optional[int] = ...,
optionflags: int = ...,
f: object, globs: Dict[str, Any], verbose: bool = ..., name: str = ..., compileflags: int | None = ..., optionflags: int = ...
) -> None: ...
def set_unittest_reportflags(flags: int) -> int: ...
@@ -166,9 +159,9 @@ class DocTestCase(unittest.TestCase):
self,
test: DocTest,
optionflags: int = ...,
setUp: Optional[Callable[[DocTest], Any]] = ...,
tearDown: Optional[Callable[[DocTest], Any]] = ...,
checker: Optional[OutputChecker] = ...,
setUp: Callable[[DocTest], Any] | None = ...,
tearDown: Callable[[DocTest], Any] | None = ...,
checker: OutputChecker | None = ...,
) -> None: ...
def setUp(self) -> None: ...
def tearDown(self) -> None: ...
@@ -188,10 +181,10 @@ class SkipDocTestCase(DocTestCase):
_DocTestSuite = unittest.TestSuite
def DocTestSuite(
module: Union[None, str, types.ModuleType] = ...,
globs: Optional[Dict[str, Any]] = ...,
extraglobs: Optional[Dict[str, Any]] = ...,
test_finder: Optional[DocTestFinder] = ...,
module: None | str | types.ModuleType = ...,
globs: Dict[str, Any] | None = ...,
extraglobs: Dict[str, Any] | None = ...,
test_finder: DocTestFinder | None = ...,
**options: Any,
) -> _DocTestSuite: ...
@@ -202,15 +195,15 @@ class DocFileCase(DocTestCase):
def DocFileTest(
path: str,
module_relative: bool = ...,
package: Union[None, str, types.ModuleType] = ...,
globs: Optional[Dict[str, Any]] = ...,
package: None | str | types.ModuleType = ...,
globs: Dict[str, Any] | None = ...,
parser: DocTestParser = ...,
encoding: Optional[str] = ...,
encoding: str | None = ...,
**options: Any,
) -> DocFileCase: ...
def DocFileSuite(*paths: str, **kw: Any) -> _DocTestSuite: ...
def script_from_examples(s: str) -> str: ...
def testsource(module: Union[None, str, types.ModuleType], name: str) -> str: ...
def debug_src(src: str, pm: bool = ..., globs: Optional[Dict[str, Any]] = ...) -> None: ...
def debug_script(src: str, pm: bool = ..., globs: Optional[Dict[str, Any]] = ...) -> None: ...
def debug(module: Union[None, str, types.ModuleType], name: str, pm: bool = ...) -> None: ...
def testsource(module: None | str | types.ModuleType, name: str) -> str: ...
def debug_src(src: str, pm: bool = ..., globs: Dict[str, Any] | None = ...) -> None: ...
def debug_script(src: str, pm: bool = ..., globs: Dict[str, Any] | None = ...) -> None: ...
def debug(module: None | str | types.ModuleType, name: str, pm: bool = ...) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, NoReturn, Optional, Tuple
from typing import Any, Callable, Dict, NoReturn, Tuple
class error(Exception):
def __init__(self, *args: Any) -> None: ...
@@ -7,13 +7,13 @@ def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs
def exit() -> NoReturn: ...
def get_ident() -> int: ...
def allocate_lock() -> LockType: ...
def stack_size(size: Optional[int] = ...) -> int: ...
def stack_size(size: int | None = ...) -> int: ...
class LockType(object):
locked_status: bool
def __init__(self) -> None: ...
def acquire(self, waitflag: Optional[bool] = ...) -> bool: ...
def __enter__(self, waitflag: Optional[bool] = ...) -> bool: ...
def acquire(self, waitflag: bool | None = ...) -> bool: ...
def __enter__(self, waitflag: bool | None = ...) -> bool: ...
def __exit__(self, typ: Any, val: Any, tb: Any) -> None: ...
def release(self) -> bool: ...
def locked(self) -> bool: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any
def parsedate_tz(data): ...
def parsedate(data): ...
@@ -26,7 +26,7 @@ class AddrlistClass:
def getquote(self): ...
def getcomment(self): ...
def getdomainliteral(self): ...
def getatom(self, atomends: Optional[Any] = ...): ...
def getatom(self, atomends: Any | None = ...): ...
def getphraselist(self): ...
class AddressList(AddrlistClass):

View File

@@ -5,17 +5,17 @@ from email._parseaddr import (
parsedate_tz as _parsedate_tz,
)
from quopri import decodestring as _qdecode
from typing import Any, Optional
from typing import Any
def formataddr(pair): ...
def getaddresses(fieldvalues): ...
def formatdate(timeval: Optional[Any] = ..., localtime: bool = ..., usegmt: bool = ...): ...
def make_msgid(idstring: Optional[Any] = ...): ...
def formatdate(timeval: Any | None = ..., localtime: bool = ..., usegmt: bool = ...): ...
def make_msgid(idstring: Any | None = ...): ...
def parsedate(data): ...
def parsedate_tz(data): ...
def parseaddr(addr): ...
def unquote(str): ...
def decode_rfc2231(s): ...
def encode_rfc2231(s, charset: Optional[Any] = ..., language: Optional[Any] = ...): ...
def encode_rfc2231(s, charset: Any | None = ..., language: Any | None = ...): ...
def decode_params(params): ...
def collapse_rfc2231_value(value, errors=..., fallback_charset=...): ...

View File

@@ -1,8 +1,6 @@
from typing import Optional
def version() -> str: ...
def bootstrap(
root: Optional[str] = ...,
root: str | None = ...,
upgrade: bool = ...,
user: bool = ...,
altinstall: bool = ...,

View File

@@ -1,5 +1,5 @@
from _typeshed import FileDescriptorLike
from typing import Any, Union
from typing import Any
FASYNC: int
FD_CLOEXEC: int
@@ -74,9 +74,9 @@ LOCK_WRITE: int
# TODO All these return either int or bytes depending on the value of
# cmd (not on the type of arg).
def fcntl(fd: FileDescriptorLike, op: int, arg: Union[int, bytes] = ...) -> Any: ...
def fcntl(fd: FileDescriptorLike, op: int, arg: int | bytes = ...) -> Any: ...
# TODO: arg: int or read-only buffer interface or read-write buffer interface
def ioctl(fd: FileDescriptorLike, op: int, arg: Union[int, bytes] = ..., mutate_flag: bool = ...) -> Any: ...
def ioctl(fd: FileDescriptorLike, op: int, arg: int | bytes = ..., mutate_flag: bool = ...) -> Any: ...
def flock(fd: FileDescriptorLike, op: int) -> None: ...
def lockf(fd: FileDescriptorLike, op: int, length: int = ..., start: int = ..., whence: int = ...) -> Any: ...

View File

@@ -1,15 +1,15 @@
from typing import AnyStr, Callable, Dict, Generic, Iterable, List, Optional, Sequence, Text, Tuple, Union
from typing import AnyStr, Callable, Dict, Generic, Iterable, List, Sequence, Text, Tuple
DEFAULT_IGNORES: List[str]
def cmp(f1: Union[bytes, Text], f2: Union[bytes, Text], shallow: Union[int, bool] = ...) -> bool: ...
def cmp(f1: bytes | Text, f2: bytes | Text, shallow: int | bool = ...) -> bool: ...
def cmpfiles(
a: AnyStr, b: AnyStr, common: Iterable[AnyStr], shallow: Union[int, bool] = ...
a: AnyStr, b: AnyStr, common: Iterable[AnyStr], shallow: int | bool = ...
) -> Tuple[List[AnyStr], List[AnyStr], List[AnyStr]]: ...
class dircmp(Generic[AnyStr]):
def __init__(
self, a: AnyStr, b: AnyStr, ignore: Optional[Sequence[AnyStr]] = ..., hide: Optional[Sequence[AnyStr]] = ...
self, a: AnyStr, b: AnyStr, ignore: Sequence[AnyStr] | None = ..., hide: Sequence[AnyStr] | None = ...
) -> None: ...
left: AnyStr
right: AnyStr

View File

@@ -1,7 +1,7 @@
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Text, Union
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Text
def input(
files: Union[Text, Iterable[Text], None] = ...,
files: Text | Iterable[Text] | None = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
@@ -20,7 +20,7 @@ def isstdin() -> bool: ...
class FileInput(Iterable[AnyStr], Generic[AnyStr]):
def __init__(
self,
files: Union[None, Text, Iterable[Text]] = ...,
files: None | Text | Iterable[Text] = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,

View File

@@ -1,37 +1,37 @@
from typing import IO, Any, Iterable, List, Optional, Tuple
from typing import IO, Any, Iterable, List, Tuple
AS_IS: None
_FontType = Tuple[str, bool, bool, bool]
_StylesType = Tuple[Any, ...]
class NullFormatter:
writer: Optional[NullWriter]
def __init__(self, writer: Optional[NullWriter] = ...) -> None: ...
writer: NullWriter | None
def __init__(self, writer: NullWriter | None = ...) -> None: ...
def end_paragraph(self, blankline: int) -> None: ...
def add_line_break(self) -> None: ...
def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
def add_label_data(self, format: str, counter: int, blankline: Optional[int] = ...) -> None: ...
def add_label_data(self, format: str, counter: int, blankline: int | None = ...) -> None: ...
def add_flowing_data(self, data: str) -> None: ...
def add_literal_data(self, data: str) -> None: ...
def flush_softspace(self) -> None: ...
def push_alignment(self, align: Optional[str]) -> None: ...
def push_alignment(self, align: str | None) -> None: ...
def pop_alignment(self) -> None: ...
def push_font(self, x: _FontType) -> None: ...
def pop_font(self) -> None: ...
def push_margin(self, margin: int) -> None: ...
def pop_margin(self) -> None: ...
def set_spacing(self, spacing: Optional[str]) -> None: ...
def set_spacing(self, spacing: str | None) -> None: ...
def push_style(self, *styles: _StylesType) -> None: ...
def pop_style(self, n: int = ...) -> None: ...
def assert_line_data(self, flag: int = ...) -> None: ...
class AbstractFormatter:
writer: NullWriter
align: Optional[str]
align_stack: List[Optional[str]]
align: str | None
align_stack: List[str | None]
font_stack: List[_FontType]
margin_stack: List[int]
spacing: Optional[str]
spacing: str | None
style_stack: Any
nospace: int
softspace: int
@@ -43,20 +43,20 @@ class AbstractFormatter:
def end_paragraph(self, blankline: int) -> None: ...
def add_line_break(self) -> None: ...
def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
def add_label_data(self, format: str, counter: int, blankline: Optional[int] = ...) -> None: ...
def add_label_data(self, format: str, counter: int, blankline: int | None = ...) -> None: ...
def format_counter(self, format: Iterable[str], counter: int) -> str: ...
def format_letter(self, case: str, counter: int) -> str: ...
def format_roman(self, case: str, counter: int) -> str: ...
def add_flowing_data(self, data: str) -> None: ...
def add_literal_data(self, data: str) -> None: ...
def flush_softspace(self) -> None: ...
def push_alignment(self, align: Optional[str]) -> None: ...
def push_alignment(self, align: str | None) -> None: ...
def pop_alignment(self) -> None: ...
def push_font(self, font: _FontType) -> None: ...
def pop_font(self) -> None: ...
def push_margin(self, margin: int) -> None: ...
def pop_margin(self) -> None: ...
def set_spacing(self, spacing: Optional[str]) -> None: ...
def set_spacing(self, spacing: str | None) -> None: ...
def push_style(self, *styles: _StylesType) -> None: ...
def pop_style(self, n: int = ...) -> None: ...
def assert_line_data(self, flag: int = ...) -> None: ...
@@ -64,10 +64,10 @@ class AbstractFormatter:
class NullWriter:
def __init__(self) -> None: ...
def flush(self) -> None: ...
def new_alignment(self, align: Optional[str]) -> None: ...
def new_alignment(self, align: str | None) -> None: ...
def new_font(self, font: _FontType) -> None: ...
def new_margin(self, margin: int, level: int) -> None: ...
def new_spacing(self, spacing: Optional[str]) -> None: ...
def new_spacing(self, spacing: str | None) -> None: ...
def new_styles(self, styles: Tuple[Any, ...]) -> None: ...
def send_paragraph(self, blankline: int) -> None: ...
def send_line_break(self) -> None: ...
@@ -77,10 +77,10 @@ class NullWriter:
def send_literal_data(self, data: str) -> None: ...
class AbstractWriter(NullWriter):
def new_alignment(self, align: Optional[str]) -> None: ...
def new_alignment(self, align: str | None) -> None: ...
def new_font(self, font: _FontType) -> None: ...
def new_margin(self, margin: int, level: int) -> None: ...
def new_spacing(self, spacing: Optional[str]) -> None: ...
def new_spacing(self, spacing: str | None) -> None: ...
def new_styles(self, styles: Tuple[Any, ...]) -> None: ...
def send_paragraph(self, blankline: int) -> None: ...
def send_line_break(self) -> None: ...
@@ -92,7 +92,7 @@ class AbstractWriter(NullWriter):
class DumbWriter(NullWriter):
file: IO[str]
maxcol: int
def __init__(self, file: Optional[IO[str]] = ..., maxcol: int = ...) -> None: ...
def __init__(self, file: IO[str] | None = ..., maxcol: int = ...) -> None: ...
def reset(self) -> None: ...
def send_paragraph(self, blankline: int) -> None: ...
def send_line_break(self) -> None: ...
@@ -100,4 +100,4 @@ class DumbWriter(NullWriter):
def send_literal_data(self, data: str) -> None: ...
def send_flowing_data(self, data: str) -> None: ...
def test(file: Optional[str] = ...) -> None: ...
def test(file: str | None = ...) -> None: ...

View File

@@ -1,6 +1,6 @@
from decimal import Decimal
from numbers import Integral, Rational, Real
from typing import Optional, Tuple, Type, TypeVar, Union, overload
from typing import Tuple, Type, TypeVar, Union, overload
from typing_extensions import Literal
_ComparableNum = Union[int, float, Decimal, Real]
@@ -18,14 +18,10 @@ def gcd(a: Integral, b: Integral) -> Integral: ...
class Fraction(Rational):
@overload
def __new__(
cls: Type[_T],
numerator: Union[int, Rational] = ...,
denominator: Optional[Union[int, Rational]] = ...,
*,
_normalize: bool = ...,
cls: Type[_T], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ...
) -> _T: ...
@overload
def __new__(cls: Type[_T], __value: Union[float, Decimal, str], *, _normalize: bool = ...) -> _T: ...
def __new__(cls: Type[_T], __value: float | Decimal | str, *, _normalize: bool = ...) -> _T: ...
@classmethod
def from_float(cls, f: float) -> Fraction: ...
@classmethod
@@ -36,97 +32,97 @@ class Fraction(Rational):
@property
def denominator(self) -> int: ...
@overload
def __add__(self, other: Union[int, Fraction]) -> Fraction: ...
def __add__(self, other: int | Fraction) -> Fraction: ...
@overload
def __add__(self, other: float) -> float: ...
@overload
def __add__(self, other: complex) -> complex: ...
@overload
def __radd__(self, other: Union[int, Fraction]) -> Fraction: ...
def __radd__(self, other: int | Fraction) -> Fraction: ...
@overload
def __radd__(self, other: float) -> float: ...
@overload
def __radd__(self, other: complex) -> complex: ...
@overload
def __sub__(self, other: Union[int, Fraction]) -> Fraction: ...
def __sub__(self, other: int | Fraction) -> Fraction: ...
@overload
def __sub__(self, other: float) -> float: ...
@overload
def __sub__(self, other: complex) -> complex: ...
@overload
def __rsub__(self, other: Union[int, Fraction]) -> Fraction: ...
def __rsub__(self, other: int | Fraction) -> Fraction: ...
@overload
def __rsub__(self, other: float) -> float: ...
@overload
def __rsub__(self, other: complex) -> complex: ...
@overload
def __mul__(self, other: Union[int, Fraction]) -> Fraction: ...
def __mul__(self, other: int | Fraction) -> Fraction: ...
@overload
def __mul__(self, other: float) -> float: ...
@overload
def __mul__(self, other: complex) -> complex: ...
@overload
def __rmul__(self, other: Union[int, Fraction]) -> Fraction: ...
def __rmul__(self, other: int | Fraction) -> Fraction: ...
@overload
def __rmul__(self, other: float) -> float: ...
@overload
def __rmul__(self, other: complex) -> complex: ...
@overload
def __truediv__(self, other: Union[int, Fraction]) -> Fraction: ...
def __truediv__(self, other: int | Fraction) -> Fraction: ...
@overload
def __truediv__(self, other: float) -> float: ...
@overload
def __truediv__(self, other: complex) -> complex: ...
@overload
def __rtruediv__(self, other: Union[int, Fraction]) -> Fraction: ...
def __rtruediv__(self, other: int | Fraction) -> Fraction: ...
@overload
def __rtruediv__(self, other: float) -> float: ...
@overload
def __rtruediv__(self, other: complex) -> complex: ...
@overload
def __div__(self, other: Union[int, Fraction]) -> Fraction: ...
def __div__(self, other: int | Fraction) -> Fraction: ...
@overload
def __div__(self, other: float) -> float: ...
@overload
def __div__(self, other: complex) -> complex: ...
@overload
def __rdiv__(self, other: Union[int, Fraction]) -> Fraction: ...
def __rdiv__(self, other: int | Fraction) -> Fraction: ...
@overload
def __rdiv__(self, other: float) -> float: ...
@overload
def __rdiv__(self, other: complex) -> complex: ...
@overload
def __floordiv__(self, other: Union[int, Fraction]) -> int: ...
def __floordiv__(self, other: int | Fraction) -> int: ...
@overload
def __floordiv__(self, other: float) -> float: ...
@overload
def __rfloordiv__(self, other: Union[int, Fraction]) -> int: ...
def __rfloordiv__(self, other: int | Fraction) -> int: ...
@overload
def __rfloordiv__(self, other: float) -> float: ...
@overload
def __mod__(self, other: Union[int, Fraction]) -> Fraction: ...
def __mod__(self, other: int | Fraction) -> Fraction: ...
@overload
def __mod__(self, other: float) -> float: ...
@overload
def __rmod__(self, other: Union[int, Fraction]) -> Fraction: ...
def __rmod__(self, other: int | Fraction) -> Fraction: ...
@overload
def __rmod__(self, other: float) -> float: ...
@overload
def __divmod__(self, other: Union[int, Fraction]) -> Tuple[int, Fraction]: ...
def __divmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ...
@overload
def __divmod__(self, other: float) -> Tuple[float, Fraction]: ...
@overload
def __rdivmod__(self, other: Union[int, Fraction]) -> Tuple[int, Fraction]: ...
def __rdivmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ...
@overload
def __rdivmod__(self, other: float) -> Tuple[float, Fraction]: ...
@overload
def __pow__(self, other: int) -> Fraction: ...
@overload
def __pow__(self, other: Union[float, Fraction]) -> float: ...
def __pow__(self, other: float | Fraction) -> float: ...
@overload
def __pow__(self, other: complex) -> complex: ...
@overload
def __rpow__(self, other: Union[int, float, Fraction]) -> float: ...
def __rpow__(self, other: int | float | Fraction) -> float: ...
@overload
def __rpow__(self, other: complex) -> complex: ...
def __pos__(self) -> Fraction: ...

Some files were not shown because too many files have changed in this diff Show More