Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 11:05:21 +02:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions
+9 -19
View File
@@ -1,35 +1,25 @@
import sys
from _typeshed import SupportsLessThan
from typing import Callable, MutableSequence, Optional, Sequence, TypeVar
from typing import Callable, MutableSequence, Sequence, TypeVar
_T = TypeVar("_T")
if sys.version_info >= (3, 10):
def bisect_left(
a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ..., *, key: Optional[Callable[[_T], SupportsLessThan]] = ...
a: Sequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsLessThan] | None = ...
) -> int: ...
def bisect_right(
a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ..., *, key: Optional[Callable[[_T], SupportsLessThan]] = ...
a: Sequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsLessThan] | None = ...
) -> int: ...
def insort_left(
a: MutableSequence[_T],
x: _T,
lo: int = ...,
hi: Optional[int] = ...,
*,
key: Optional[Callable[[_T], SupportsLessThan]] = ...,
a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsLessThan] | None = ...
) -> None: ...
def insort_right(
a: MutableSequence[_T],
x: _T,
lo: int = ...,
hi: Optional[int] = ...,
*,
key: Optional[Callable[[_T], SupportsLessThan]] = ...,
a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsLessThan] | None = ...
) -> None: ...
else:
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: ...
+42 -44
View File
@@ -1,6 +1,6 @@
import codecs
import sys
from typing import Any, Callable, Dict, Optional, Tuple, Union
from typing import Any, Callable, Dict, Tuple, Union
# This type is not exposed; it is defined in unicodeobject.c
class _EncodingMap:
@@ -13,56 +13,54 @@ def register(__search_function: Callable[[str], Any]) -> None: ...
def register_error(__errors: str, __handler: _Handler) -> None: ...
def lookup(__encoding: str) -> codecs.CodecInfo: ...
def lookup_error(__name: str) -> _Handler: ...
def decode(obj: Any, encoding: str = ..., errors: Optional[str] = ...) -> Any: ...
def encode(obj: Any, encoding: str = ..., errors: Optional[str] = ...) -> Any: ...
def decode(obj: Any, encoding: str = ..., errors: str | None = ...) -> Any: ...
def encode(obj: Any, encoding: str = ..., errors: str | None = ...) -> Any: ...
def charmap_build(__map: str) -> _MapT: ...
def ascii_decode(__data: bytes, __errors: Optional[str] = ...) -> Tuple[str, int]: ...
def ascii_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def charmap_decode(__data: bytes, __errors: Optional[str] = ..., __mapping: Optional[_MapT] = ...) -> Tuple[str, int]: ...
def charmap_encode(__str: str, __errors: Optional[str] = ..., __mapping: Optional[_MapT] = ...) -> Tuple[bytes, int]: ...
def escape_decode(__data: Union[str, bytes], __errors: Optional[str] = ...) -> Tuple[str, int]: ...
def escape_encode(__data: bytes, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def latin_1_decode(__data: bytes, __errors: Optional[str] = ...) -> Tuple[str, int]: ...
def latin_1_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def raw_unicode_escape_decode(__data: Union[str, bytes], __errors: Optional[str] = ...) -> Tuple[str, int]: ...
def raw_unicode_escape_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def readbuffer_encode(__data: Union[str, bytes], __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def unicode_escape_decode(__data: Union[str, bytes], __errors: Optional[str] = ...) -> Tuple[str, int]: ...
def unicode_escape_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def ascii_decode(__data: bytes, __errors: str | None = ...) -> Tuple[str, int]: ...
def ascii_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def charmap_decode(__data: bytes, __errors: str | None = ..., __mapping: _MapT | None = ...) -> Tuple[str, int]: ...
def charmap_encode(__str: str, __errors: str | None = ..., __mapping: _MapT | None = ...) -> Tuple[bytes, int]: ...
def escape_decode(__data: str | bytes, __errors: str | None = ...) -> Tuple[str, int]: ...
def escape_encode(__data: bytes, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def latin_1_decode(__data: bytes, __errors: str | None = ...) -> Tuple[str, int]: ...
def latin_1_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def raw_unicode_escape_decode(__data: str | bytes, __errors: str | None = ...) -> Tuple[str, int]: ...
def raw_unicode_escape_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def readbuffer_encode(__data: str | bytes, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def unicode_escape_decode(__data: str | bytes, __errors: str | None = ...) -> Tuple[str, int]: ...
def unicode_escape_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
if sys.version_info < (3, 8):
def unicode_internal_decode(__obj: Union[str, bytes], __errors: Optional[str] = ...) -> Tuple[str, int]: ...
def unicode_internal_encode(__obj: Union[str, bytes], __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def unicode_internal_decode(__obj: str | bytes, __errors: str | None = ...) -> Tuple[str, int]: ...
def unicode_internal_encode(__obj: str | bytes, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def utf_16_be_decode(__data: bytes, __errors: Optional[str] = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_16_be_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def utf_16_decode(__data: bytes, __errors: Optional[str] = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_16_encode(__str: str, __errors: Optional[str] = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ...
def utf_16_be_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_16_be_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def utf_16_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_16_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ...
def utf_16_ex_decode(
__data: bytes, __errors: Optional[str] = ..., __byteorder: int = ..., __final: int = ...
__data: bytes, __errors: str | None = ..., __byteorder: int = ..., __final: int = ...
) -> Tuple[str, int, int]: ...
def utf_16_le_decode(__data: bytes, __errors: Optional[str] = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_16_le_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def utf_32_be_decode(__data: bytes, __errors: Optional[str] = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_32_be_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def utf_32_decode(__data: bytes, __errors: Optional[str] = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_32_encode(__str: str, __errors: Optional[str] = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ...
def utf_16_le_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_16_le_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def utf_32_be_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_32_be_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def utf_32_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_32_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> Tuple[bytes, int]: ...
def utf_32_ex_decode(
__data: bytes, __errors: Optional[str] = ..., __byteorder: int = ..., __final: int = ...
__data: bytes, __errors: str | None = ..., __byteorder: int = ..., __final: int = ...
) -> Tuple[str, int, int]: ...
def utf_32_le_decode(__data: bytes, __errors: Optional[str] = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_32_le_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def utf_7_decode(__data: bytes, __errors: Optional[str] = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_7_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def utf_8_decode(__data: bytes, __errors: Optional[str] = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_8_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def utf_32_le_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_32_le_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def utf_7_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_7_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def utf_8_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ...
def utf_8_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
if sys.platform == "win32":
def mbcs_decode(__data: bytes, __errors: Optional[str] = ..., __final: int = ...) -> Tuple[str, int]: ...
def mbcs_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def code_page_decode(
__codepage: int, __data: bytes, __errors: Optional[str] = ..., __final: int = ...
) -> Tuple[str, int]: ...
def code_page_encode(__code_page: int, __str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def oem_decode(__data: bytes, __errors: Optional[str] = ..., __final: int = ...) -> Tuple[str, int]: ...
def oem_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ...
def mbcs_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ...
def mbcs_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def code_page_decode(__codepage: int, __data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ...
def code_page_encode(__code_page: int, __str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
def oem_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> Tuple[str, int]: ...
def oem_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ...
+2 -2
View File
@@ -1,6 +1,6 @@
from _typeshed import WriteableBuffer
from io import BufferedIOBase, RawIOBase
from typing import Any, Callable, Protocol, Tuple, Type, Union
from typing import Any, Callable, Protocol, Tuple, Type
BUFFER_SIZE: Any
@@ -16,7 +16,7 @@ class DecompressReader(RawIOBase):
self,
fp: _Reader,
decomp_factory: Callable[..., object],
trailing_error: Union[Type[Exception], Tuple[Type[Exception], ...]] = ...,
trailing_error: Type[Exception] | Tuple[Type[Exception], ...] = ...,
**decomp_args: Any,
) -> None: ...
def readable(self) -> bool: ...
+3 -3
View File
@@ -1,4 +1,4 @@
from typing import Any, Iterable, Iterator, List, Optional, Protocol, Type, Union
from typing import Any, Iterable, Iterator, List, Protocol, 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
+5 -5
View File
@@ -1,5 +1,5 @@
import sys
from typing import IO, Any, BinaryIO, NamedTuple, Optional, Tuple, Union, overload
from typing import IO, Any, BinaryIO, NamedTuple, Tuple, Union, overload
_chtype = Union[str, bytes, int]
@@ -338,7 +338,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: ...
@@ -359,7 +359,7 @@ def tparm(
) -> bytes: ...
def typeahead(__fd: int) -> None: ...
def unctrl(__ch: _chtype) -> bytes: ...
def unget_wch(__ch: Union[int, str]) -> None: ...
def unget_wch(__ch: int | str) -> None: ...
def ungetch(__ch: _chtype) -> None: ...
def ungetmouse(__id: int, __x: int, __y: int, __z: int, __bstate: int) -> None: ...
def update_lines_cols() -> int: ...
@@ -434,9 +434,9 @@ class _CursesWindow:
@overload
def getch(self, y: int, x: int) -> int: ...
@overload
def get_wch(self) -> Union[int, str]: ...
def get_wch(self) -> int | str: ...
@overload
def get_wch(self, y: int, x: int) -> Union[int, str]: ...
def get_wch(self, y: int, x: int) -> int | str: ...
@overload
def getkey(self) -> str: ...
@overload
+4 -4
View File
@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, NoReturn, Optional, Tuple
from typing import Any, Callable, Dict, NoReturn, Tuple
TIMEOUT_MAX: int
error = RuntimeError
@@ -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] = ..., timeout: int = ...) -> bool: ...
def __enter__(self, waitflag: Optional[bool] = ..., timeout: int = ...) -> bool: ...
def acquire(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ...
def __enter__(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ...
def __exit__(self, typ: Any, val: Any, tb: Any) -> None: ...
def release(self) -> bool: ...
def locked(self) -> bool: ...
+27 -27
View File
@@ -1,6 +1,6 @@
import sys
from types import FrameType, TracebackType
from typing import Any, Callable, Iterable, List, Mapping, Optional, Type, TypeVar, Union
from typing import Any, Callable, Iterable, List, Mapping, Optional, Type, TypeVar
# TODO recursive type
_TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
@@ -21,7 +21,7 @@ if sys.version_info >= (3, 8):
from _thread import get_native_id as get_native_id
def settrace(func: _TF) -> None: ...
def setprofile(func: Optional[_PF]) -> None: ...
def setprofile(func: _PF | None) -> None: ...
def stack_size(size: int = ...) -> int: ...
TIMEOUT_MAX: float
@@ -35,26 +35,26 @@ 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[str] = ...,
target: Callable[..., Any] | None = ...,
name: str | None = ...,
args: Iterable[Any] = ...,
kwargs: Optional[Mapping[str, Any]] = ...,
kwargs: Mapping[str, Any] | None = ...,
*,
daemon: Optional[bool] = ...,
daemon: bool | 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: str) -> None: ...
if sys.version_info >= (3, 8):
@property
def native_id(self) -> Optional[int]: ... # only available on some platforms
def native_id(self) -> int | None: ... # only available on some platforms
def is_alive(self) -> bool: ...
if sys.version_info < (3, 9):
def isAlive(self) -> bool: ...
@@ -67,8 +67,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 = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
def locked(self) -> bool: ...
@@ -77,23 +77,23 @@ 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 = ..., timeout: float = ...) -> 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 = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> bool: ...
def wait_for(self, predicate: Callable[[], _T], timeout: Optional[float] = ...) -> _T: ...
def wait(self, timeout: float | None = ...) -> bool: ...
def wait_for(self, predicate: Callable[[], _T], timeout: float | None = ...) -> _T: ...
def notify(self, n: int = ...) -> None: ...
def notify_all(self) -> None: ...
def notifyAll(self) -> None: ...
@@ -101,10 +101,10 @@ 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]: ...
def acquire(self, blocking: bool = ..., timeout: Optional[float] = ...) -> bool: ...
def __enter__(self, blocking: bool = ..., timeout: Optional[float] = ...) -> bool: ...
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> bool | None: ...
def acquire(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ...
def __enter__(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ...
if sys.version_info >= (3, 9):
def release(self, n: int = ...) -> None: ...
else:
@@ -117,7 +117,7 @@ class Event:
def is_set(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> bool: ...
def wait(self, timeout: float | None = ...) -> bool: ...
if sys.version_info >= (3, 8):
from _thread import _excepthook, _ExceptHookArgs
@@ -130,8 +130,8 @@ class Timer(Thread):
self,
interval: float,
function: Callable[..., Any],
args: Optional[Iterable[Any]] = ...,
kwargs: Optional[Mapping[str, Any]] = ...,
args: Iterable[Any] | None = ...,
kwargs: Mapping[str, Any] | None = ...,
) -> None: ...
def cancel(self) -> None: ...
@@ -139,8 +139,8 @@ class Barrier:
parties: int
n_waiting: int
broken: bool
def __init__(self, parties: int, action: Optional[Callable[[], None]] = ..., timeout: Optional[float] = ...) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> int: ...
def __init__(self, parties: int, action: Callable[[], None] | None = ..., timeout: float | None = ...) -> None: ...
def wait(self, timeout: float | None = ...) -> int: ...
def reset(self) -> None: ...
def abort(self) -> None: ...
+3 -3
View File
@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, Optional, Tuple
from typing import Any, Callable, Dict, Tuple
class make_encoder:
sort_keys: Any
@@ -11,10 +11,10 @@ class make_encoder:
item_separator: Any
def __init__(
self,
markers: Optional[Dict[int, Any]],
markers: Dict[int, Any] | None,
default: Callable[[Any], Any],
encoder: Callable[[str], str],
indent: Optional[int],
indent: int | None,
key_separator: str,
item_separator: str,
sort_keys: bool,
+4 -4
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
+5 -5
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]: ...
+2 -2
View File
@@ -1,11 +1,11 @@
from typing import ClassVar, Iterable, NoReturn, Optional
from typing import ClassVar, Iterable, NoReturn
from typing_extensions import Literal
class Quitter:
name: str
eof: str
def __init__(self, name: str, eof: str) -> None: ...
def __call__(self, code: Optional[int] = ...) -> NoReturn: ...
def __call__(self, code: int | None = ...) -> NoReturn: ...
class _Printer:
MAXLINES: ClassVar[Literal[23]]
+4 -4
View File
@@ -1,7 +1,7 @@
import sys
from _typeshed import ReadableBuffer, WriteableBuffer
from collections.abc import Iterable
from typing import Any, Optional, SupportsInt, Tuple, Union, overload
from typing import Any, SupportsInt, Tuple, Union, overload
if sys.version_info >= (3, 8):
from typing import SupportsIndex
@@ -541,7 +541,7 @@ class socket:
def getsockopt(self, __level: int, __optname: int, __buflen: int) -> bytes: ...
if sys.version_info >= (3, 7):
def getblocking(self) -> bool: ...
def gettimeout(self) -> Optional[float]: ...
def gettimeout(self) -> float | None: ...
if sys.platform == "win32":
def ioctl(self, __control: int, __option: int | tuple[int, int, int] | bool) -> None: ...
def listen(self, __backlog: int = ...) -> None: ...
@@ -599,7 +599,7 @@ def getaddrinfo(
type: int = ...,
proto: int = ...,
flags: int = ...,
) -> list[tuple[int, int, int, str, Union[tuple[str, int], tuple[str, int, int, int]]]]: ...
) -> list[tuple[int, int, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ...
def gethostbyname(__hostname: str) -> str: ...
def gethostbyname_ex(__hostname: str) -> tuple[str, list[str], list[str]]: ...
def gethostname() -> str: ...
@@ -618,7 +618,7 @@ def inet_pton(__address_family: int, __ip_string: str) -> bytes: ...
def inet_ntop(__address_family: int, __packed_ip: bytes) -> str: ...
def CMSG_LEN(__length: int) -> int: ...
def CMSG_SPACE(__length: int) -> int: ...
def getdefaulttimeout() -> Optional[float]: ...
def getdefaulttimeout() -> float | None: ...
def setdefaulttimeout(__timeout: float | None) -> None: ...
def socketpair(__family: int = ..., __type: int = ..., __proto: int = ...) -> tuple[socket, socket]: ...
+2 -2
View File
@@ -1,8 +1,8 @@
import sys
from tracemalloc import _FrameTupleT, _TraceTupleT
from typing import Optional, Sequence, Tuple
from typing import Sequence, Tuple
def _get_object_traceback(__obj: object) -> Optional[Sequence[_FrameTupleT]]: ...
def _get_object_traceback(__obj: object) -> Sequence[_FrameTupleT] | None: ...
def _get_traces() -> Sequence[_TraceTupleT]: ...
def clear_traces() -> None: ...
def get_traceback_limit() -> int: ...
+2 -2
View File
@@ -3,12 +3,12 @@
# See the README.md file in this directory for more information.
from sys import _OptExcInfo
from typing import Any, Callable, Dict, Iterable, List, Optional, Protocol, Tuple
from typing import Any, Callable, Dict, Iterable, List, Protocol, Tuple
# stable
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[str, Any] # stable
+3 -3
View File
@@ -1,10 +1,10 @@
# See the README.md file in this directory for more information.
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: ...
+11 -11
View File
@@ -1,23 +1,23 @@
from typing import Any, Dict, List, Optional, Tuple, Type, Union, overload
from typing import Any, Dict, List, Tuple, Type, overload
_defaultaction: str
_onceregistry: Dict[Any, Any]
filters: List[Tuple[Any, ...]]
@overload
def warn(message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ..., source: Optional[Any] = ...) -> None: ...
def warn(message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...) -> None: ...
@overload
def warn(message: Warning, category: Any = ..., stacklevel: int = ..., source: Optional[Any] = ...) -> None: ...
def warn(message: Warning, category: Any = ..., stacklevel: int = ..., source: Any | None = ...) -> None: ...
@overload
def warn_explicit(
message: str,
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]] = ...,
source: Optional[Any] = ...,
module: str | None = ...,
registry: Dict[str | Tuple[str, Type[Warning], int], int] | None = ...,
module_globals: Dict[str, Any] | None = ...,
source: Any | None = ...,
) -> None: ...
@overload
def warn_explicit(
@@ -25,8 +25,8 @@ 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]] = ...,
source: Optional[Any] = ...,
module: str | None = ...,
registry: Dict[str | Tuple[str, Type[Warning], int], int] | None = ...,
module_globals: Dict[str, Any] | None = ...,
source: Any | None = ...,
) -> None: ...
+5 -5
View File
@@ -1,5 +1,5 @@
import sys
from typing import Any, Callable, Generic, List, Optional, TypeVar, overload
from typing import Any, Callable, Generic, List, TypeVar, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -15,8 +15,8 @@ class ProxyType(Generic[_T]): # "weakproxy"
class ReferenceType(Generic[_T]):
__callback__: Callable[[ReferenceType[_T]], Any]
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: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
@@ -26,8 +26,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: ...
+8 -8
View File
@@ -1,5 +1,5 @@
import sys
from typing import Any, Generic, Iterable, Iterator, MutableSet, Optional, TypeVar, Union
from typing import Any, Generic, Iterable, Iterator, MutableSet, TypeVar
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -9,7 +9,7 @@ _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: ...
@@ -20,7 +20,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: ...
@@ -36,12 +36,12 @@ 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: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
+10 -10
View File
@@ -1,5 +1,5 @@
import sys
from typing import Any, Dict, NoReturn, Optional, Sequence, Tuple, Union, overload
from typing import Any, Dict, NoReturn, Sequence, Tuple, overload
from typing_extensions import Literal
CREATE_NEW_CONSOLE: int
@@ -52,7 +52,7 @@ def ConnectNamedPipe(handle: int, overlapped: Literal[True]) -> Overlapped: ...
@overload
def ConnectNamedPipe(handle: int, overlapped: Literal[False] = ...) -> None: ...
@overload
def ConnectNamedPipe(handle: int, overlapped: bool) -> Optional[Overlapped]: ...
def ConnectNamedPipe(handle: int, overlapped: bool) -> Overlapped | None: ...
def CreateFile(
__file_name: str,
__desired_access: int,
@@ -75,14 +75,14 @@ def CreateNamedPipe(
) -> int: ...
def CreatePipe(__pipe_attrs: Any, __size: int) -> Tuple[int, int]: ...
def CreateProcess(
__application_name: Optional[str],
__command_line: Optional[str],
__application_name: str | None,
__command_line: str | None,
__proc_attrs: Any,
__thread_attrs: Any,
__inherit_handles: bool,
__creation_flags: int,
__env_mapping: Dict[str, str],
__current_directory: Optional[str],
__current_directory: str | None,
__startup_info: Any,
) -> Tuple[int, int, int, int]: ...
def DuplicateHandle(
@@ -106,15 +106,15 @@ def GetModuleFileName(__module_handle: int) -> str: ...
def GetStdHandle(__std_handle: int) -> int: ...
def GetVersion() -> int: ...
def OpenProcess(__desired_access: int, __inherit_handle: bool, __process_id: int) -> int: ...
def PeekNamedPipe(__handle: int, __size: int = ...) -> Union[Tuple[int, int], Tuple[bytes, int, int]]: ...
def PeekNamedPipe(__handle: int, __size: int = ...) -> Tuple[int, int] | Tuple[bytes, int, int]: ...
@overload
def ReadFile(handle: int, size: int, overlapped: Literal[True]) -> Tuple[Overlapped, int]: ...
@overload
def ReadFile(handle: int, size: int, overlapped: Literal[False] = ...) -> Tuple[bytes, int]: ...
@overload
def ReadFile(handle: int, size: int, overlapped: Union[int, bool]) -> Tuple[Any, int]: ...
def ReadFile(handle: int, size: int, overlapped: int | bool) -> Tuple[Any, int]: ...
def SetNamedPipeHandleState(
__named_pipe: int, __mode: Optional[int], __max_collection_count: Optional[int], __collect_data_timeout: Optional[int]
__named_pipe: int, __mode: int | None, __max_collection_count: int | None, __collect_data_timeout: int | None
) -> None: ...
def TerminateProcess(__handle: int, __exit_code: int) -> None: ...
def WaitForMultipleObjects(__handle_seq: Sequence[int], __wait_flag: bool, __milliseconds: int = ...) -> int: ...
@@ -125,10 +125,10 @@ def WriteFile(handle: int, buffer: bytes, overlapped: Literal[True]) -> Tuple[Ov
@overload
def WriteFile(handle: int, buffer: bytes, overlapped: Literal[False] = ...) -> Tuple[int, int]: ...
@overload
def WriteFile(handle: int, buffer: bytes, overlapped: Union[int, bool]) -> Tuple[Any, int]: ...
def WriteFile(handle: int, buffer: bytes, overlapped: int | bool) -> Tuple[Any, int]: ...
class Overlapped:
event: int = ...
def GetOverlappedResult(self, __wait: bool) -> Tuple[int, int]: ...
def cancel(self) -> None: ...
def getbuffer(self) -> Optional[bytes]: ...
def getbuffer(self) -> bytes | None: ...
+7 -7
View File
@@ -1,7 +1,7 @@
import sys
from _typeshed import Self
from types import TracebackType
from typing import IO, Any, List, NamedTuple, Optional, Tuple, Type, Union, overload
from typing import IO, Any, List, NamedTuple, Tuple, Type, Union, overload
from typing_extensions import Literal
class Error(Exception): ...
@@ -21,7 +21,7 @@ class Aifc_read:
def __init__(self, f: _File) -> None: ...
def __enter__(self: Self) -> Self: ...
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 initfp(self, file: IO[bytes]) -> None: ...
def getfp(self) -> IO[bytes]: ...
@@ -35,7 +35,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: ...
@@ -45,7 +45,7 @@ class Aifc_write:
def __del__(self) -> None: ...
def __enter__(self: Self) -> Self: ...
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 initfp(self, file: IO[bytes]) -> None: ...
def aiff(self) -> None: ...
@@ -65,7 +65,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: ...
@@ -76,7 +76,7 @@ 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: ...
if sys.version_info < (3, 9):
@overload
@@ -84,4 +84,4 @@ if sys.version_info < (3, 9):
@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: ...
+90 -102
View File
@@ -8,14 +8,12 @@ from typing import (
Iterable,
List,
NoReturn,
Optional,
Pattern,
Protocol,
Sequence,
Tuple,
Type,
TypeVar,
Union,
overload,
)
@@ -32,9 +30,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:
@@ -43,7 +41,7 @@ class _AttributeHolder:
# undocumented
class _ActionsContainer:
description: Optional[str]
description: str | None
prefix_chars: str
argument_default: Any
conflict_handler: str
@@ -56,7 +54,7 @@ class _ActionsContainer:
_defaults: Dict[str, Any]
_negative_number_matcher: Pattern[str]
_has_negative_number_optionals: List[bool]
def __init__(self, description: Optional[str], prefix_chars: str, argument_default: Any, conflict_handler: str) -> None: ...
def __init__(self, description: str | None, prefix_chars: str, argument_default: Any, conflict_handler: str) -> None: ...
def register(self, registry_name: str, value: Any, object: Any) -> None: ...
def _registry_get(self, registry_name: str, value: Any, default: Any = ...) -> Any: ...
def set_defaults(self, **kwargs: Any) -> None: ...
@@ -64,16 +62,16 @@ class _ActionsContainer:
def add_argument(
self,
*name_or_flags: str,
action: Union[str, Type[Action]] = ...,
nargs: Union[int, str] = ...,
action: str | Type[Action] = ...,
nargs: int | str = ...,
const: Any = ...,
default: Any = ...,
type: Union[Callable[[str], _T], Callable[[str], _T], FileType] = ...,
choices: Optional[Iterable[_T]] = ...,
type: Callable[[str], _T] | Callable[[str], _T] | FileType = ...,
choices: Iterable[_T] | None = ...,
required: bool = ...,
help: Optional[str] = ...,
metavar: Optional[Union[str, Tuple[str, ...]]] = ...,
dest: Optional[str] = ...,
help: str | None = ...,
metavar: str | Tuple[str, ...] | None = ...,
dest: str | None = ...,
version: str = ...,
**kwargs: Any,
) -> Action: ...
@@ -84,7 +82,7 @@ class _ActionsContainer:
def _add_container_actions(self, container: _ActionsContainer) -> None: ...
def _get_positional_kwargs(self, dest: str, **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[str, Action]]], Any]: ...
def _check_conflict(self, action: Action) -> None: ...
def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[Tuple[str, Action]]) -> NoReturn: ...
@@ -95,29 +93,29 @@ class _FormatterClass(Protocol):
class ArgumentParser(_AttributeHolder, _ActionsContainer):
prog: str
usage: Optional[str]
epilog: Optional[str]
usage: str | None
epilog: str | None
formatter_class: _FormatterClass
fromfile_prefix_chars: Optional[str]
fromfile_prefix_chars: str | None
add_help: bool
allow_abbrev: bool
# undocumented
_positionals: _ArgumentGroup
_optionals: _ArgumentGroup
_subparsers: Optional[_ArgumentGroup]
_subparsers: _ArgumentGroup | None
if sys.version_info >= (3, 9):
def __init__(
self,
prog: Optional[str] = ...,
usage: Optional[str] = ...,
description: Optional[str] = ...,
epilog: Optional[str] = ...,
prog: str | None = ...,
usage: str | None = ...,
description: str | None = ...,
epilog: str | None = ...,
parents: Sequence[ArgumentParser] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: str = ...,
fromfile_prefix_chars: Optional[str] = ...,
fromfile_prefix_chars: str | None = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
add_help: bool = ...,
@@ -127,14 +125,14 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
else:
def __init__(
self,
prog: Optional[str] = ...,
usage: Optional[str] = ...,
description: Optional[str] = ...,
epilog: Optional[str] = ...,
prog: str | None = ...,
usage: str | None = ...,
description: str | None = ...,
epilog: str | None = ...,
parents: Sequence[ArgumentParser] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: str = ...,
fromfile_prefix_chars: Optional[str] = ...,
fromfile_prefix_chars: str | None = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
add_help: bool = ...,
@@ -143,11 +141,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[str]] = ...) -> Namespace: ...
def parse_args(self, args: Sequence[str] | None = ...) -> Namespace: ...
@overload
def parse_args(self, args: Optional[Sequence[str]], namespace: None) -> Namespace: ... # type: ignore
def parse_args(self, args: Sequence[str] | None, namespace: None) -> Namespace: ... # type: ignore
@overload
def parse_args(self, args: Optional[Sequence[str]], namespace: _N) -> _N: ...
def parse_args(self, args: Sequence[str] | None, namespace: _N) -> _N: ...
@overload
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore
@overload
@@ -157,46 +155,44 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
self,
*,
title: str = ...,
description: Optional[str] = ...,
description: str | None = ...,
prog: str = ...,
parser_class: Type[ArgumentParser] = ...,
action: Type[Action] = ...,
option_string: str = ...,
dest: Optional[str] = ...,
dest: str | None = ...,
required: bool = ...,
help: Optional[str] = ...,
metavar: Optional[str] = ...,
help: str | None = ...,
metavar: str | None = ...,
) -> _SubParsersAction: ...
else:
def add_subparsers(
self,
*,
title: str = ...,
description: Optional[str] = ...,
description: str | None = ...,
prog: str = ...,
parser_class: Type[ArgumentParser] = ...,
action: Type[Action] = ...,
option_string: str = ...,
dest: Optional[str] = ...,
help: Optional[str] = ...,
metavar: Optional[str] = ...,
dest: str | None = ...,
help: str | None = ...,
metavar: str | 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[str]] = ..., namespace: Optional[Namespace] = ...
self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...
) -> Tuple[Namespace, List[str]]: ...
def convert_arg_line_to_args(self, arg_line: str) -> List[str]: ...
def exit(self, status: int = ..., message: Optional[str] = ...) -> NoReturn: ...
def exit(self, status: int = ..., message: str | None = ...) -> NoReturn: ...
def error(self, message: str) -> NoReturn: ...
if sys.version_info >= (3, 7):
def parse_intermixed_args(
self, args: Optional[Sequence[str]] = ..., namespace: Optional[Namespace] = ...
) -> Namespace: ...
def parse_intermixed_args(self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...) -> Namespace: ...
def parse_known_intermixed_args(
self, args: Optional[Sequence[str]] = ..., namespace: Optional[Namespace] = ...
self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...
) -> Tuple[Namespace, List[str]]: ...
# undocumented
def _get_optional_actions(self) -> List[Action]: ...
@@ -205,14 +201,14 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
def _read_args_from_files(self, arg_strings: List[str]) -> List[str]: ...
def _match_argument(self, action: Action, arg_strings_pattern: str) -> int: ...
def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: str) -> List[int]: ...
def _parse_optional(self, arg_string: str) -> Optional[Tuple[Optional[Action], str, Optional[str]]]: ...
def _get_option_tuples(self, option_string: str) -> List[Tuple[Action, str, Optional[str]]]: ...
def _parse_optional(self, arg_string: str) -> Tuple[Action | None, str, str | None] | None: ...
def _get_option_tuples(self, option_string: str) -> List[Tuple[Action, str, str | None]]: ...
def _get_nargs_pattern(self, action: Action) -> str: ...
def _get_values(self, action: Action, arg_strings: List[str]) -> Any: ...
def _get_value(self, action: Action, arg_string: str) -> 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
@@ -228,24 +224,22 @@ class HelpFormatter:
_whitespace_matcher: Pattern[str]
_long_break_matcher: Pattern[str]
_Section: Type[Any] # Nested class
def __init__(
self, prog: str, indent_increment: int = ..., max_help_position: int = ..., width: Optional[int] = ...
) -> None: ...
def __init__(self, prog: str, 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[..., str], args: Iterable[Any]) -> None: ...
def start_section(self, heading: Optional[str]) -> None: ...
def start_section(self, heading: str | None) -> None: ...
def end_section(self) -> None: ...
def add_text(self, text: Optional[str]) -> None: ...
def add_text(self, text: str | None) -> None: ...
def add_usage(
self, usage: Optional[str], actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[str] = ...
self, usage: str | None, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: str | None = ...
) -> None: ...
def add_argument(self, action: Action) -> None: ...
def add_arguments(self, actions: Iterable[Action]) -> None: ...
def format_help(self) -> str: ...
def _join_parts(self, part_strings: Iterable[str]) -> str: ...
def _format_usage(
self, usage: str, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[str]
self, usage: str, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: str | None
) -> str: ...
def _format_actions_usage(self, actions: Iterable[Action], groups: Iterable[_ArgumentGroup]) -> str: ...
def _format_text(self, text: str) -> str: ...
@@ -257,7 +251,7 @@ class HelpFormatter:
def _iter_indented_subactions(self, action: Action) -> Generator[Action, None, None]: ...
def _split_lines(self, text: str, width: int) -> List[str]: ...
def _fill_text(self, text: str, width: int, indent: str) -> str: ...
def _get_help_string(self, action: Action) -> Optional[str]: ...
def _get_help_string(self, action: Action) -> str | None: ...
def _get_default_metavar_for_optional(self, action: Action) -> str: ...
def _get_default_metavar_for_positional(self, action: Action) -> str: ...
@@ -269,33 +263,29 @@ class MetavarTypeHelpFormatter(HelpFormatter): ...
class Action(_AttributeHolder):
option_strings: Sequence[str]
dest: str
nargs: Optional[Union[int, str]]
nargs: int | str | 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[str]
metavar: Optional[Union[str, Tuple[str, ...]]]
help: str | None
metavar: str | Tuple[str, ...] | None
def __init__(
self,
option_strings: Sequence[str],
dest: str,
nargs: Optional[Union[int, str]] = ...,
const: Optional[_T] = ...,
default: Union[_T, str, None] = ...,
type: Optional[Union[Callable[[str], _T], Callable[[str], _T], FileType]] = ...,
choices: Optional[Iterable[_T]] = ...,
nargs: int | str | None = ...,
const: _T | None = ...,
default: _T | str | None = ...,
type: Callable[[str], _T] | Callable[[str], _T] | FileType | None = ...,
choices: Iterable[_T] | None = ...,
required: bool = ...,
help: Optional[str] = ...,
metavar: Optional[Union[str, Tuple[str, ...]]] = ...,
help: str | None = ...,
metavar: str | Tuple[str, ...] | None = ...,
) -> None: ...
def __call__(
self,
parser: ArgumentParser,
namespace: Namespace,
values: Union[str, Sequence[Any], None],
option_string: Optional[str] = ...,
self, parser: ArgumentParser, namespace: Namespace, values: str | Sequence[Any] | None, option_string: str | None = ...
) -> None: ...
if sys.version_info >= (3, 9):
def format_usage(self) -> str: ...
@@ -306,12 +296,12 @@ if sys.version_info >= (3, 9):
self,
option_strings: Sequence[str],
dest: str,
default: Union[_T, str, None] = ...,
type: Optional[Union[Callable[[str], _T], Callable[[str], _T], FileType]] = ...,
choices: Optional[Iterable[_T]] = ...,
default: _T | str | None = ...,
type: Callable[[str], _T] | Callable[[str], _T] | FileType | None = ...,
choices: Iterable[_T] | None = ...,
required: bool = ...,
help: Optional[str] = ...,
metavar: Optional[Union[str, Tuple[str, ...]]] = ...,
help: str | None = ...,
metavar: str | Tuple[str, ...] | None = ...,
) -> None: ...
class Namespace(_AttributeHolder):
@@ -324,19 +314,17 @@ class FileType:
# undocumented
_mode: str
_bufsize: int
_encoding: Optional[str]
_errors: Optional[str]
def __init__(
self, mode: str = ..., bufsize: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ...
) -> None: ...
_encoding: str | None
_errors: str | None
def __init__(self, mode: str = ..., bufsize: int = ..., encoding: str | None = ..., errors: str | None = ...) -> None: ...
def __call__(self, string: str) -> IO[Any]: ...
# undocumented
class _ArgumentGroup(_ActionsContainer):
title: Optional[str]
title: str | None
_group_actions: List[Action]
def __init__(
self, container: _ActionsContainer, title: Optional[str] = ..., description: Optional[str] = ..., **kwargs: Any
self, container: _ActionsContainer, title: str | None = ..., description: str | None = ..., **kwargs: Any
) -> None: ...
# undocumented
@@ -357,20 +345,20 @@ class _StoreConstAction(Action):
const: Any,
default: Any = ...,
required: bool = ...,
help: Optional[str] = ...,
metavar: Optional[Union[str, Tuple[str, ...]]] = ...,
help: str | None = ...,
metavar: str | Tuple[str, ...] | None = ...,
) -> None: ...
# undocumented
class _StoreTrueAction(_StoreConstAction):
def __init__(
self, option_strings: Sequence[str], dest: str, default: bool = ..., required: bool = ..., help: Optional[str] = ...
self, option_strings: Sequence[str], dest: str, default: bool = ..., required: bool = ..., help: str | None = ...
) -> None: ...
# undocumented
class _StoreFalseAction(_StoreConstAction):
def __init__(
self, option_strings: Sequence[str], dest: str, default: bool = ..., required: bool = ..., help: Optional[str] = ...
self, option_strings: Sequence[str], dest: str, default: bool = ..., required: bool = ..., help: str | None = ...
) -> None: ...
# undocumented
@@ -385,25 +373,25 @@ class _AppendConstAction(Action):
const: Any,
default: Any = ...,
required: bool = ...,
help: Optional[str] = ...,
metavar: Optional[Union[str, Tuple[str, ...]]] = ...,
help: str | None = ...,
metavar: str | Tuple[str, ...] | None = ...,
) -> None: ...
# undocumented
class _CountAction(Action):
def __init__(
self, option_strings: Sequence[str], dest: str, default: Any = ..., required: bool = ..., help: Optional[str] = ...
self, option_strings: Sequence[str], dest: str, default: Any = ..., required: bool = ..., help: str | None = ...
) -> None: ...
# undocumented
class _HelpAction(Action):
def __init__(self, option_strings: Sequence[str], dest: str = ..., default: str = ..., help: Optional[str] = ...) -> None: ...
def __init__(self, option_strings: Sequence[str], dest: str = ..., default: str = ..., help: str | None = ...) -> None: ...
# undocumented
class _VersionAction(Action):
version: Optional[str]
version: str | None
def __init__(
self, option_strings: Sequence[str], version: Optional[str] = ..., dest: str = ..., default: str = ..., help: str = ...
self, option_strings: Sequence[str], version: str | None = ..., dest: str = ..., default: str = ..., help: str = ...
) -> None: ...
# undocumented
@@ -422,8 +410,8 @@ class _SubParsersAction(Action):
parser_class: Type[ArgumentParser],
dest: str = ...,
required: bool = ...,
help: Optional[str] = ...,
metavar: Optional[Union[str, Tuple[str, ...]]] = ...,
help: str | None = ...,
metavar: str | Tuple[str, ...] | None = ...,
) -> None: ...
else:
def __init__(
@@ -432,8 +420,8 @@ class _SubParsersAction(Action):
prog: str,
parser_class: Type[ArgumentParser],
dest: str = ...,
help: Optional[str] = ...,
metavar: Optional[Union[str, Tuple[str, ...]]] = ...,
help: str | None = ...,
metavar: str | Tuple[str, ...] | None = ...,
) -> None: ...
# TODO: Type keyword args properly.
def add_parser(self, name: str, **kwargs: Any) -> ArgumentParser: ...
@@ -447,4 +435,4 @@ if sys.version_info < (3, 7):
def _ensure_value(namespace: Namespace, name: str, value: Any) -> Any: ...
# undocumented
def _get_action_name(argument: Optional[Action]) -> Optional[str]: ...
def _get_action_name(argument: Action | None) -> str | None: ...
+5 -5
View File
@@ -15,13 +15,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[str], typecode: _UnicodeTypeCode, __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
def __init__(self: array[str], 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: ...
@@ -55,7 +55,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: ...
+3 -4
View File
@@ -1,7 +1,6 @@
import asyncore
import socket
from abc import abstractmethod
from typing import Optional, Union
class simple_producer:
def __init__(self, data: bytes, buffer_size: int = ...) -> None: ...
@@ -10,13 +9,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: ...
+63 -80
View File
@@ -9,7 +9,7 @@ from asyncio.tasks import Task
from asyncio.transports import BaseTransport
from collections.abc import Iterable
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Sequence, Tuple, TypeVar, Union, overload
from typing_extensions import Literal
if sys.version_info >= (3, 7):
@@ -31,7 +31,7 @@ class Server(AbstractServer):
protocol_factory: _ProtocolFactory,
ssl_context: _SSLContext,
backlog: int,
ssl_handshake_timeout: Optional[float],
ssl_handshake_timeout: float | None,
) -> None: ...
else:
def __init__(self, loop: AbstractEventLoop, sockets: list[socket]) -> None: ...
@@ -42,7 +42,7 @@ class Server(AbstractServer):
@property
def sockets(self) -> list[socket]: ...
else:
sockets: Optional[list[socket]]
sockets: list[socket] | None
class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
def run_forever(self) -> None: ...
@@ -58,12 +58,12 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
async def shutdown_asyncgens(self) -> None: ...
# Methods scheduling callbacks. All these return Handles.
if sys.version_info >= (3, 7):
def call_soon(self, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...) -> Handle: ...
def call_soon(self, callback: Callable[..., Any], *args: Any, context: Context | None = ...) -> Handle: ...
def call_later(
self, delay: float, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...
self, delay: float, callback: Callable[..., Any], *args: Any, context: Context | None = ...
) -> TimerHandle: ...
def call_at(
self, when: float, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...
self, when: float, callback: Callable[..., Any], *args: Any, context: Context | None = ...
) -> TimerHandle: ...
else:
def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
@@ -74,34 +74,23 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
def create_future(self) -> Future[Any]: ...
# Tasks methods
if sys.version_info >= (3, 8):
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]], *, name: object = ...) -> Task[_T]: ...
def create_task(self, coro: Awaitable[_T] | Generator[Any, None, _T], *, name: object = ...) -> Task[_T]: ...
else:
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]]) -> Task[_T]: ...
def set_task_factory(
self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]
) -> None: ...
def get_task_factory(self) -> Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]: ...
def create_task(self, coro: Awaitable[_T] | Generator[Any, None, _T]) -> Task[_T]: ...
def set_task_factory(self, factory: Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None) -> None: ...
def get_task_factory(self) -> Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None: ...
# Methods for interacting with threads
if sys.version_info >= (3, 7):
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...) -> Handle: ...
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any, context: Context | None = ...) -> Handle: ...
else:
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Future[_T]: ...
def set_default_executor(self, executor: Any) -> None: ...
# Network I/O methods returning Futures.
async def getaddrinfo(
self,
host: Optional[str],
port: Union[str, int, None],
*,
family: int = ...,
type: int = ...,
proto: int = ...,
flags: int = ...,
) -> List[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]: ...
async def getnameinfo(
self, sockaddr: Union[Tuple[str, int], Tuple[str, int, int, int]], flags: int = ...
) -> Tuple[str, str]: ...
self, host: str | None, port: str | int | None, *, family: int = ..., type: int = ..., proto: int = ..., flags: int = ...
) -> List[Tuple[AddressFamily, SocketKind, int, str, Tuple[str, int] | Tuple[str, int, int, int]]]: ...
async def getnameinfo(self, sockaddr: Tuple[str, int] | Tuple[str, int, int, int], flags: int = ...) -> Tuple[str, str]: ...
if sys.version_info >= (3, 8):
@overload
async def create_connection(
@@ -115,11 +104,11 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Optional[Tuple[str, int]] = ...,
server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...,
happy_eyeballs_delay: Optional[float] = ...,
interleave: Optional[int] = ...,
local_addr: Tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
) -> _TransProtPair: ...
@overload
async def create_connection(
@@ -134,10 +123,10 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
flags: int = ...,
sock: socket,
local_addr: None = ...,
server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...,
happy_eyeballs_delay: Optional[float] = ...,
interleave: Optional[int] = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
) -> _TransProtPair: ...
elif sys.version_info >= (3, 7):
@overload
@@ -152,9 +141,9 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Optional[Tuple[str, int]] = ...,
server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...,
local_addr: Tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
) -> _TransProtPair: ...
@overload
async def create_connection(
@@ -169,8 +158,8 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
flags: int = ...,
sock: socket,
local_addr: None = ...,
server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
) -> _TransProtPair: ...
else:
@overload
@@ -185,8 +174,8 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Optional[Tuple[str, int]] = ...,
server_hostname: Optional[str] = ...,
local_addr: Tuple[str, int] | None = ...,
server_hostname: str | None = ...,
) -> _TransProtPair: ...
@overload
async def create_connection(
@@ -201,17 +190,17 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
flags: int = ...,
sock: socket,
local_addr: None = ...,
server_hostname: Optional[str] = ...,
server_hostname: str | None = ...,
) -> _TransProtPair: ...
if sys.version_info >= (3, 7):
async def sock_sendfile(
self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *, fallback: Optional[bool] = ...
self, sock: socket, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool | None = ...
) -> int: ...
@overload
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: Optional[Union[str, Sequence[str]]] = ...,
host: str | Sequence[str] | None = ...,
port: int = ...,
*,
family: int = ...,
@@ -219,9 +208,9 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
sock: None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
ssl_handshake_timeout: Optional[float] = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
start_serving: bool = ...,
) -> Server: ...
@overload
@@ -236,9 +225,9 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
sock: socket = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
ssl_handshake_timeout: Optional[float] = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
start_serving: bool = ...,
) -> Server: ...
async def connect_accepted_socket(
@@ -247,16 +236,10 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
sock: socket,
*,
ssl: _SSLContext = ...,
ssl_handshake_timeout: Optional[float] = ...,
ssl_handshake_timeout: float | None = ...,
) -> _TransProtPair: ...
async def sendfile(
self,
transport: BaseTransport,
file: IO[bytes],
offset: int = ...,
count: Optional[int] = ...,
*,
fallback: bool = ...,
self, transport: BaseTransport, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool = ...
) -> int: ...
async def start_tls(
self,
@@ -265,15 +248,15 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
sslcontext: ssl.SSLContext,
*,
server_side: bool = ...,
server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
) -> BaseTransport: ...
else:
@overload
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: Optional[Union[str, Sequence[str]]] = ...,
host: str | Sequence[str] | None = ...,
port: int = ...,
*,
family: int = ...,
@@ -281,8 +264,8 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
sock: None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
) -> Server: ...
@overload
async def create_server(
@@ -296,8 +279,8 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
sock: socket,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
) -> Server: ...
async def connect_accepted_socket(
self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ...
@@ -305,16 +288,16 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
async def create_datagram_endpoint(
self,
protocol_factory: _ProtocolFactory,
local_addr: Optional[Tuple[str, int]] = ...,
remote_addr: Optional[Tuple[str, int]] = ...,
local_addr: Tuple[str, int] | None = ...,
remote_addr: Tuple[str, int] | None = ...,
*,
family: int = ...,
proto: int = ...,
flags: int = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
allow_broadcast: Optional[bool] = ...,
sock: Optional[socket] = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
allow_broadcast: bool | None = ...,
sock: socket | None = ...,
) -> _TransProtPair: ...
# Pipes and subprocesses.
async def connect_read_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> _TransProtPair: ...
@@ -322,11 +305,11 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
async def subprocess_shell(
self,
protocol_factory: _ProtocolFactory,
cmd: Union[bytes, str],
cmd: bytes | str,
*,
stdin: Union[int, IO[Any], None] = ...,
stdout: Union[int, IO[Any], None] = ...,
stderr: Union[int, IO[Any], None] = ...,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
universal_newlines: Literal[False] = ...,
shell: Literal[True] = ...,
bufsize: Literal[0] = ...,
@@ -340,9 +323,9 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
protocol_factory: _ProtocolFactory,
program: Any,
*args: Any,
stdin: Union[int, IO[Any], None] = ...,
stdout: Union[int, IO[Any], None] = ...,
stderr: Union[int, IO[Any], None] = ...,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
universal_newlines: Literal[False] = ...,
shell: Literal[True] = ...,
bufsize: Literal[0] = ...,
@@ -370,8 +353,8 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: Any) -> None: ...
def remove_signal_handler(self, sig: int) -> bool: ...
# Error handlers.
def set_exception_handler(self, handler: Optional[_ExceptionHandler]) -> None: ...
def get_exception_handler(self) -> Optional[_ExceptionHandler]: ...
def set_exception_handler(self, handler: _ExceptionHandler | None) -> None: ...
def get_exception_handler(self) -> _ExceptionHandler | None: ...
def default_exception_handler(self, context: _Context) -> None: ...
def call_exception_handler(self, context: _Context) -> None: ...
# Debug flag management.
+13 -13
View File
@@ -10,9 +10,9 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
_closed: bool # undocumented
_protocol: protocols.SubprocessProtocol # undocumented
_loop: events.AbstractEventLoop # undocumented
_proc: Optional[subprocess.Popen[Any]] # undocumented
_pid: Optional[int] # undocumented
_returncode: Optional[int] # undocumented
_proc: subprocess.Popen[Any] | None # undocumented
_pid: int | None # undocumented
_returncode: int | None # undocumented
_exit_waiters: List[futures.Future[Any]] # undocumented
_pending_calls: Deque[Tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented
_pipes: Dict[int, _File] # undocumented
@@ -21,19 +21,19 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
self,
loop: events.AbstractEventLoop,
protocol: protocols.SubprocessProtocol,
args: Union[str, bytes, Sequence[Union[str, bytes]]],
args: str | bytes | Sequence[str | bytes],
shell: bool,
stdin: _File,
stdout: _File,
stderr: _File,
bufsize: int,
waiter: Optional[futures.Future[Any]] = ...,
extra: Optional[Any] = ...,
waiter: futures.Future[Any] | None = ...,
extra: Any | None = ...,
**kwargs: Any,
) -> None: ...
def _start(
self,
args: Union[str, bytes, Sequence[Union[str, bytes]]],
args: str | bytes | Sequence[str | bytes],
shell: bool,
stdin: _File,
stdout: _File,
@@ -45,26 +45,26 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
def get_protocol(self) -> protocols.BaseProtocol: ...
def is_closing(self) -> bool: ...
def close(self) -> None: ...
def get_pid(self) -> Optional[int]: ... # type: ignore
def get_returncode(self) -> Optional[int]: ...
def get_pid(self) -> int | None: ... # type: ignore
def get_returncode(self) -> int | None: ...
def get_pipe_transport(self, fd: int) -> _File: ... # type: ignore
def _check_proc(self) -> None: ... # undocumented
def send_signal(self, signal: int) -> None: ... # type: ignore
def terminate(self) -> None: ...
def kill(self) -> None: ...
async def _connect_pipes(self, waiter: Optional[futures.Future[Any]]) -> None: ... # undocumented
async def _connect_pipes(self, waiter: futures.Future[Any] | None) -> None: ... # undocumented
def _call(self, cb: Callable[..., Any], *data: Any) -> None: ... # undocumented
def _pipe_connection_lost(self, fd: int, exc: Optional[BaseException]) -> None: ... # undocumented
def _pipe_connection_lost(self, fd: int, exc: BaseException | None) -> None: ... # undocumented
def _pipe_data_received(self, fd: int, data: bytes) -> None: ... # undocumented
def _process_exited(self, returncode: int) -> None: ... # undocumented
async def _wait(self) -> int: ... # undocumented
def _try_finish(self) -> None: ... # undocumented
def _call_connection_lost(self, exc: Optional[BaseException]) -> None: ... # undocumented
def _call_connection_lost(self, exc: BaseException | None) -> None: ... # undocumented
class WriteSubprocessPipeProto(protocols.BaseProtocol): # undocumented
def __init__(self, proc: BaseSubprocessTransport, fd: int) -> None: ...
def connection_made(self, transport: transports.BaseTransport) -> None: ...
def connection_lost(self, exc: Optional[BaseException]) -> None: ...
def connection_lost(self, exc: BaseException | None) -> None: ...
def pause_writing(self) -> None: ...
def resume_writing(self) -> None: ...
+3 -3
View File
@@ -1,9 +1,9 @@
from _typeshed import StrOrBytesPath
from types import FrameType
from typing import Any, List, Optional
from typing import Any, List
from . import tasks
def _task_repr_info(task: tasks.Task[Any]) -> List[str]: ... # undocumented
def _task_get_stack(task: tasks.Task[Any], limit: Optional[int]) -> List[FrameType]: ... # undocumented
def _task_print_stack(task: tasks.Task[Any], limit: Optional[int], file: StrOrBytesPath) -> None: ... # undocumented
def _task_get_stack(task: tasks.Task[Any], limit: int | None) -> List[FrameType]: ... # undocumented
def _task_print_stack(task: tasks.Task[Any], limit: int | None, file: StrOrBytesPath) -> None: ... # undocumented
+73 -90
View File
@@ -3,7 +3,7 @@ import sys
from _typeshed import FileDescriptorLike, Self
from abc import ABCMeta, abstractmethod
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Sequence, Tuple, TypeVar, Union, overload
from typing_extensions import Literal
from .base_events import Server
@@ -28,7 +28,7 @@ class Handle:
_args: Sequence[Any]
if sys.version_info >= (3, 7):
def __init__(
self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop, context: Optional[Context] = ...
self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop, context: Context | None = ...
) -> None: ...
else:
def __init__(self, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop) -> None: ...
@@ -46,7 +46,7 @@ class TimerHandle(Handle):
callback: Callable[..., Any],
args: Sequence[Any],
loop: AbstractEventLoop,
context: Optional[Context] = ...,
context: Context | None = ...,
) -> None: ...
else:
def __init__(self, when: float, callback: Callable[..., Any], args: Sequence[Any], loop: AbstractEventLoop) -> None: ...
@@ -101,16 +101,14 @@ class AbstractEventLoop(metaclass=ABCMeta):
# Tasks methods
if sys.version_info >= (3, 8):
@abstractmethod
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]], *, name: Optional[str] = ...) -> Task[_T]: ...
def create_task(self, coro: Awaitable[_T] | Generator[Any, None, _T], *, name: str | None = ...) -> Task[_T]: ...
else:
@abstractmethod
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]]) -> Task[_T]: ...
def create_task(self, coro: Awaitable[_T] | Generator[Any, None, _T]) -> Task[_T]: ...
@abstractmethod
def set_task_factory(
self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]
) -> None: ...
def set_task_factory(self, factory: Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None) -> None: ...
@abstractmethod
def get_task_factory(self) -> Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]: ...
def get_task_factory(self) -> Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]] | None: ...
# Methods for interacting with threads
@abstractmethod
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
@@ -121,19 +119,10 @@ class AbstractEventLoop(metaclass=ABCMeta):
# Network I/O methods returning Futures.
@abstractmethod
async def getaddrinfo(
self,
host: Optional[str],
port: Union[str, int, None],
*,
family: int = ...,
type: int = ...,
proto: int = ...,
flags: int = ...,
) -> List[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]: ...
self, host: str | None, port: str | int | None, *, family: int = ..., type: int = ..., proto: int = ..., flags: int = ...
) -> List[Tuple[AddressFamily, SocketKind, int, str, Tuple[str, int] | Tuple[str, int, int, int]]]: ...
@abstractmethod
async def getnameinfo(
self, sockaddr: Union[Tuple[str, int], Tuple[str, int, int, int]], flags: int = ...
) -> Tuple[str, str]: ...
async def getnameinfo(self, sockaddr: Tuple[str, int] | Tuple[str, int, int, int], flags: int = ...) -> Tuple[str, str]: ...
if sys.version_info >= (3, 8):
@overload
@abstractmethod
@@ -148,11 +137,11 @@ class AbstractEventLoop(metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Optional[Tuple[str, int]] = ...,
server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...,
happy_eyeballs_delay: Optional[float] = ...,
interleave: Optional[int] = ...,
local_addr: Tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
) -> _TransProtPair: ...
@overload
@abstractmethod
@@ -168,10 +157,10 @@ class AbstractEventLoop(metaclass=ABCMeta):
flags: int = ...,
sock: socket,
local_addr: None = ...,
server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...,
happy_eyeballs_delay: Optional[float] = ...,
interleave: Optional[int] = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
) -> _TransProtPair: ...
elif sys.version_info >= (3, 7):
@overload
@@ -187,9 +176,9 @@ class AbstractEventLoop(metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Optional[Tuple[str, int]] = ...,
server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...,
local_addr: Tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
) -> _TransProtPair: ...
@overload
@abstractmethod
@@ -205,8 +194,8 @@ class AbstractEventLoop(metaclass=ABCMeta):
flags: int = ...,
sock: socket,
local_addr: None = ...,
server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
) -> _TransProtPair: ...
else:
@overload
@@ -222,8 +211,8 @@ class AbstractEventLoop(metaclass=ABCMeta):
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: Optional[Tuple[str, int]] = ...,
server_hostname: Optional[str] = ...,
local_addr: Tuple[str, int] | None = ...,
server_hostname: str | None = ...,
) -> _TransProtPair: ...
@overload
@abstractmethod
@@ -239,19 +228,19 @@ class AbstractEventLoop(metaclass=ABCMeta):
flags: int = ...,
sock: socket,
local_addr: None = ...,
server_hostname: Optional[str] = ...,
server_hostname: str | None = ...,
) -> _TransProtPair: ...
if sys.version_info >= (3, 7):
@abstractmethod
async def sock_sendfile(
self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *, fallback: Optional[bool] = ...
self, sock: socket, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool | None = ...
) -> int: ...
@overload
@abstractmethod
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: Optional[Union[str, Sequence[str]]] = ...,
host: str | Sequence[str] | None = ...,
port: int = ...,
*,
family: int = ...,
@@ -259,9 +248,9 @@ class AbstractEventLoop(metaclass=ABCMeta):
sock: None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
ssl_handshake_timeout: Optional[float] = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
start_serving: bool = ...,
) -> Server: ...
@overload
@@ -277,41 +266,35 @@ class AbstractEventLoop(metaclass=ABCMeta):
sock: socket = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
ssl_handshake_timeout: Optional[float] = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
start_serving: bool = ...,
) -> Server: ...
async def create_unix_connection(
self,
protocol_factory: _ProtocolFactory,
path: Optional[str] = ...,
path: str | None = ...,
*,
ssl: _SSLContext = ...,
sock: Optional[socket] = ...,
server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...,
sock: socket | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
) -> _TransProtPair: ...
async def create_unix_server(
self,
protocol_factory: _ProtocolFactory,
path: Optional[str] = ...,
path: str | None = ...,
*,
sock: Optional[socket] = ...,
sock: socket | None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
ssl_handshake_timeout: Optional[float] = ...,
ssl_handshake_timeout: float | None = ...,
start_serving: bool = ...,
) -> Server: ...
@abstractmethod
async def sendfile(
self,
transport: BaseTransport,
file: IO[bytes],
offset: int = ...,
count: Optional[int] = ...,
*,
fallback: bool = ...,
self, transport: BaseTransport, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool = ...
) -> int: ...
@abstractmethod
async def start_tls(
@@ -321,8 +304,8 @@ class AbstractEventLoop(metaclass=ABCMeta):
sslcontext: ssl.SSLContext,
*,
server_side: bool = ...,
server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
) -> BaseTransport: ...
else:
@overload
@@ -330,7 +313,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: Optional[Union[str, Sequence[str]]] = ...,
host: str | Sequence[str] | None = ...,
port: int = ...,
*,
family: int = ...,
@@ -338,8 +321,8 @@ class AbstractEventLoop(metaclass=ABCMeta):
sock: None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
) -> Server: ...
@overload
@abstractmethod
@@ -354,8 +337,8 @@ class AbstractEventLoop(metaclass=ABCMeta):
sock: socket,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
) -> Server: ...
async def create_unix_connection(
self,
@@ -363,15 +346,15 @@ class AbstractEventLoop(metaclass=ABCMeta):
path: str,
*,
ssl: _SSLContext = ...,
sock: Optional[socket] = ...,
server_hostname: Optional[str] = ...,
sock: socket | None = ...,
server_hostname: str | None = ...,
) -> _TransProtPair: ...
async def create_unix_server(
self,
protocol_factory: _ProtocolFactory,
path: str,
*,
sock: Optional[socket] = ...,
sock: socket | None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
) -> Server: ...
@@ -379,16 +362,16 @@ class AbstractEventLoop(metaclass=ABCMeta):
async def create_datagram_endpoint(
self,
protocol_factory: _ProtocolFactory,
local_addr: Optional[Tuple[str, int]] = ...,
remote_addr: Optional[Tuple[str, int]] = ...,
local_addr: Tuple[str, int] | None = ...,
remote_addr: Tuple[str, int] | None = ...,
*,
family: int = ...,
proto: int = ...,
flags: int = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
allow_broadcast: Optional[bool] = ...,
sock: Optional[socket] = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
allow_broadcast: bool | None = ...,
sock: socket | None = ...,
) -> _TransProtPair: ...
# Pipes and subprocesses.
@abstractmethod
@@ -399,11 +382,11 @@ class AbstractEventLoop(metaclass=ABCMeta):
async def subprocess_shell(
self,
protocol_factory: _ProtocolFactory,
cmd: Union[bytes, str],
cmd: bytes | str,
*,
stdin: Union[int, IO[Any], None] = ...,
stdout: Union[int, IO[Any], None] = ...,
stderr: Union[int, IO[Any], None] = ...,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
universal_newlines: Literal[False] = ...,
shell: Literal[True] = ...,
bufsize: Literal[0] = ...,
@@ -418,9 +401,9 @@ class AbstractEventLoop(metaclass=ABCMeta):
protocol_factory: _ProtocolFactory,
program: Any,
*args: Any,
stdin: Union[int, IO[Any], None] = ...,
stdout: Union[int, IO[Any], None] = ...,
stderr: Union[int, IO[Any], None] = ...,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
universal_newlines: Literal[False] = ...,
shell: Literal[True] = ...,
bufsize: Literal[0] = ...,
@@ -464,9 +447,9 @@ class AbstractEventLoop(metaclass=ABCMeta):
def remove_signal_handler(self, sig: int) -> bool: ...
# Error handlers.
@abstractmethod
def set_exception_handler(self, handler: Optional[_ExceptionHandler]) -> None: ...
def set_exception_handler(self, handler: _ExceptionHandler | None) -> None: ...
@abstractmethod
def get_exception_handler(self) -> Optional[_ExceptionHandler]: ...
def get_exception_handler(self) -> _ExceptionHandler | None: ...
@abstractmethod
def default_exception_handler(self, context: _Context) -> None: ...
@abstractmethod
@@ -484,7 +467,7 @@ class AbstractEventLoopPolicy(metaclass=ABCMeta):
@abstractmethod
def get_event_loop(self) -> AbstractEventLoop: ...
@abstractmethod
def set_event_loop(self, loop: Optional[AbstractEventLoop]) -> None: ...
def set_event_loop(self, loop: AbstractEventLoop | None) -> None: ...
@abstractmethod
def new_event_loop(self) -> AbstractEventLoop: ...
# Child processes handling (Unix only).
@@ -496,17 +479,17 @@ class AbstractEventLoopPolicy(metaclass=ABCMeta):
class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy, metaclass=ABCMeta):
def __init__(self) -> None: ...
def get_event_loop(self) -> AbstractEventLoop: ...
def set_event_loop(self, loop: Optional[AbstractEventLoop]) -> None: ...
def set_event_loop(self, loop: AbstractEventLoop | None) -> None: ...
def new_event_loop(self) -> AbstractEventLoop: ...
def get_event_loop_policy() -> AbstractEventLoopPolicy: ...
def set_event_loop_policy(policy: Optional[AbstractEventLoopPolicy]) -> None: ...
def set_event_loop_policy(policy: AbstractEventLoopPolicy | None) -> None: ...
def get_event_loop() -> AbstractEventLoop: ...
def set_event_loop(loop: Optional[AbstractEventLoop]) -> None: ...
def set_event_loop(loop: AbstractEventLoop | None) -> None: ...
def new_event_loop() -> AbstractEventLoop: ...
def get_child_watcher() -> AbstractChildWatcher: ...
def set_child_watcher(watcher: AbstractChildWatcher) -> None: ...
def _set_running_loop(__loop: Optional[AbstractEventLoop]) -> None: ...
def _set_running_loop(__loop: AbstractEventLoop | None) -> None: ...
def _get_running_loop() -> AbstractEventLoop: ...
if sys.version_info >= (3, 7):
+2 -3
View File
@@ -1,5 +1,4 @@
import sys
from typing import Optional
if sys.version_info >= (3, 8):
class CancelledError(BaseException): ...
@@ -7,9 +6,9 @@ if sys.version_info >= (3, 8):
class InvalidStateError(Exception): ...
class SendfileNotAvailableError(RuntimeError): ...
class IncompleteReadError(EOFError):
expected: Optional[int]
expected: int | None
partial: bytes
def __init__(self, partial: bytes, expected: Optional[int]) -> None: ...
def __init__(self, partial: bytes, expected: int | None) -> None: ...
class LimitOverrunError(Exception):
consumed: int
def __init__(self, message: str, consumed: int) -> None: ...
+4 -4
View File
@@ -2,10 +2,10 @@ import functools
import sys
import traceback
from types import FrameType, FunctionType
from typing import Any, Dict, Iterable, Optional, Tuple, Union, overload
from typing import Any, Dict, Iterable, Tuple, Union, overload
class _HasWrapper:
__wrapper__: Union[_HasWrapper, FunctionType]
__wrapper__: _HasWrapper | FunctionType
_FuncType = Union[FunctionType, _HasWrapper, functools.partial[Any], functools.partialmethod[Any]]
@@ -13,8 +13,8 @@ if sys.version_info >= (3, 7):
@overload
def _get_function_source(func: _FuncType) -> Tuple[str, int]: ...
@overload
def _get_function_source(func: object) -> Optional[Tuple[str, int]]: ...
def _get_function_source(func: object) -> Tuple[str, int] | None: ...
def _format_callback_source(func: object, args: Iterable[Any]) -> str: ...
def _format_args_and_kwargs(args: Iterable[Any], kwargs: Dict[str, Any]) -> str: ...
def _format_callback(func: object, args: Iterable[Any], kwargs: Dict[str, Any], suffix: str = ...) -> str: ...
def extract_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> traceback.StackSummary: ...
def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> traceback.StackSummary: ...
+7 -7
View File
@@ -1,6 +1,6 @@
import sys
from concurrent.futures._base import Error, Future as _ConcurrentFuture
from typing import Any, Awaitable, Callable, Generator, Iterable, List, Optional, Tuple, TypeVar, Union
from typing import Any, Awaitable, Callable, Generator, Iterable, List, Tuple, TypeVar
from .events import AbstractEventLoop
@@ -33,28 +33,28 @@ class Future(Awaitable[_T], Iterable[_T]):
_exception: BaseException
_blocking = False
_log_traceback = False
def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
def __repr__(self) -> str: ...
def __del__(self) -> None: ...
if sys.version_info >= (3, 7):
def get_loop(self) -> AbstractEventLoop: ...
def _callbacks(self: _S) -> List[Tuple[Callable[[_S], Any], Context]]: ...
def add_done_callback(self: _S, __fn: Callable[[_S], Any], *, context: Optional[Context] = ...) -> None: ...
def add_done_callback(self: _S, __fn: Callable[[_S], Any], *, context: Context | None = ...) -> None: ...
else:
@property
def _callbacks(self: _S) -> List[Callable[[_S], Any]]: ...
def add_done_callback(self: _S, __fn: Callable[[_S], Any]) -> None: ...
if sys.version_info >= (3, 9):
def cancel(self, msg: Optional[str] = ...) -> bool: ...
def cancel(self, msg: str | None = ...) -> bool: ...
else:
def cancel(self) -> bool: ...
def cancelled(self) -> bool: ...
def done(self) -> bool: ...
def result(self) -> _T: ...
def exception(self) -> Optional[BaseException]: ...
def exception(self) -> BaseException | None: ...
def remove_done_callback(self: _S, __fn: Callable[[_S], Any]) -> int: ...
def set_result(self, __result: _T) -> None: ...
def set_exception(self, __exception: Union[type, BaseException]) -> None: ...
def set_exception(self, __exception: type | BaseException) -> None: ...
def __iter__(self) -> Generator[Any, None, _T]: ...
def __await__(self) -> Generator[Any, None, _T]: ...
@property
@@ -62,4 +62,4 @@ class Future(Awaitable[_T], Iterable[_T]):
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
def wrap_future(future: Union[_ConcurrentFuture[_T], Future[_T]], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
def wrap_future(future: _ConcurrentFuture[_T] | Future[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ...
+11 -11
View File
@@ -1,6 +1,6 @@
import sys
from types import TracebackType
from typing import Any, Awaitable, Callable, Deque, Generator, Optional, Type, TypeVar, Union
from typing import Any, Awaitable, Callable, Deque, Generator, Type, TypeVar
from .events import AbstractEventLoop
from .futures import Future
@@ -9,19 +9,19 @@ _T = TypeVar("_T")
if sys.version_info >= (3, 9):
class _ContextManagerMixin:
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
def __init__(self, lock: Lock | Semaphore) -> None: ...
def __aenter__(self) -> Awaitable[None]: ...
def __aexit__(
self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
) -> Awaitable[None]: ...
else:
class _ContextManager:
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
def __init__(self, lock: Lock | Semaphore) -> None: ...
def __enter__(self) -> object: ...
def __exit__(self, *args: Any) -> None: ...
class _ContextManagerMixin:
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
def __init__(self, lock: Lock | Semaphore) -> None: ...
# Apparently this exists to *prohibit* use as a context manager.
def __enter__(self) -> object: ...
def __exit__(self, *args: Any) -> None: ...
@@ -29,24 +29,24 @@ else:
def __await__(self) -> Generator[Any, None, _ContextManager]: ...
def __aenter__(self) -> Awaitable[None]: ...
def __aexit__(
self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
) -> Awaitable[None]: ...
class Lock(_ContextManagerMixin):
def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
def locked(self) -> bool: ...
async def acquire(self) -> bool: ...
def release(self) -> None: ...
class Event:
def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
def is_set(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
async def wait(self) -> bool: ...
class Condition(_ContextManagerMixin):
def __init__(self, lock: Optional[Lock] = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, lock: Lock | None = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
def locked(self) -> bool: ...
async def acquire(self) -> bool: ...
def release(self) -> None: ...
@@ -58,11 +58,11 @@ class Condition(_ContextManagerMixin):
class Semaphore(_ContextManagerMixin):
_value: int
_waiters: Deque[Future[Any]]
def __init__(self, value: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
def locked(self) -> bool: ...
async def acquire(self) -> bool: ...
def release(self) -> None: ...
def _wake_up_next(self) -> None: ...
class BoundedSemaphore(Semaphore):
def __init__(self, value: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
+17 -17
View File
@@ -1,6 +1,6 @@
import sys
from socket import socket
from typing import Any, Mapping, Optional, Type
from typing import Any, Mapping, Type
from typing_extensions import Literal, Protocol
from . import base_events, constants, events, futures, streams, transports
@@ -8,7 +8,7 @@ from . import base_events, constants, events, futures, streams, transports
if sys.version_info >= (3, 8):
class _WarnCallbackProtocol(Protocol):
def __call__(
self, message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ..., source: Optional[Any] = ...
self, message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
) -> None: ...
class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTransport):
@@ -17,9 +17,9 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTr
loop: events.AbstractEventLoop,
sock: socket,
protocol: streams.StreamReaderProtocol,
waiter: Optional[futures.Future[Any]] = ...,
extra: Optional[Mapping[Any, Any]] = ...,
server: Optional[events.AbstractServer] = ...,
waiter: futures.Future[Any] | None = ...,
extra: Mapping[Any, Any] | None = ...,
server: events.AbstractServer | None = ...,
) -> None: ...
def __repr__(self) -> str: ...
if sys.version_info >= (3, 8):
@@ -34,9 +34,9 @@ class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTran
loop: events.AbstractEventLoop,
sock: socket,
protocol: streams.StreamReaderProtocol,
waiter: Optional[futures.Future[Any]] = ...,
extra: Optional[Mapping[Any, Any]] = ...,
server: Optional[events.AbstractServer] = ...,
waiter: futures.Future[Any] | None = ...,
extra: Mapping[Any, Any] | None = ...,
server: events.AbstractServer | None = ...,
) -> None: ...
class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, transports.WriteTransport):
@@ -45,9 +45,9 @@ class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, transports.Wri
loop: events.AbstractEventLoop,
sock: socket,
protocol: streams.StreamReaderProtocol,
waiter: Optional[futures.Future[Any]] = ...,
extra: Optional[Mapping[Any, Any]] = ...,
server: Optional[events.AbstractServer] = ...,
waiter: futures.Future[Any] | None = ...,
extra: Mapping[Any, Any] | None = ...,
server: events.AbstractServer | None = ...,
) -> None: ...
class _ProactorWritePipeTransport(_ProactorBaseWritePipeTransport):
@@ -56,9 +56,9 @@ class _ProactorWritePipeTransport(_ProactorBaseWritePipeTransport):
loop: events.AbstractEventLoop,
sock: socket,
protocol: streams.StreamReaderProtocol,
waiter: Optional[futures.Future[Any]] = ...,
extra: Optional[Mapping[Any, Any]] = ...,
server: Optional[events.AbstractServer] = ...,
waiter: futures.Future[Any] | None = ...,
extra: Mapping[Any, Any] | None = ...,
server: events.AbstractServer | None = ...,
) -> None: ...
class _ProactorDuplexPipeTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): ...
@@ -71,9 +71,9 @@ class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePip
loop: events.AbstractEventLoop,
sock: socket,
protocol: streams.StreamReaderProtocol,
waiter: Optional[futures.Future[Any]] = ...,
extra: Optional[Mapping[Any, Any]] = ...,
server: Optional[events.AbstractServer] = ...,
waiter: futures.Future[Any] | None = ...,
extra: Mapping[Any, Any] | None = ...,
server: events.AbstractServer | None = ...,
) -> None: ...
def _set_extra(self, sock: socket) -> None: ...
def can_write_eof(self) -> Literal[True]: ...
+4 -4
View File
@@ -1,16 +1,16 @@
import sys
from asyncio import transports
from typing import Optional, Tuple
from typing import Tuple
class BaseProtocol:
def connection_made(self, transport: transports.BaseTransport) -> None: ...
def connection_lost(self, exc: Optional[Exception]) -> None: ...
def connection_lost(self, exc: Exception | None) -> None: ...
def pause_writing(self) -> None: ...
def resume_writing(self) -> None: ...
class Protocol(BaseProtocol):
def data_received(self, data: bytes) -> None: ...
def eof_received(self) -> Optional[bool]: ...
def eof_received(self) -> bool | None: ...
if sys.version_info >= (3, 7):
class BufferedProtocol(BaseProtocol):
@@ -23,5 +23,5 @@ class DatagramProtocol(BaseProtocol):
class SubprocessProtocol(BaseProtocol):
def pipe_data_received(self, fd: int, data: bytes) -> None: ...
def pipe_connection_lost(self, fd: int, exc: Optional[Exception]) -> None: ...
def pipe_connection_lost(self, fd: int, exc: Exception | None) -> None: ...
def process_exited(self) -> None: ...
+2 -2
View File
@@ -1,6 +1,6 @@
import sys
from asyncio.events import AbstractEventLoop
from typing import Any, Generic, Optional, TypeVar
from typing import Any, Generic, TypeVar
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -11,7 +11,7 @@ class QueueFull(Exception): ...
_T = TypeVar("_T")
class Queue(Generic[_T]):
def __init__(self, maxsize: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, maxsize: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
def _init(self, maxsize: int) -> None: ...
def _get(self) -> _T: ...
def _put(self, item: _T) -> None: ...
+2 -2
View File
@@ -1,10 +1,10 @@
import sys
if sys.version_info >= (3, 7):
from typing import Awaitable, Optional, TypeVar
from typing import Awaitable, TypeVar
_T = TypeVar("_T")
if sys.version_info >= (3, 8):
def run(main: Awaitable[_T], *, debug: Optional[bool] = ...) -> _T: ...
def run(main: Awaitable[_T], *, debug: bool | None = ...) -> _T: ...
else:
def run(main: Awaitable[_T], *, debug: bool = ...) -> _T: ...
+1 -2
View File
@@ -1,7 +1,6 @@
import selectors
from typing import Optional
from . import base_events
class BaseSelectorEventLoop(base_events.BaseEventLoop):
def __init__(self, selector: Optional[selectors.BaseSelector] = ...) -> None: ...
def __init__(self, selector: selectors.BaseSelector | None = ...) -> None: ...
+23 -23
View File
@@ -1,11 +1,11 @@
import ssl
import sys
from typing import Any, Callable, ClassVar, Deque, Dict, List, Optional, Tuple
from typing import Any, Callable, ClassVar, Deque, Dict, List, Tuple
from typing_extensions import Literal
from . import constants, events, futures, protocols, transports
def _create_transport_context(server_side: bool, server_hostname: Optional[str]) -> ssl.SSLContext: ...
def _create_transport_context(server_side: bool, server_hostname: str | None) -> ssl.SSLContext: ...
_UNWRAPPED: Literal["UNWRAPPED"]
_DO_HANDSHAKE: Literal["DO_HANDSHAKE"]
@@ -18,25 +18,25 @@ class _SSLPipe:
_context: ssl.SSLContext
_server_side: bool
_server_hostname: Optional[str]
_server_hostname: str | None
_state: str
_incoming: ssl.MemoryBIO
_outgoing: ssl.MemoryBIO
_sslobj: Optional[ssl.SSLObject]
_sslobj: ssl.SSLObject | None
_need_ssldata: bool
_handshake_cb: Optional[Callable[[Optional[BaseException]], None]]
_shutdown_cb: Optional[Callable[[], None]]
def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: Optional[str] = ...) -> None: ...
_handshake_cb: Callable[[BaseException | None], None] | None
_shutdown_cb: Callable[[], None] | None
def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: str | None = ...) -> None: ...
@property
def context(self) -> ssl.SSLContext: ...
@property
def ssl_object(self) -> Optional[ssl.SSLObject]: ...
def ssl_object(self) -> ssl.SSLObject | None: ...
@property
def need_ssldata(self) -> bool: ...
@property
def wrapped(self) -> bool: ...
def do_handshake(self, callback: Optional[Callable[[Optional[BaseException]], None]] = ...) -> List[bytes]: ...
def shutdown(self, callback: Optional[Callable[[], None]] = ...) -> List[bytes]: ...
def do_handshake(self, callback: Callable[[BaseException | None], None] | None = ...) -> List[bytes]: ...
def shutdown(self, callback: Callable[[], None] | None = ...) -> List[bytes]: ...
def feed_eof(self) -> None: ...
def feed_ssldata(self, data: bytes, only_handshake: bool = ...) -> Tuple[List[bytes], List[bytes]]: ...
def feed_appdata(self, data: bytes, offset: int = ...) -> Tuple[List[bytes], int]: ...
@@ -49,7 +49,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
_ssl_protocol: SSLProtocol
_closed: bool
def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol) -> None: ...
def get_extra_info(self, name: str, default: Optional[Any] = ...) -> Dict[str, Any]: ...
def get_extra_info(self, name: str, default: Any | None = ...) -> Dict[str, Any]: ...
def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ...
def get_protocol(self) -> protocols.BaseProtocol: ...
def is_closing(self) -> bool: ...
@@ -58,7 +58,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
def is_reading(self) -> bool: ...
def pause_reading(self) -> None: ...
def resume_reading(self) -> None: ...
def set_write_buffer_limits(self, high: Optional[int] = ..., low: Optional[int] = ...) -> None: ...
def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ...
def get_write_buffer_size(self) -> int: ...
if sys.version_info >= (3, 7):
@property
@@ -70,7 +70,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
class SSLProtocol(protocols.Protocol):
_server_side: bool
_server_hostname: Optional[str]
_server_hostname: str | None
_sslcontext: ssl.SSLContext
_extra: Dict[str, Any]
_write_backlog: Deque[Tuple[bytes, int]]
@@ -78,13 +78,13 @@ class SSLProtocol(protocols.Protocol):
_waiter: futures.Future[Any]
_loop: events.AbstractEventLoop
_app_transport: _SSLProtocolTransport
_sslpipe: Optional[_SSLPipe]
_sslpipe: _SSLPipe | None
_session_established: bool
_in_handshake: bool
_in_shutdown: bool
_transport: Optional[transports.BaseTransport]
_transport: transports.BaseTransport | None
_call_connection_made: bool
_ssl_handshake_timeout: Optional[int]
_ssl_handshake_timeout: int | None
_app_protocol: protocols.BaseProtocol
_app_protocol_is_buffer: bool
@@ -96,9 +96,9 @@ class SSLProtocol(protocols.Protocol):
sslcontext: ssl.SSLContext,
waiter: futures.Future[Any],
server_side: bool = ...,
server_hostname: Optional[str] = ...,
server_hostname: str | None = ...,
call_connection_made: bool = ...,
ssl_handshake_timeout: Optional[int] = ...,
ssl_handshake_timeout: int | None = ...,
) -> None: ...
else:
def __init__(
@@ -108,25 +108,25 @@ class SSLProtocol(protocols.Protocol):
sslcontext: ssl.SSLContext,
waiter: futures.Future[Any],
server_side: bool = ...,
server_hostname: Optional[str] = ...,
server_hostname: str | None = ...,
call_connection_made: bool = ...,
) -> None: ...
if sys.version_info >= (3, 7):
def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ...
def _wakeup_waiter(self, exc: Optional[BaseException] = ...) -> None: ...
def _wakeup_waiter(self, exc: BaseException | None = ...) -> None: ...
def connection_made(self, transport: transports.BaseTransport) -> None: ...
def connection_lost(self, exc: Optional[BaseException]) -> None: ...
def connection_lost(self, exc: BaseException | None) -> None: ...
def pause_writing(self) -> None: ...
def resume_writing(self) -> None: ...
def data_received(self, data: bytes) -> None: ...
def eof_received(self) -> None: ...
def _get_extra_info(self, name: str, default: Optional[Any] = ...) -> Any: ...
def _get_extra_info(self, name: str, default: Any | None = ...) -> Any: ...
def _start_shutdown(self) -> None: ...
def _write_appdata(self, data: bytes) -> None: ...
def _start_handshake(self) -> None: ...
if sys.version_info >= (3, 7):
def _check_handshake_timeout(self) -> None: ...
def _on_handshake_complete(self, handshake_exc: Optional[BaseException]) -> None: ...
def _on_handshake_complete(self, handshake_exc: BaseException | None) -> None: ...
def _process_write_backlog(self) -> None: ...
def _fatal_error(self, exc: BaseException, message: str = ...) -> None: ...
def _finalize(self) -> None: ...
+3 -6
View File
@@ -1,12 +1,9 @@
import sys
from typing import Any, Awaitable, Callable, Iterable, List, Optional, Tuple
from typing import Any, Awaitable, Callable, Iterable, List, Tuple
from . import events
if sys.version_info >= (3, 8):
async def staggered_race(
coro_fns: Iterable[Callable[[], Awaitable[Any]]],
delay: Optional[float],
*,
loop: Optional[events.AbstractEventLoop] = ...,
) -> Tuple[Any, Optional[int], List[Optional[Exception]]]: ...
coro_fns: Iterable[Callable[[], Awaitable[Any]]], delay: float | None, *, loop: events.AbstractEventLoop | None = ...
) -> Tuple[Any, int | None, List[Exception | None]]: ...
+20 -20
View File
@@ -1,6 +1,6 @@
import sys
from _typeshed import StrPath
from typing import Any, AsyncIterator, Awaitable, Callable, Iterable, Optional, Tuple, Union
from typing import Any, AsyncIterator, Awaitable, Callable, Iterable, Optional, Tuple
from . import events, protocols, transports
from .base_events import Server
@@ -9,30 +9,30 @@ _ClientConnectedCallback = Callable[[StreamReader, StreamWriter], Optional[Await
if sys.version_info < (3, 8):
class IncompleteReadError(EOFError):
expected: Optional[int]
expected: int | None
partial: bytes
def __init__(self, partial: bytes, expected: Optional[int]) -> None: ...
def __init__(self, partial: bytes, expected: int | None) -> None: ...
class LimitOverrunError(Exception):
consumed: int
def __init__(self, message: str, consumed: int) -> None: ...
async def open_connection(
host: Optional[str] = ...,
port: Optional[Union[int, str]] = ...,
host: str | None = ...,
port: int | str | None = ...,
*,
loop: Optional[events.AbstractEventLoop] = ...,
loop: events.AbstractEventLoop | None = ...,
limit: int = ...,
ssl_handshake_timeout: Optional[float] = ...,
ssl_handshake_timeout: float | None = ...,
**kwds: Any,
) -> Tuple[StreamReader, StreamWriter]: ...
async def start_server(
client_connected_cb: _ClientConnectedCallback,
host: Optional[str] = ...,
port: Optional[Union[int, str]] = ...,
host: str | None = ...,
port: int | str | None = ...,
*,
loop: Optional[events.AbstractEventLoop] = ...,
loop: events.AbstractEventLoop | None = ...,
limit: int = ...,
ssl_handshake_timeout: Optional[float] = ...,
ssl_handshake_timeout: float | None = ...,
**kwds: Any,
) -> Server: ...
@@ -42,29 +42,29 @@ if sys.platform != "win32":
else:
_PathType = str
async def open_unix_connection(
path: Optional[_PathType] = ..., *, loop: Optional[events.AbstractEventLoop] = ..., limit: int = ..., **kwds: Any
path: _PathType | None = ..., *, loop: events.AbstractEventLoop | None = ..., limit: int = ..., **kwds: Any
) -> Tuple[StreamReader, StreamWriter]: ...
async def start_unix_server(
client_connected_cb: _ClientConnectedCallback,
path: Optional[_PathType] = ...,
path: _PathType | None = ...,
*,
loop: Optional[events.AbstractEventLoop] = ...,
loop: events.AbstractEventLoop | None = ...,
limit: int = ...,
**kwds: Any,
) -> Server: ...
class FlowControlMixin(protocols.Protocol):
def __init__(self, loop: Optional[events.AbstractEventLoop] = ...) -> None: ...
def __init__(self, loop: events.AbstractEventLoop | None = ...) -> None: ...
class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
def __init__(
self,
stream_reader: StreamReader,
client_connected_cb: Optional[_ClientConnectedCallback] = ...,
loop: Optional[events.AbstractEventLoop] = ...,
client_connected_cb: _ClientConnectedCallback | None = ...,
loop: events.AbstractEventLoop | None = ...,
) -> None: ...
def connection_made(self, transport: transports.BaseTransport) -> None: ...
def connection_lost(self, exc: Optional[Exception]) -> None: ...
def connection_lost(self, exc: Exception | None) -> None: ...
def data_received(self, data: bytes) -> None: ...
def eof_received(self) -> bool: ...
@@ -73,7 +73,7 @@ class StreamWriter:
self,
transport: transports.BaseTransport,
protocol: protocols.BaseProtocol,
reader: Optional[StreamReader],
reader: StreamReader | None,
loop: events.AbstractEventLoop,
) -> None: ...
@property
@@ -90,7 +90,7 @@ class StreamWriter:
async def drain(self) -> None: ...
class StreamReader:
def __init__(self, limit: int = ..., loop: Optional[events.AbstractEventLoop] = ...) -> None: ...
def __init__(self, limit: int = ..., loop: events.AbstractEventLoop | None = ...) -> None: ...
def exception(self) -> Exception: ...
def set_exception(self, exc: Exception) -> None: ...
def set_transport(self, transport: transports.BaseTransport) -> None: ...
+49 -49
View File
@@ -2,7 +2,7 @@ import subprocess
import sys
from _typeshed import StrOrBytesPath
from asyncio import events, protocols, streams, transports
from typing import IO, Any, Callable, Optional, Tuple, Union
from typing import IO, Any, Callable, Tuple, Union
from typing_extensions import Literal
if sys.version_info >= (3, 8):
@@ -15,37 +15,37 @@ STDOUT: int
DEVNULL: int
class SubprocessStreamProtocol(streams.FlowControlMixin, protocols.SubprocessProtocol):
stdin: Optional[streams.StreamWriter]
stdout: Optional[streams.StreamReader]
stderr: Optional[streams.StreamReader]
stdin: streams.StreamWriter | None
stdout: streams.StreamReader | None
stderr: streams.StreamReader | None
def __init__(self, limit: int, loop: events.AbstractEventLoop) -> None: ...
def connection_made(self, transport: transports.BaseTransport) -> None: ...
def pipe_data_received(self, fd: int, data: Union[bytes, str]) -> None: ...
def pipe_connection_lost(self, fd: int, exc: Optional[Exception]) -> None: ...
def pipe_data_received(self, fd: int, data: bytes | str) -> None: ...
def pipe_connection_lost(self, fd: int, exc: Exception | None) -> None: ...
def process_exited(self) -> None: ...
class Process:
stdin: Optional[streams.StreamWriter]
stdout: Optional[streams.StreamReader]
stderr: Optional[streams.StreamReader]
stdin: streams.StreamWriter | None
stdout: streams.StreamReader | None
stderr: streams.StreamReader | None
pid: int
def __init__(
self, transport: transports.BaseTransport, protocol: protocols.BaseProtocol, loop: events.AbstractEventLoop
) -> None: ...
@property
def returncode(self) -> Optional[int]: ...
def returncode(self) -> int | None: ...
async def wait(self) -> int: ...
def send_signal(self, signal: int) -> None: ...
def terminate(self) -> None: ...
def kill(self) -> None: ...
async def communicate(self, input: Optional[bytes] = ...) -> Tuple[bytes, bytes]: ...
async def communicate(self, input: bytes | None = ...) -> Tuple[bytes, bytes]: ...
if sys.version_info >= (3, 10):
async def create_subprocess_shell(
cmd: Union[str, bytes],
stdin: Union[int, IO[Any], None] = ...,
stdout: Union[int, IO[Any], None] = ...,
stderr: Union[int, IO[Any], None] = ...,
cmd: str | bytes,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
limit: int = ...,
*,
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
@@ -56,12 +56,12 @@ if sys.version_info >= (3, 10):
errors: None = ...,
text: Literal[False, None] = ...,
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
executable: Optional[StrOrBytesPath] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
executable: StrOrBytesPath | None = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
cwd: Optional[StrOrBytesPath] = ...,
env: Optional[subprocess._ENV] = ...,
startupinfo: Optional[Any] = ...,
cwd: StrOrBytesPath | None = ...,
env: subprocess._ENV | None = ...,
startupinfo: Any | None = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
@@ -70,9 +70,9 @@ if sys.version_info >= (3, 10):
async def create_subprocess_exec(
program: _ExecArg,
*args: _ExecArg,
stdin: Union[int, IO[Any], None] = ...,
stdout: Union[int, IO[Any], None] = ...,
stderr: Union[int, IO[Any], None] = ...,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
limit: int = ...,
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
universal_newlines: Literal[False] = ...,
@@ -81,13 +81,13 @@ if sys.version_info >= (3, 10):
encoding: None = ...,
errors: None = ...,
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
text: Optional[bool] = ...,
executable: Optional[StrOrBytesPath] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
text: bool | None = ...,
executable: StrOrBytesPath | None = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
cwd: Optional[StrOrBytesPath] = ...,
env: Optional[subprocess._ENV] = ...,
startupinfo: Optional[Any] = ...,
cwd: StrOrBytesPath | None = ...,
env: subprocess._ENV | None = ...,
startupinfo: Any | None = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
@@ -96,11 +96,11 @@ if sys.version_info >= (3, 10):
else:
async def create_subprocess_shell(
cmd: Union[str, bytes],
stdin: Union[int, IO[Any], None] = ...,
stdout: Union[int, IO[Any], None] = ...,
stderr: Union[int, IO[Any], None] = ...,
loop: Optional[events.AbstractEventLoop] = ...,
cmd: str | bytes,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
loop: events.AbstractEventLoop | None = ...,
limit: int = ...,
*,
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
@@ -111,12 +111,12 @@ else:
errors: None = ...,
text: Literal[False, None] = ...,
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
executable: Optional[StrOrBytesPath] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
executable: StrOrBytesPath | None = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
cwd: Optional[StrOrBytesPath] = ...,
env: Optional[subprocess._ENV] = ...,
startupinfo: Optional[Any] = ...,
cwd: StrOrBytesPath | None = ...,
env: subprocess._ENV | None = ...,
startupinfo: Any | None = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
@@ -125,10 +125,10 @@ else:
async def create_subprocess_exec(
program: _ExecArg,
*args: _ExecArg,
stdin: Union[int, IO[Any], None] = ...,
stdout: Union[int, IO[Any], None] = ...,
stderr: Union[int, IO[Any], None] = ...,
loop: Optional[events.AbstractEventLoop] = ...,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
loop: events.AbstractEventLoop | None = ...,
limit: int = ...,
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
universal_newlines: Literal[False] = ...,
@@ -137,13 +137,13 @@ else:
encoding: None = ...,
errors: None = ...,
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
text: Optional[bool] = ...,
executable: Optional[StrOrBytesPath] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
text: bool | None = ...,
executable: StrOrBytesPath | None = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
cwd: Optional[StrOrBytesPath] = ...,
env: Optional[subprocess._ENV] = ...,
startupinfo: Optional[Any] = ...,
cwd: StrOrBytesPath | None = ...,
env: subprocess._ENV | None = ...,
startupinfo: Any | None = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
+7 -7
View File
@@ -2,10 +2,10 @@ import sys
from asyncio.events import AbstractEventLoop
from asyncio.protocols import BaseProtocol
from socket import _Address
from typing import Any, List, Mapping, Optional, Tuple
from typing import Any, List, Mapping, Tuple
class BaseTransport:
def __init__(self, extra: Optional[Mapping[Any, Any]] = ...) -> None: ...
def __init__(self, extra: Mapping[Any, Any] | None = ...) -> None: ...
def get_extra_info(self, name: Any, default: Any = ...) -> Any: ...
def is_closing(self) -> bool: ...
def close(self) -> None: ...
@@ -19,7 +19,7 @@ class ReadTransport(BaseTransport):
def resume_reading(self) -> None: ...
class WriteTransport(BaseTransport):
def set_write_buffer_limits(self, high: Optional[int] = ..., low: Optional[int] = ...) -> None: ...
def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ...
def get_write_buffer_size(self) -> int: ...
def write(self, data: Any) -> None: ...
def writelines(self, list_of_data: List[Any]) -> None: ...
@@ -30,17 +30,17 @@ class WriteTransport(BaseTransport):
class Transport(ReadTransport, WriteTransport): ...
class DatagramTransport(BaseTransport):
def sendto(self, data: Any, addr: Optional[_Address] = ...) -> None: ...
def sendto(self, data: Any, addr: _Address | None = ...) -> None: ...
def abort(self) -> None: ...
class SubprocessTransport(BaseTransport):
def get_pid(self) -> int: ...
def get_returncode(self) -> Optional[int]: ...
def get_pipe_transport(self, fd: int) -> Optional[BaseTransport]: ...
def get_returncode(self) -> int | None: ...
def get_pipe_transport(self, fd: int) -> BaseTransport | None: ...
def send_signal(self, signal: int) -> int: ...
def terminate(self) -> None: ...
def kill(self) -> None: ...
class _FlowControlMixin(Transport):
def __init__(self, extra: Optional[Mapping[Any, Any]] = ..., loop: Optional[AbstractEventLoop] = ...) -> None: ...
def __init__(self, extra: Mapping[Any, Any] | None = ..., loop: AbstractEventLoop | None = ...) -> None: ...
def get_write_buffer_limits(self) -> Tuple[int, int]: ...
+11 -11
View File
@@ -1,7 +1,7 @@
import socket
import sys
from types import TracebackType
from typing import Any, BinaryIO, Iterable, List, NoReturn, Optional, Tuple, Type, Union, overload
from typing import Any, BinaryIO, Iterable, List, NoReturn, Tuple, Type, Union, overload
if sys.version_info >= (3, 8):
# These are based in socket, maybe move them out into _typeshed.pyi or such
@@ -28,23 +28,23 @@ if sys.version_info >= (3, 8):
@overload
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
@overload
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
def setsockopt(self, level: int, optname: int, value: int | bytes) -> None: ...
@overload
def setsockopt(self, level: int, optname: int, value: None, optlen: int) -> None: ...
def getpeername(self) -> _RetAddress: ...
def getsockname(self) -> _RetAddress: ...
def getsockbyname(self) -> NoReturn: ... # This method doesn't exist on socket, yet is passed through?
def accept(self) -> Tuple[socket.socket, _RetAddress]: ...
def connect(self, address: Union[_Address, bytes]) -> None: ...
def connect_ex(self, address: Union[_Address, bytes]) -> int: ...
def bind(self, address: Union[_Address, bytes]) -> None: ...
def connect(self, address: _Address | bytes) -> None: ...
def connect_ex(self, address: _Address | bytes) -> int: ...
def bind(self, address: _Address | bytes) -> None: ...
if sys.platform == "win32":
def ioctl(self, control: int, option: Union[int, Tuple[int, int, int], bool]) -> None: ...
def ioctl(self, control: int, option: int | Tuple[int, int, int] | bool) -> None: ...
else:
def ioctl(self, control: int, option: Union[int, Tuple[int, int, int], bool]) -> NoReturn: ...
def ioctl(self, control: int, option: int | Tuple[int, int, int] | bool) -> NoReturn: ...
def listen(self, __backlog: int = ...) -> None: ...
def makefile(self) -> BinaryIO: ...
def sendfile(self, file: BinaryIO, offset: int = ..., count: Optional[int] = ...) -> int: ...
def sendfile(self, file: BinaryIO, offset: int = ..., count: int | None = ...) -> int: ...
def close(self) -> None: ...
def detach(self) -> int: ...
if sys.platform == "linux":
@@ -77,10 +77,10 @@ if sys.version_info >= (3, 8):
def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., __flags: int = ...) -> Tuple[bytes, List[_CMSG], int, Any]: ...
def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, _RetAddress]: ...
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
def settimeout(self, value: Optional[float]) -> None: ...
def gettimeout(self) -> Optional[float]: ...
def settimeout(self, value: float | None) -> None: ...
def gettimeout(self) -> float | None: ...
def setblocking(self, flag: bool) -> None: ...
def __enter__(self) -> socket.socket: ...
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: ...
+7 -9
View File
@@ -2,7 +2,7 @@ import sys
import types
from _typeshed import Self
from socket import socket
from typing import Any, Callable, Optional, Type
from typing import Any, Callable, Type
from .base_events import Server
from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy, _ProtocolFactory, _SSLContext
@@ -11,12 +11,10 @@ from .selector_events import BaseSelectorEventLoop
class AbstractChildWatcher:
def add_child_handler(self, pid: int, callback: Callable[..., Any], *args: Any) -> None: ...
def remove_child_handler(self, pid: int) -> bool: ...
def attach_loop(self, loop: Optional[AbstractEventLoop]) -> None: ...
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
def close(self) -> None: ...
def __enter__(self: Self) -> Self: ...
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: ...
if sys.version_info >= (3, 8):
def is_active(self) -> bool: ...
@@ -34,16 +32,16 @@ class _UnixSelectorEventLoop(BaseSelectorEventLoop):
async def create_unix_server(
self,
protocol_factory: _ProtocolFactory,
path: Optional[str] = ...,
path: str | None = ...,
*,
sock: Optional[socket] = ...,
sock: socket | None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
) -> Server: ...
class _UnixDefaultEventLoopPolicy(BaseDefaultEventLoopPolicy):
def get_child_watcher(self) -> AbstractChildWatcher: ...
def set_child_watcher(self, watcher: Optional[AbstractChildWatcher]) -> None: ...
def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ...
SelectorEventLoop = _UnixSelectorEventLoop
@@ -54,7 +52,7 @@ if sys.version_info >= (3, 8):
from typing import Protocol
class _Warn(Protocol):
def __call__(
self, message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ..., source: Optional[Any] = ...
self, message: str, category: Type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
) -> None: ...
class MultiLoopChildWatcher(AbstractChildWatcher):
def __enter__(self: Self) -> Self: ...
+4 -4
View File
@@ -1,7 +1,7 @@
import socket
import sys
from _typeshed import WriteableBuffer
from typing import IO, Any, Callable, ClassVar, List, NoReturn, Optional, Tuple, Type
from typing import IO, Any, Callable, ClassVar, List, NoReturn, Tuple, Type
from . import events, futures, proactor_events, selector_events, streams, windows_utils
@@ -30,7 +30,7 @@ class PipeServer:
class _WindowsSelectorEventLoop(selector_events.BaseSelectorEventLoop): ...
class ProactorEventLoop(proactor_events.BaseProactorEventLoop):
def __init__(self, proactor: Optional[IocpProactor] = ...) -> None: ...
def __init__(self, proactor: IocpProactor | None = ...) -> None: ...
async def create_pipe_connection(
self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str
) -> Tuple[proactor_events._ProactorDuplexPipeTransport, streams.StreamReaderProtocol]: ...
@@ -43,7 +43,7 @@ class IocpProactor:
def __repr__(self) -> str: ...
def __del__(self) -> None: ...
def set_loop(self, loop: events.AbstractEventLoop) -> None: ...
def select(self, timeout: Optional[int] = ...) -> List[futures.Future[Any]]: ...
def select(self, timeout: int | None = ...) -> List[futures.Future[Any]]: ...
def recv(self, conn: socket.socket, nbytes: int, flags: int = ...) -> futures.Future[bytes]: ...
if sys.version_info >= (3, 7):
def recv_into(self, conn: socket.socket, buf: WriteableBuffer, flags: int = ...) -> futures.Future[Any]: ...
@@ -54,7 +54,7 @@ class IocpProactor:
def sendfile(self, sock: socket.socket, file: IO[bytes], offset: int, count: int) -> futures.Future[Any]: ...
def accept_pipe(self, pipe: socket.socket) -> futures.Future[Any]: ...
async def connect_pipe(self, address: bytes) -> windows_utils.PipeHandle: ...
def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: Optional[int] = ...) -> bool: ...
def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: int | None = ...) -> bool: ...
def close(self) -> None: ...
SelectorEventLoop = _WindowsSelectorEventLoop
+2 -2
View File
@@ -1,7 +1,7 @@
import sys
from _typeshed import Self
from types import TracebackType
from typing import Callable, Optional, Protocol, Tuple, Type
from typing import Callable, Protocol, Tuple, Type
class _WarnFunction(Protocol):
def __call__(self, message: str, category: Type[Warning] = ..., stacklevel: int = ..., source: PipeHandle = ...) -> None: ...
@@ -20,7 +20,7 @@ class PipeHandle:
else:
def __del__(self) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, t: Optional[type], v: Optional[BaseException], tb: Optional[TracebackType]) -> None: ...
def __exit__(self, t: type | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
@property
def handle(self) -> int: ...
def fileno(self) -> int: ...
+16 -16
View File
@@ -1,7 +1,7 @@
import sys
from _typeshed import FileDescriptorLike
from socket import socket
from typing import Any, Dict, Optional, Tuple, Union, overload
from typing import Any, Dict, Tuple, overload
# cyclic dependence with asynchat
_maptype = Dict[int, Any]
@@ -14,12 +14,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.
@@ -31,19 +31,19 @@ class dispatcher:
connecting: bool
closing: bool
ignore_log_types: frozenset[str]
socket: Optional[_socket]
def __init__(self, sock: Optional[_socket] = ..., map: Optional[_maptype] = ...) -> None: ...
def add_channel(self, map: Optional[_maptype] = ...) -> None: ...
def del_channel(self, map: Optional[_maptype] = ...) -> None: ...
socket: _socket | None
def __init__(self, sock: _socket | 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: _socket, map: Optional[_maptype] = ...) -> None: ...
def set_socket(self, sock: _socket, 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[_socket, Any]]: ...
def bind(self, addr: Tuple[Any, ...] | str) -> None: ...
def connect(self, address: Tuple[Any, ...] | str) -> None: ...
def accept(self) -> Tuple[_socket, Any] | None: ...
def send(self, data: bytes) -> int: ...
def recv(self, buffer_size: int) -> bytes: ...
def close(self) -> None: ...
@@ -62,14 +62,14 @@ class dispatcher:
def handle_close(self) -> None: ...
class dispatcher_with_send(dispatcher):
def __init__(self, sock: Optional[socket] = ..., map: Optional[_maptype] = ...) -> None: ...
def __init__(self, sock: socket | None = ..., map: _maptype | None = ...) -> None: ...
def initiate_send(self) -> None: ...
def handle_write(self) -> None: ...
# incompatible signature:
# def send(self, data: bytes) -> Optional[int]: ...
# def send(self, data: bytes) -> int | None: ...
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:
@@ -86,5 +86,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: ...
+4 -4
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]: ...
+10 -12
View File
@@ -1,27 +1,25 @@
import sys
from typing import IO, Optional, Union
from typing import IO
def b64encode(s: bytes, altchars: Optional[bytes] = ...) -> bytes: ...
def b64decode(s: Union[str, bytes], altchars: Optional[bytes] = ..., validate: bool = ...) -> bytes: ...
def b64encode(s: bytes, altchars: bytes | None = ...) -> bytes: ...
def b64decode(s: str | bytes, altchars: bytes | None = ..., validate: bool = ...) -> bytes: ...
def standard_b64encode(s: bytes) -> bytes: ...
def standard_b64decode(s: Union[str, bytes]) -> bytes: ...
def standard_b64decode(s: str | bytes) -> bytes: ...
def urlsafe_b64encode(s: bytes) -> bytes: ...
def urlsafe_b64decode(s: Union[str, bytes]) -> bytes: ...
def urlsafe_b64decode(s: str | bytes) -> bytes: ...
def b32encode(s: bytes) -> bytes: ...
def b32decode(s: Union[str, bytes], casefold: bool = ..., map01: Optional[bytes] = ...) -> bytes: ...
def b32decode(s: str | bytes, casefold: bool = ..., map01: bytes | None = ...) -> bytes: ...
def b16encode(s: bytes) -> bytes: ...
def b16decode(s: Union[str, bytes], casefold: bool = ...) -> bytes: ...
def b16decode(s: str | bytes, casefold: bool = ...) -> bytes: ...
if sys.version_info >= (3, 10):
def b32hexencode(s: bytes) -> bytes: ...
def b32hexdecode(s: Union[str, bytes], casefold: bool = ...) -> bytes: ...
def b32hexdecode(s: str | bytes, casefold: bool = ...) -> bytes: ...
def a85encode(b: bytes, *, foldspaces: bool = ..., wrapcol: int = ..., pad: bool = ..., adobe: bool = ...) -> bytes: ...
def a85decode(
b: Union[str, bytes], *, foldspaces: bool = ..., adobe: bool = ..., ignorechars: Union[str, bytes] = ...
) -> bytes: ...
def a85decode(b: str | bytes, *, foldspaces: bool = ..., adobe: bool = ..., ignorechars: str | bytes = ...) -> bytes: ...
def b85encode(b: bytes, pad: bool = ...) -> bytes: ...
def b85decode(b: Union[str, bytes]) -> bytes: ...
def b85decode(b: str | bytes) -> bytes: ...
def decode(input: IO[bytes], output: IO[bytes]) -> None: ...
def encode(input: IO[bytes], output: IO[bytes]) -> None: ...
def encodebytes(s: bytes) -> bytes: ...
+23 -27
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: ...
+7 -8
View File
@@ -1,7 +1,6 @@
import sys
from typing import Union
def a2b_uu(__data: Union[str, bytes]) -> bytes: ...
def a2b_uu(__data: str | bytes) -> bytes: ...
if sys.version_info >= (3, 7):
def b2a_uu(__data: bytes, *, backtick: bool = ...) -> bytes: ...
@@ -9,11 +8,11 @@ if sys.version_info >= (3, 7):
else:
def b2a_uu(__data: bytes) -> bytes: ...
def a2b_base64(__data: Union[str, bytes]) -> bytes: ...
def a2b_base64(__data: str | bytes) -> bytes: ...
def b2a_base64(__data: bytes, *, newline: bool = ...) -> bytes: ...
def a2b_qp(data: Union[str, bytes], header: bool = ...) -> bytes: ...
def a2b_qp(data: str | bytes, header: bool = ...) -> bytes: ...
def b2a_qp(data: bytes, quotetabs: bool = ..., istext: bool = ..., header: bool = ...) -> bytes: ...
def a2b_hqx(__data: Union[str, bytes]) -> bytes: ...
def a2b_hqx(__data: str | bytes) -> bytes: ...
def rledecode_hqx(__data: bytes) -> bytes: ...
def rlecode_hqx(__data: bytes) -> bytes: ...
def b2a_hqx(__data: bytes) -> bytes: ...
@@ -22,13 +21,13 @@ def crc32(__data: bytes, __crc: int = ...) -> int: ...
def b2a_hex(__data: bytes) -> bytes: ...
if sys.version_info >= (3, 8):
def hexlify(data: bytes, sep: Union[str, bytes] = ..., bytes_per_sep: int = ...) -> bytes: ...
def hexlify(data: bytes, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes: ...
else:
def hexlify(__data: bytes) -> bytes: ...
def a2b_hex(__hexstr: Union[str, bytes]) -> bytes: ...
def unhexlify(__hexstr: Union[str, bytes]) -> bytes: ...
def a2b_hex(__hexstr: str | bytes) -> bytes: ...
def unhexlify(__hexstr: str | bytes) -> bytes: ...
class Error(ValueError): ...
class Incomplete(Exception): ...
+137 -154
View File
@@ -42,7 +42,6 @@ from typing import (
MutableSequence,
MutableSet,
NoReturn,
Optional,
Protocol,
Reversible,
Sequence,
@@ -84,9 +83,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[str, Iterable[str]]
__slots__: str | Iterable[str]
__module__: str
__annotations__: Dict[str, Any]
@property
@@ -106,7 +105,7 @@ 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__(self) -> str | Tuple[Any, ...]: ...
if sys.version_info >= (3, 8):
def __reduce_ex__(self, protocol: SupportsIndex) -> str | Tuple[Any, ...]: ...
else:
@@ -119,14 +118,14 @@ class staticmethod(object): # Special, only valid as a decorator.
__isabstractmethod__: bool
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]
__isabstractmethod__: bool
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
@@ -140,7 +139,7 @@ class type(object):
__mro__: Tuple[type, ...]
__name__: str
__qualname__: str
__text_signature__: Optional[str]
__text_signature__: str | None
__weakrefoffset__: int
@overload
def __init__(self, o: object) -> None: ...
@@ -173,9 +172,9 @@ class super(object):
class int:
@overload
def __new__(cls: Type[_T], x: Union[str, bytes, SupportsInt, SupportsIndex, _SupportsTrunc] = ...) -> _T: ...
def __new__(cls: Type[_T], x: str | bytes | SupportsInt | SupportsIndex | _SupportsTrunc = ...) -> _T: ...
@overload
def __new__(cls: Type[_T], x: Union[str, bytes, bytearray], base: SupportsIndex) -> _T: ...
def __new__(cls: Type[_T], x: str | bytes | bytearray, base: SupportsIndex) -> _T: ...
if sys.version_info >= (3, 8):
def as_integer_ratio(self) -> Tuple[int, Literal[1]]: ...
@property
@@ -210,10 +209,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: ...
@@ -247,7 +246,7 @@ class int:
def __index__(self) -> int: ...
class float:
def __new__(cls: Type[_T], x: Union[SupportsFloat, SupportsIndex, str, bytes, bytearray] = ...) -> _T: ...
def __new__(cls: Type[_T], x: SupportsFloat | SupportsIndex | str | bytes | bytearray = ...) -> _T: ...
def as_integer_ratio(self) -> Tuple[int, int]: ...
def hex(self) -> str: ...
def is_integer(self) -> bool: ...
@@ -304,7 +303,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, complex]) -> _T: ...
def __new__(cls: Type[_T], real: str | SupportsComplex | SupportsIndex | complex) -> _T: ...
@property
def real(self) -> float: ...
@property
@@ -340,19 +339,19 @@ class str(Sequence[str]):
def capitalize(self) -> str: ...
def casefold(self) -> str: ...
def center(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ...
def count(self, x: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
def count(self, x: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def encode(self, encoding: str = ..., errors: str = ...) -> bytes: ...
def endswith(
self, __suffix: Union[str, Tuple[str, ...]], __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...
self, __suffix: str | Tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
if sys.version_info >= (3, 8):
def expandtabs(self, tabsize: SupportsIndex = ...) -> str: ...
else:
def expandtabs(self, tabsize: int = ...) -> str: ...
def find(self, __sub: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
def find(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def format(self, *args: object, **kwargs: object) -> str: ...
def format_map(self, map: _FormatMapMapping) -> str: ...
def index(self, __sub: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
def index(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...
if sys.version_info >= (3, 7):
@@ -369,41 +368,41 @@ class str(Sequence[str]):
def join(self, __iterable: Iterable[str]) -> str: ...
def ljust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ...
def lower(self) -> str: ...
def lstrip(self, __chars: Optional[str] = ...) -> str: ...
def lstrip(self, __chars: str | None = ...) -> str: ...
def partition(self, __sep: str) -> Tuple[str, str, str]: ...
def replace(self, __old: str, __new: str, __count: SupportsIndex = ...) -> str: ...
if sys.version_info >= (3, 9):
def removeprefix(self, __prefix: str) -> str: ...
def removesuffix(self, __suffix: str) -> str: ...
def rfind(self, __sub: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
def rindex(self, __sub: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
def rfind(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def rindex(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def rjust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ...
def rpartition(self, __sep: str) -> Tuple[str, str, str]: ...
def rsplit(self, sep: Optional[str] = ..., maxsplit: SupportsIndex = ...) -> List[str]: ...
def rstrip(self, __chars: Optional[str] = ...) -> str: ...
def split(self, sep: Optional[str] = ..., maxsplit: SupportsIndex = ...) -> List[str]: ...
def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> List[str]: ...
def rstrip(self, __chars: str | None = ...) -> str: ...
def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> List[str]: ...
def splitlines(self, keepends: bool = ...) -> List[str]: ...
def startswith(
self, __prefix: Union[str, Tuple[str, ...]], __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...
self, __prefix: str | Tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
def strip(self, __chars: Optional[str] = ...) -> str: ...
def strip(self, __chars: str | None = ...) -> str: ...
def swapcase(self) -> str: ...
def title(self) -> str: ...
def translate(self, __table: Union[Mapping[int, Union[int, str, None]], Sequence[Union[int, str, None]]]) -> str: ...
def translate(self, __table: Mapping[int, int | str | None] | Sequence[int | str | None]) -> str: ...
def upper(self) -> str: ...
def zfill(self, __width: SupportsIndex) -> str: ...
@staticmethod
@overload
def maketrans(__x: Union[Dict[int, _T], Dict[str, _T], Dict[Union[str, int], _T]]) -> Dict[int, _T]: ...
def maketrans(__x: Dict[int, _T] | Dict[str, _T] | Dict[str | int, _T]) -> Dict[int, _T]: ...
@staticmethod
@overload
def maketrans(__x: str, __y: str, __z: Optional[str] = ...) -> Dict[int, Union[int, None]]: ...
def maketrans(__x: str, __y: str, __z: str | None = ...) -> Dict[int, int | None]: ...
def __add__(self, s: str) -> str: ...
# Incompatible with Sequence.__contains__
def __contains__(self, o: str) -> bool: ... # type: ignore
def __eq__(self, x: object) -> bool: ...
def __ge__(self, x: str) -> bool: ...
def __getitem__(self, i: Union[int, slice]) -> str: ...
def __getitem__(self, i: int | slice) -> str: ...
def __gt__(self, x: str) -> bool: ...
def __hash__(self) -> int: ...
def __iter__(self) -> Iterator[str]: ...
@@ -436,10 +435,7 @@ class bytes(ByteString):
) -> int: ...
def decode(self, encoding: str = ..., errors: str = ...) -> str: ...
def endswith(
self,
__suffix: Union[bytes, Tuple[bytes, ...]],
__start: Optional[SupportsIndex] = ...,
__end: Optional[SupportsIndex] = ...,
self, __suffix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
if sys.version_info >= (3, 8):
def expandtabs(self, tabsize: SupportsIndex = ...) -> bytes: ...
@@ -449,7 +445,7 @@ class bytes(ByteString):
self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> int: ...
if sys.version_info >= (3, 8):
def hex(self, sep: Union[str, bytes] = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
else:
def hex(self) -> str: ...
def index(
@@ -464,10 +460,10 @@ class bytes(ByteString):
def isspace(self) -> bool: ...
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
def join(self, __iterable_of_bytes: Iterable[Union[ByteString, memoryview]]) -> bytes: ...
def join(self, __iterable_of_bytes: Iterable[ByteString | memoryview]) -> bytes: ...
def ljust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ...
def lower(self) -> bytes: ...
def lstrip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
def lstrip(self, __bytes: bytes | None = ...) -> bytes: ...
def partition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
def replace(self, __old: bytes, __new: bytes, __count: SupportsIndex = ...) -> bytes: ...
if sys.version_info >= (3, 9):
@@ -481,20 +477,17 @@ class bytes(ByteString):
) -> int: ...
def rjust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ...
def rpartition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
def rsplit(self, sep: Optional[bytes] = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ...
def rstrip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
def split(self, sep: Optional[bytes] = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ...
def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ...
def rstrip(self, __bytes: bytes | None = ...) -> bytes: ...
def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ...
def splitlines(self, keepends: bool = ...) -> List[bytes]: ...
def startswith(
self,
__prefix: Union[bytes, Tuple[bytes, ...]],
__start: Optional[SupportsIndex] = ...,
__end: Optional[SupportsIndex] = ...,
self, __prefix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
def strip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
def strip(self, __bytes: bytes | None = ...) -> bytes: ...
def swapcase(self) -> bytes: ...
def title(self) -> bytes: ...
def translate(self, __table: Optional[bytes], delete: bytes = ...) -> bytes: ...
def translate(self, __table: bytes | None, delete: bytes = ...) -> bytes: ...
def upper(self) -> bytes: ...
def zfill(self, __width: SupportsIndex) -> bytes: ...
@classmethod
@@ -542,10 +535,7 @@ class bytearray(MutableSequence[int], ByteString):
def copy(self) -> bytearray: ...
def decode(self, encoding: str = ..., errors: str = ...) -> str: ...
def endswith(
self,
__suffix: Union[bytes, Tuple[bytes, ...]],
__start: Optional[SupportsIndex] = ...,
__end: Optional[SupportsIndex] = ...,
self, __suffix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
if sys.version_info >= (3, 8):
def expandtabs(self, tabsize: SupportsIndex = ...) -> bytearray: ...
@@ -556,7 +546,7 @@ class bytearray(MutableSequence[int], ByteString):
self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> int: ...
if sys.version_info >= (3, 8):
def hex(self, sep: Union[str, bytes] = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
else:
def hex(self) -> str: ...
def index(
@@ -572,10 +562,10 @@ class bytearray(MutableSequence[int], ByteString):
def isspace(self) -> bool: ...
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
def join(self, __iterable_of_bytes: Iterable[Union[ByteString, memoryview]]) -> bytearray: ...
def join(self, __iterable_of_bytes: Iterable[ByteString | memoryview]) -> bytearray: ...
def ljust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> 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]: ...
if sys.version_info >= (3, 9):
def removeprefix(self, __prefix: bytes) -> bytearray: ...
@@ -589,20 +579,17 @@ class bytearray(MutableSequence[int], ByteString):
) -> int: ...
def rjust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytearray: ...
def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def rsplit(self, sep: Optional[bytes] = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ...
def rstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def split(self, sep: Optional[bytes] = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ...
def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ...
def rstrip(self, __bytes: bytes | None = ...) -> bytearray: ...
def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ...
def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
def startswith(
self,
__prefix: Union[bytes, Tuple[bytes, ...]],
__start: Optional[SupportsIndex] = ...,
__end: Optional[SupportsIndex] = ...,
self, __prefix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
def strip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def strip(self, __bytes: bytes | None = ...) -> bytearray: ...
def swapcase(self) -> bytearray: ...
def title(self) -> bytearray: ...
def translate(self, __table: Optional[bytes], delete: bytes = ...) -> bytearray: ...
def translate(self, __table: bytes | None, delete: bytes = ...) -> bytearray: ...
def upper(self) -> bytearray: ...
def zfill(self, __width: SupportsIndex) -> bytearray: ...
@classmethod
@@ -641,13 +628,13 @@ class bytearray(MutableSequence[int], ByteString):
class memoryview(Sized, Sequence[int]):
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
obj: Union[bytes, bytearray]
obj: bytes | bytearray
c_contiguous: bool
f_contiguous: bool
contiguous: bool
@@ -655,9 +642,9 @@ class memoryview(Sized, Sequence[int]):
def __init__(self, obj: ReadableBuffer) -> None: ...
def __enter__(self: Self) -> Self: ...
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 cast(self, format: str, shape: Union[List[int], Tuple[int]] = ...) -> memoryview: ...
def cast(self, format: str, shape: List[int] | Tuple[int] = ...) -> memoryview: ...
@overload
def __getitem__(self, i: SupportsIndex) -> int: ...
@overload
@@ -670,7 +657,7 @@ class memoryview(Sized, Sequence[int]):
@overload
def __setitem__(self, i: SupportsIndex, o: SupportsIndex) -> None: ...
if sys.version_info >= (3, 8):
def tobytes(self, order: Optional[Literal["C", "F", "A"]] = ...) -> bytes: ...
def tobytes(self, order: Literal["C", "F", "A"] | None = ...) -> bytes: ...
else:
def tobytes(self) -> bytes: ...
def tolist(self) -> List[int]: ...
@@ -678,7 +665,7 @@ class memoryview(Sized, Sequence[int]):
def toreadonly(self) -> memoryview: ...
def release(self) -> None: ...
if sys.version_info >= (3, 8):
def hex(self, sep: Union[str, bytes] = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
else:
def hex(self) -> str: ...
@@ -738,7 +725,7 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
@overload
def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
@overload
def __add__(self, x: Tuple[_T, ...]) -> Tuple[Union[_T_co, _T], ...]: ...
def __add__(self, x: Tuple[_T, ...]) -> Tuple[_T_co | _T, ...]: ...
def __mul__(self, n: SupportsIndex) -> Tuple[_T_co, ...]: ...
def __rmul__(self, n: SupportsIndex) -> Tuple[_T_co, ...]: ...
def count(self, __value: Any) -> int: ...
@@ -785,7 +772,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __setitem__(self, i: SupportsIndex, o: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
def __delitem__(self, i: Union[SupportsIndex, slice]) -> None: ...
def __delitem__(self, i: SupportsIndex | slice) -> None: ...
def __add__(self, x: List[_T]) -> List[_T]: ...
def __iadd__(self: _S, x: Iterable[_T]) -> _S: ...
def __mul__(self, n: SupportsIndex) -> List[_T]: ...
@@ -825,7 +812,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def items(self) -> ItemsView[_KT, _VT]: ...
@classmethod
@overload
def fromkeys(cls, __iterable: Iterable[_T], __value: None = ...) -> dict[_T, Optional[Any]]: ...
def fromkeys(cls, __iterable: Iterable[_T], __value: None = ...) -> dict[_T, Any | None]: ...
@classmethod
@overload
def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> dict[_T, _S]: ...
@@ -840,8 +827,8 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
__hash__: None # type: ignore
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
def __or__(self, __value: Mapping[_T1, _T2]) -> Dict[Union[_KT, _T1], Union[_VT, _T2]]: ...
def __ror__(self, __value: Mapping[_T1, _T2]) -> Dict[Union[_KT, _T1], Union[_VT, _T2]]: ...
def __or__(self, __value: Mapping[_T1, _T2]) -> Dict[_KT | _T1, _VT | _T2]: ...
def __ror__(self, __value: Mapping[_T1, _T2]) -> Dict[_KT | _T1, _VT | _T2]: ...
def __ior__(self, __value: Mapping[_KT, _VT]) -> Dict[_KT, _VT]: ... # type: ignore
class set(MutableSet[_T], Generic[_T]):
@@ -869,12 +856,12 @@ 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 __sub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...
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 __or__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __ior__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __sub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ...
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: ...
@@ -898,9 +885,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: ...
@@ -936,20 +923,20 @@ class range(Sequence[int]):
def __reversed__(self) -> Iterator[int]: ...
class property(object):
fget: Optional[Callable[[Any], Any]]
fset: Optional[Callable[[Any, Any], None]]
fdel: Optional[Callable[[Any], None]]
fget: Callable[[Any], Any] | None
fset: Callable[[Any, Any], None] | None
fdel: Callable[[Any], None] | None
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: ...
@@ -964,7 +951,7 @@ def abs(__x: SupportsAbs[_T]) -> _T: ...
def all(__iterable: Iterable[object]) -> bool: ...
def any(__iterable: Iterable[object]) -> bool: ...
def ascii(__obj: object) -> str: ...
def bin(__number: Union[int, SupportsIndex]) -> str: ...
def bin(__number: int | SupportsIndex) -> str: ...
if sys.version_info >= (3, 7):
def breakpoint(*args: Any, **kws: Any) -> None: ...
@@ -984,12 +971,12 @@ if sys.version_info >= (3, 10):
@overload
async def anext(__i: AsyncIterator[_T]) -> _T: ...
@overload
async def anext(__i: AsyncIterator[_T], default: _VT) -> Union[_T, _VT]: ...
async def anext(__i: AsyncIterator[_T], default: _VT) -> _T | _VT: ...
if sys.version_info >= (3, 8):
def compile(
source: Union[str, bytes, mod, AST],
filename: Union[str, bytes, _PathLike[Any]],
source: str | bytes | mod | AST,
filename: str | bytes | _PathLike[Any],
mode: str,
flags: int = ...,
dont_inherit: int = ...,
@@ -1000,8 +987,8 @@ if sys.version_info >= (3, 8):
else:
def compile(
source: Union[str, bytes, mod, AST],
filename: Union[str, bytes, _PathLike[Any]],
source: str | bytes | mod | AST,
filename: str | bytes | _PathLike[Any],
mode: str,
flags: int = ...,
dont_inherit: int = ...,
@@ -1017,16 +1004,16 @@ def divmod(__x: SupportsDivMod[_T_contra, _T_co], __y: _T_contra) -> _T_co: ...
@overload
def divmod(__x: _T_contra, __y: SupportsRDivMod[_T_contra, _T_co]) -> _T_co: ...
def eval(
__source: Union[str, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...
__source: str | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ...
) -> Any: ...
def exec(
__source: Union[str, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...
__source: str | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ...
) -> Any: ...
def exit(code: object = ...) -> NoReturn: ...
class filter(Iterator[_T], Generic[_T]):
@overload
def __init__(self, __function: None, __iterable: Iterable[Optional[_T]]) -> None: ...
def __init__(self, __function: None, __iterable: Iterable[_T | None]) -> None: ...
@overload
def __init__(self, __function: Callable[[_T], Any], __iterable: Iterable[_T]) -> None: ...
def __iter__(self) -> Iterator[_T]: ...
@@ -1039,36 +1026,36 @@ def getattr(__o: object, name: str) -> 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: object, name: str, __default: None) -> Optional[Any]: ...
def getattr(__o: object, name: str, __default: None) -> Any | None: ...
@overload
def getattr(__o: object, name: str, __default: bool) -> Union[Any, bool]: ...
def getattr(__o: object, name: str, __default: bool) -> Any | bool: ...
@overload
def getattr(__o: object, name: str, __default: _T) -> Union[Any, _T]: ...
def getattr(__o: object, name: str, __default: _T) -> Any | _T: ...
def globals() -> Dict[str, Any]: ...
def hasattr(__obj: object, __name: str) -> bool: ...
def hash(__obj: object) -> int: ...
def help(*args: Any, **kwds: Any) -> None: ...
def hex(__number: Union[int, SupportsIndex]) -> str: ...
def hex(__number: int | SupportsIndex) -> str: ...
def id(__obj: object) -> int: ...
def input(__prompt: Any = ...) -> 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]: ...
if sys.version_info >= (3, 10):
def isinstance(
__obj: object, __class_or_tuple: Union[type, types.UnionType, Tuple[Union[type, types.UnionType, Tuple[Any, ...]], ...]]
__obj: object, __class_or_tuple: type | types.UnionType | Tuple[type | types.UnionType | Tuple[Any, ...], ...]
) -> bool: ...
def issubclass(
__cls: type, __class_or_tuple: Union[type, types.UnionType, Tuple[Union[type, types.UnionType, Tuple[Any, ...]], ...]]
__cls: type, __class_or_tuple: type | types.UnionType | Tuple[type | types.UnionType | Tuple[Any, ...], ...]
) -> bool: ...
else:
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 license() -> None: ...
@@ -1128,9 +1115,9 @@ def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ...) -> Supports
@overload
def max(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan]) -> _T: ...
@overload
def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> Union[SupportsLessThanT, _T]: ...
def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> SupportsLessThanT | _T: ...
@overload
def max(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThan], default: _T2) -> Union[_T1, _T2]: ...
def max(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThan], default: _T2) -> _T1 | _T2: ...
@overload
def min(
__arg1: SupportsLessThanT, __arg2: SupportsLessThanT, *_args: SupportsLessThanT, key: None = ...
@@ -1142,14 +1129,14 @@ def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ...) -> Supports
@overload
def min(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan]) -> _T: ...
@overload
def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> Union[SupportsLessThanT, _T]: ...
def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> SupportsLessThanT | _T: ...
@overload
def min(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThan], default: _T2) -> Union[_T1, _T2]: ...
def min(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThan], default: _T2) -> _T1 | _T2: ...
@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 next(__i: Iterator[_T], default: _VT) -> _T | _VT: ...
def oct(__number: int | SupportsIndex) -> str: ...
_OpenFile = Union[StrOrBytesPath, int]
_Opener = Callable[[str, int], int]
@@ -1160,11 +1147,11 @@ def open(
file: _OpenFile,
mode: OpenTextMode = ...,
buffering: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> TextIOWrapper: ...
# Unbuffered binary mode: returns a FileIO
@@ -1177,7 +1164,7 @@ def open(
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> FileIO: ...
# Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter
@@ -1190,7 +1177,7 @@ def open(
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> BufferedRandom: ...
@overload
def open(
@@ -1201,7 +1188,7 @@ def open(
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> BufferedWriter: ...
@overload
def open(
@@ -1212,7 +1199,7 @@ def open(
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> BufferedReader: ...
# Buffering cannot be determined: fall back to BinaryIO
@@ -1225,7 +1212,7 @@ def open(
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> BinaryIO: ...
# Fallback if mode is not specified
@@ -1234,19 +1221,15 @@ def open(
file: _OpenFile,
mode: str,
buffering: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> IO[Any]: ...
def ord(__c: Union[str, bytes]) -> int: ...
def ord(__c: str | bytes) -> int: ...
def print(
*values: object,
sep: Optional[str] = ...,
end: Optional[str] = ...,
file: Optional[SupportsWrite[str]] = ...,
flush: bool = ...,
*values: object, sep: str | None = ..., end: str | None = ..., file: SupportsWrite[str] | None = ..., flush: bool = ...
) -> None: ...
_E = TypeVar("_E", contravariant=True)
@@ -1309,15 +1292,15 @@ def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan], r
if sys.version_info >= (3, 8):
@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: ...
else:
@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 vars(__object: Any = ...) -> Dict[str, Any]: ...
@@ -1357,8 +1340,8 @@ class zip(Iterator[_T_co], Generic[_T_co]):
def __import__(
name: str,
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: ...
@@ -1371,14 +1354,14 @@ Ellipsis: ellipsis
class BaseException(object):
args: Tuple[Any, ...]
__cause__: Optional[BaseException]
__context__: Optional[BaseException]
__cause__: BaseException | None
__context__: BaseException | None
__suppress_context__: bool
__traceback__: Optional[TracebackType]
__traceback__: TracebackType | None
def __init__(self, *args: object) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def with_traceback(self: _TBE, tb: Optional[TracebackType]) -> _TBE: ...
def with_traceback(self: _TBE, tb: TracebackType | None) -> _TBE: ...
class GeneratorExit(BaseException): ...
class KeyboardInterrupt(BaseException): ...
@@ -1396,7 +1379,7 @@ _StandardError = Exception
class OSError(Exception):
errno: int
strerror: str
# filename, filename2 are actually Union[str, bytes, None]
# filename, filename2 are actually str | bytes | None
filename: Any
filename2: Any
if sys.platform == "win32":
@@ -1419,9 +1402,9 @@ class BufferError(_StandardError): ...
class EOFError(_StandardError): ...
class ImportError(_StandardError):
def __init__(self, *args: object, name: Optional[str] = ..., path: Optional[str] = ...) -> None: ...
name: Optional[str]
path: Optional[str]
def __init__(self, *args: object, name: str | None = ..., path: str | None = ...) -> None: ...
name: str | None
path: str | None
msg: str # undocumented
class LookupError(_StandardError): ...
@@ -1439,13 +1422,13 @@ class StopAsyncIteration(Exception):
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
if sys.version_info >= (3, 10):
end_lineno: Optional[int]
end_offset: Optional[int]
end_lineno: int | None
end_offset: int | None
class SystemError(_StandardError): ...
class TypeError(_StandardError): ...
+18 -22
View File
@@ -2,7 +2,7 @@ import _compression
import sys
from _compression import BaseStream
from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer
from typing import IO, Any, Iterable, List, Optional, Protocol, TextIO, TypeVar, Union, overload
from typing import IO, Any, Iterable, List, Protocol, TextIO, TypeVar, overload
from typing_extensions import Literal, SupportsIndex
# The following attributes and methods are optional:
@@ -40,9 +40,9 @@ def open(
filename: _ReadableFileobj,
mode: _ReadTextMode,
compresslevel: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
) -> TextIO: ...
@overload
def open(
@@ -58,14 +58,14 @@ def open(
filename: _WritableFileobj,
mode: _WriteTextMode,
compresslevel: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
) -> TextIO: ...
@overload
def open(
filename: StrOrBytesPath,
mode: Union[_ReadBinaryMode, _WriteBinaryMode] = ...,
mode: _ReadBinaryMode | _WriteBinaryMode = ...,
compresslevel: int = ...,
encoding: None = ...,
errors: None = ...,
@@ -74,11 +74,11 @@ def open(
@overload
def open(
filename: StrOrBytesPath,
mode: Union[_ReadTextMode, _WriteTextMode],
mode: _ReadTextMode | _WriteTextMode,
compresslevel: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
) -> TextIO: ...
class BZ2File(BaseStream, IO[bytes]):
@@ -90,30 +90,26 @@ class BZ2File(BaseStream, IO[bytes]):
def __init__(self, filename: _ReadableFileobj, mode: _ReadBinaryMode = ..., *, compresslevel: int = ...) -> None: ...
@overload
def __init__(
self, filename: StrOrBytesPath, mode: Union[_ReadBinaryMode, _WriteBinaryMode] = ..., *, compresslevel: int = ...
self, filename: StrOrBytesPath, mode: _ReadBinaryMode | _WriteBinaryMode = ..., *, compresslevel: int = ...
) -> None: ...
else:
@overload
def __init__(
self, filename: _WritableFileobj, mode: _WriteBinaryMode, buffering: Optional[Any] = ..., compresslevel: int = ...
self, filename: _WritableFileobj, mode: _WriteBinaryMode, buffering: Any | None = ..., compresslevel: int = ...
) -> None: ...
@overload
def __init__(
self,
filename: _ReadableFileobj,
mode: _ReadBinaryMode = ...,
buffering: Optional[Any] = ...,
compresslevel: int = ...,
self, filename: _ReadableFileobj, mode: _ReadBinaryMode = ..., buffering: Any | None = ..., compresslevel: int = ...
) -> None: ...
@overload
def __init__(
self,
filename: StrOrBytesPath,
mode: Union[_ReadBinaryMode, _WriteBinaryMode] = ...,
buffering: Optional[Any] = ...,
mode: _ReadBinaryMode | _WriteBinaryMode = ...,
buffering: Any | None = ...,
compresslevel: int = ...,
) -> None: ...
def read(self, size: Optional[int] = ...) -> bytes: ...
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: ...
+5 -5
View File
@@ -1,11 +1,11 @@
import sys
from _typeshed import Self, StrOrBytesPath
from types import CodeType
from typing import Any, Callable, Dict, Optional, Tuple, TypeVar, Union
from typing import Any, Callable, Dict, 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: ...
_T = TypeVar("_T")
@@ -18,7 +18,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: StrOrBytesPath) -> None: ...
def create_stats(self) -> None: ...
def snapshot_stats(self) -> None: ...
@@ -29,4 +29,4 @@ class Profile:
def __enter__(self: Self) -> Self: ...
def __exit__(self, *exc_info: Any) -> None: ...
def label(code: Union[str, CodeType]) -> _Label: ... # undocumented
def label(code: str | CodeType) -> _Label: ... # undocumented
+5 -5
View File
@@ -1,7 +1,7 @@
import datetime
import sys
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]]
@@ -67,7 +67,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: ...
if sys.version_info >= (3, 7):
cssclasses: List[str]
cssclass_noday: str
@@ -83,12 +83,12 @@ class different_locale:
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: ...
@@ -97,7 +97,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]
+15 -15
View File
@@ -2,12 +2,12 @@ import sys
from _typeshed import SupportsGetItem, SupportsItemAccess
from builtins import type as _type
from collections.abc import Iterable, Iterator, Mapping
from typing import IO, Any, Optional, Protocol, TypeVar, Union
from typing import IO, Any, Protocol, TypeVar
_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 = ...,
@@ -38,14 +38,14 @@ def print_directory() -> None: ...
def print_environ_usage() -> None: ...
if sys.version_info < (3, 8):
def escape(s: str, quote: Optional[bool] = ...) -> str: ...
def escape(s: str, quote: bool | None = ...) -> str: ...
class MiniFieldStorage:
# The first five "Any" attributes here are always None, but mypy doesn't support that
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]
@@ -58,40 +58,40 @@ class MiniFieldStorage:
_list = list
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: Optional[IO[Any]] = ...,
headers: Optional[Mapping[str, str]] = ...,
fp: IO[Any] | None = ...,
headers: Mapping[str, str] | None = ...,
outerboundary: bytes = ...,
environ: SupportsGetItem[str, str] = ...,
keep_blank_values: int = ...,
strict_parsing: int = ...,
limit: Optional[int] = ...,
limit: int | None = ...,
encoding: str = ...,
errors: str = ...,
max_num_fields: Optional[int] = ...,
max_num_fields: int | None = ...,
separator: str = ...,
) -> None: ...
def __enter__(self: _T) -> _T: ...
+8 -10
View File
@@ -8,10 +8,10 @@ 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: ...
@@ -19,15 +19,13 @@ class Hook: # undocumented
def __init__(
self,
display: int = ...,
logdir: Optional[StrOrBytesPath] = ...,
logdir: StrOrBytesPath | None = ...,
context: int = ...,
file: Optional[IO[str]] = ...,
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[StrOrBytesPath] = ..., context: int = ..., format: str = ...) -> None: ...
def handler(info: _ExcInfo | None = ...) -> None: ...
def enable(display: int = ..., logdir: StrOrBytesPath | None = ..., context: int = ..., format: str = ...) -> None: ...
+11 -11
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: ...
+33 -43
View File
@@ -11,13 +11,11 @@ from typing import (
Iterable,
Iterator,
List,
Optional,
Protocol,
TextIO,
Tuple,
Type,
TypeVar,
Union,
overload,
)
from typing_extensions import Literal
@@ -80,8 +78,8 @@ def decode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = .
@overload
def decode(obj: bytes, encoding: str = ..., errors: str = ...) -> str: ...
def lookup(__encoding: str) -> CodecInfo: ...
def utf_16_be_decode(__data: bytes, __errors: Optional[str] = ..., __final: bool = ...) -> Tuple[str, int]: ... # undocumented
def utf_16_be_encode(__str: str, __errors: Optional[str] = ...) -> Tuple[bytes, int]: ... # undocumented
def utf_16_be_decode(__data: bytes, __errors: str | None = ..., __final: bool = ...) -> Tuple[str, int]: ... # undocumented
def utf_16_be_encode(__str: str, __errors: str | None = ...) -> Tuple[bytes, int]: ... # undocumented
class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
@property
@@ -101,13 +99,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: ...
@@ -116,16 +114,16 @@ 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[bytes], data_encoding: str, file_encoding: Optional[str] = ..., errors: str = ...) -> StreamRecoder: ...
def EncodedFile(file: IO[bytes], data_encoding: str, file_encoding: str | None = ..., errors: str = ...) -> StreamRecoder: ...
def iterencode(iterator: Iterable[str], encoding: str, errors: str = ...) -> Generator[bytes, None, None]: ...
def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = ...) -> Generator[str, None, None]: ...
if sys.version_info >= (3, 10):
def unregister(__search_function: Callable[[str], Optional[CodecInfo]]) -> None: ...
def unregister(__search_function: Callable[[str], CodecInfo | None]) -> None: ...
BOM: bytes
BOM_BE: bytes
@@ -141,13 +139,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.
@@ -162,8 +160,8 @@ class IncrementalEncoder:
def encode(self, input: str, final: bool = ...) -> bytes: ...
def reset(self) -> None: ...
# documentation says int but str is needed for the subclass.
def getstate(self) -> Union[int, str]: ...
def setstate(self, state: Union[int, str]) -> None: ...
def getstate(self) -> int | str: ...
def setstate(self, state: int | str) -> None: ...
class IncrementalDecoder:
errors: str
@@ -198,22 +196,18 @@ class StreamWriter(Codec):
def writelines(self, list: Iterable[str]) -> None: ...
def reset(self) -> None: ...
def __enter__(self: Self) -> Self: ...
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: ...
class StreamReader(Codec):
errors: str
def __init__(self, stream: IO[bytes], errors: str = ...) -> None: ...
def read(self, size: int = ..., chars: int = ..., firstline: bool = ...) -> str: ...
def readline(self, size: Optional[int] = ..., keepends: bool = ...) -> str: ...
def readlines(self, sizehint: Optional[int] = ..., keepends: bool = ...) -> List[str]: ...
def readline(self, size: int | None = ..., keepends: bool = ...) -> str: ...
def readlines(self, sizehint: int | None = ..., keepends: bool = ...) -> List[str]: ...
def reset(self) -> None: ...
def __enter__(self: Self) -> Self: ...
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[str]: ...
def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ...
@@ -224,8 +218,8 @@ _T = TypeVar("_T", bound=StreamReaderWriter)
class StreamReaderWriter(TextIO):
def __init__(self, stream: IO[bytes], Reader: _StreamReader, Writer: _StreamWriter, errors: str = ...) -> None: ...
def read(self, size: int = ...) -> str: ...
def readline(self, size: Optional[int] = ...) -> str: ...
def readlines(self, sizehint: Optional[int] = ...) -> List[str]: ...
def readline(self, size: int | None = ...) -> str: ...
def readlines(self, sizehint: int | None = ...) -> List[str]: ...
def __next__(self) -> str: ...
def __iter__(self: _T) -> _T: ...
# This actually returns None, but that's incompatible with the supertype
@@ -235,9 +229,7 @@ class StreamReaderWriter(TextIO):
# Same as write()
def seek(self, offset: int, whence: int = ...) -> int: ...
def __enter__(self: Self) -> Self: ...
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__.
@@ -246,7 +238,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: ...
@@ -264,8 +256,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: ...
@@ -273,9 +265,7 @@ class StreamRecoder(BinaryIO):
def reset(self) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def __enter__(self: Self) -> Self: ...
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: ...
@@ -284,7 +274,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: ...
+2 -3
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: ...
+45 -54
View File
@@ -1,6 +1,6 @@
import sys
from _typeshed import Self
from typing import Any, Dict, Generic, List, NoReturn, Optional, Tuple, Type, TypeVar, Union, overload
from typing import Any, Dict, Generic, List, NoReturn, Tuple, Type, TypeVar, overload
if sys.version_info >= (3, 10):
from typing import (
@@ -28,26 +28,21 @@ _VT = TypeVar("_VT")
if sys.version_info >= (3, 7):
def namedtuple(
typename: str,
field_names: Union[str, Iterable[str]],
field_names: str | Iterable[str],
*,
rename: bool = ...,
module: Optional[str] = ...,
defaults: Optional[Iterable[Any]] = ...,
module: str | None = ...,
defaults: Iterable[Any] | None = ...,
) -> Type[Tuple[Any, ...]]: ...
else:
def namedtuple(
typename: str,
field_names: Union[str, Iterable[str]],
*,
verbose: bool = ...,
rename: bool = ...,
module: Optional[str] = ...,
typename: str, field_names: str | Iterable[str], *, verbose: bool = ..., rename: bool = ..., module: str | None = ...
) -> Type[Tuple[Any, ...]]: ...
class UserDict(MutableMapping[_KT, _VT]):
data: Dict[_KT, _VT]
def __init__(self, __dict: Optional[Mapping[_KT, _VT]] = ..., **kwargs: _VT) -> None: ...
def __init__(self, __dict: Mapping[_KT, _VT] | None = ..., **kwargs: _VT) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, key: _KT) -> _VT: ...
def __setitem__(self, key: _KT, item: _VT) -> None: ...
@@ -56,11 +51,11 @@ class UserDict(MutableMapping[_KT, _VT]):
def __contains__(self, key: object) -> bool: ...
def copy(self: _S) -> _S: ...
@classmethod
def fromkeys(cls: Type[_S], iterable: Iterable[_KT], value: Optional[_VT] = ...) -> _S: ...
def fromkeys(cls: Type[_S], iterable: Iterable[_KT], value: _VT | None = ...) -> _S: ...
class UserList(MutableSequence[_T]):
data: List[_T]
def __init__(self, initlist: Optional[Iterable[_T]] = ...) -> None: ...
def __init__(self, initlist: Iterable[_T] | None = ...) -> None: ...
def __lt__(self, other: object) -> bool: ...
def __le__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
@@ -75,7 +70,7 @@ class UserList(MutableSequence[_T]):
def __setitem__(self, i: int, o: _T) -> None: ...
@overload
def __setitem__(self, i: slice, o: Iterable[_T]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __delitem__(self, i: int | slice) -> None: ...
def __add__(self: _S, other: Iterable[_T]) -> _S: ...
def __iadd__(self: _S, other: Iterable[_T]) -> _S: ...
def __mul__(self: _S, n: int) -> _S: ...
@@ -101,28 +96,28 @@ class UserString(Sequence[str]):
def __float__(self) -> float: ...
def __complex__(self) -> complex: ...
def __getnewargs__(self) -> Tuple[str]: ...
def __lt__(self, string: Union[str, UserString]) -> bool: ...
def __le__(self, string: Union[str, UserString]) -> bool: ...
def __gt__(self, string: Union[str, UserString]) -> bool: ...
def __ge__(self, string: Union[str, UserString]) -> bool: ...
def __lt__(self, string: str | UserString) -> bool: ...
def __le__(self, string: str | UserString) -> bool: ...
def __gt__(self, string: str | UserString) -> bool: ...
def __ge__(self, string: str | UserString) -> bool: ...
def __contains__(self, char: object) -> bool: ...
def __len__(self) -> int: ...
# It should return a str to implement Sequence correctly, but it doesn't.
def __getitem__(self: _UserStringT, i: Union[int, slice]) -> _UserStringT: ... # type: ignore
def __getitem__(self: _UserStringT, i: int | slice) -> _UserStringT: ... # type: ignore
def __add__(self: _UserStringT, other: object) -> _UserStringT: ...
def __mul__(self: _UserStringT, n: int) -> _UserStringT: ...
def __mod__(self: _UserStringT, args: Any) -> _UserStringT: ...
def capitalize(self: _UserStringT) -> _UserStringT: ...
def casefold(self: _UserStringT) -> _UserStringT: ...
def center(self: _UserStringT, width: int, *args: Any) -> _UserStringT: ...
def count(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ...
def count(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ...
if sys.version_info >= (3, 8):
def encode(self: UserString, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> bytes: ...
def encode(self: UserString, encoding: str | None = ..., errors: str | None = ...) -> bytes: ...
else:
def encode(self: _UserStringT, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UserStringT: ...
def endswith(self, suffix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ...
def encode(self: _UserStringT, encoding: str | None = ..., errors: str | None = ...) -> _UserStringT: ...
def endswith(self, suffix: str | Tuple[str, ...], start: int | None = ..., end: int | None = ...) -> bool: ...
def expandtabs(self: _UserStringT, tabsize: int = ...) -> _UserStringT: ...
def find(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ...
def find(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ...
def format(self, *args: Any, **kwds: Any) -> str: ...
def format_map(self, mapping: Mapping[str, Any]) -> str: ...
def index(self, sub: str, start: int = ..., end: int = ...) -> int: ...
@@ -140,30 +135,28 @@ class UserString(Sequence[str]):
def join(self, seq: Iterable[str]) -> str: ...
def ljust(self: _UserStringT, width: int, *args: Any) -> _UserStringT: ...
def lower(self: _UserStringT) -> _UserStringT: ...
def lstrip(self: _UserStringT, chars: Optional[str] = ...) -> _UserStringT: ...
def lstrip(self: _UserStringT, chars: str | None = ...) -> _UserStringT: ...
@staticmethod
@overload
def maketrans(x: Union[Dict[int, _T], Dict[str, _T], Dict[Union[str, int], _T]]) -> Dict[int, _T]: ...
def maketrans(x: Dict[int, _T] | Dict[str, _T] | Dict[str | int, _T]) -> Dict[int, _T]: ...
@staticmethod
@overload
def maketrans(x: str, y: str, z: str = ...) -> Dict[int, Union[int, None]]: ...
def maketrans(x: str, y: str, z: str = ...) -> Dict[int, int | None]: ...
def partition(self, sep: str) -> Tuple[str, str, str]: ...
if sys.version_info >= (3, 9):
def removeprefix(self: _UserStringT, __prefix: Union[str, UserString]) -> _UserStringT: ...
def removesuffix(self: _UserStringT, __suffix: Union[str, UserString]) -> _UserStringT: ...
def replace(
self: _UserStringT, old: Union[str, UserString], new: Union[str, UserString], maxsplit: int = ...
) -> _UserStringT: ...
def rfind(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ...
def rindex(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ...
def removeprefix(self: _UserStringT, __prefix: str | UserString) -> _UserStringT: ...
def removesuffix(self: _UserStringT, __suffix: str | UserString) -> _UserStringT: ...
def replace(self: _UserStringT, old: str | UserString, new: str | UserString, maxsplit: int = ...) -> _UserStringT: ...
def rfind(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ...
def rindex(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ...
def rjust(self: _UserStringT, width: int, *args: Any) -> _UserStringT: ...
def rpartition(self, sep: str) -> Tuple[str, str, str]: ...
def rstrip(self: _UserStringT, chars: Optional[str] = ...) -> _UserStringT: ...
def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
def rstrip(self: _UserStringT, chars: str | None = ...) -> _UserStringT: ...
def split(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ...
def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> List[str]: ...
def splitlines(self, keepends: bool = ...) -> List[str]: ...
def startswith(self, prefix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ...
def strip(self: _UserStringT, chars: Optional[str] = ...) -> _UserStringT: ...
def startswith(self, prefix: str | Tuple[str, ...], start: int | None = ..., end: int | None = ...) -> bool: ...
def strip(self: _UserStringT, chars: str | None = ...) -> _UserStringT: ...
def swapcase(self: _UserStringT) -> _UserStringT: ...
def title(self: _UserStringT) -> _UserStringT: ...
def translate(self: _UserStringT, *args: Any) -> _UserStringT: ...
@@ -172,8 +165,8 @@ class UserString(Sequence[str]):
class deque(MutableSequence[_T], Generic[_T]):
@property
def maxlen(self) -> Optional[int]: ...
def __init__(self, iterable: Iterable[_T] = ..., maxlen: Optional[int] = ...) -> None: ...
def maxlen(self) -> int | None: ...
def __init__(self, iterable: Iterable[_T] = ..., maxlen: int | None = ...) -> None: ...
def append(self, x: _T) -> None: ...
def appendleft(self, x: _T) -> None: ...
def clear(self) -> None: ...
@@ -221,9 +214,9 @@ 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]]: ...
@classmethod
def fromkeys(cls, iterable: Any, v: Optional[int] = ...) -> NoReturn: ... # type: ignore
def fromkeys(cls, iterable: Any, v: int | None = ...) -> NoReturn: ... # type: ignore
@overload
def subtract(self, __iterable: None = ...) -> None: ...
@overload
@@ -238,7 +231,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, __m: None = ..., **kwargs: int) -> None: ...
def __add__(self, other: Counter[_T]) -> Counter[_T]: ...
@@ -271,23 +264,21 @@ class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
def values(self) -> _OrderedDictValuesView[_VT]: ...
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
default_factory: Optional[Callable[[], _VT]]
default_factory: Callable[[], _VT] | None
@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: ...
# TODO __reversed__
def copy(self: _S) -> _S: ...
@@ -295,7 +286,7 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
maps: List[Mapping[_KT, _VT]]
def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ...
def new_child(self, m: Optional[Mapping[_KT, _VT]] = ...) -> ChainMap[_KT, _VT]: ...
def new_child(self, m: Mapping[_KT, _VT] | None = ...) -> ChainMap[_KT, _VT]: ...
@property
def parents(self) -> ChainMap[_KT, _VT]: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...
+25 -25
View File
@@ -1,6 +1,6 @@
import sys
from _typeshed import StrPath
from typing import Any, Optional, Protocol
from typing import Any, Protocol
if sys.version_info >= (3, 7):
from py_compile import PycInvalidationMode
@@ -11,34 +11,34 @@ class _SupportsSearch(Protocol):
if sys.version_info >= (3, 9):
def compile_dir(
dir: StrPath,
maxlevels: Optional[int] = ...,
ddir: Optional[StrPath] = ...,
maxlevels: int | None = ...,
ddir: StrPath | None = ...,
force: bool = ...,
rx: Optional[_SupportsSearch] = ...,
rx: _SupportsSearch | None = ...,
quiet: int = ...,
legacy: bool = ...,
optimize: int = ...,
workers: int = ...,
invalidation_mode: Optional[PycInvalidationMode] = ...,
invalidation_mode: PycInvalidationMode | None = ...,
*,
stripdir: Optional[str] = ..., # TODO: change to Optional[StrPath] once https://bugs.python.org/issue40447 is resolved
prependdir: Optional[StrPath] = ...,
limit_sl_dest: Optional[StrPath] = ...,
stripdir: str | None = ..., # TODO: change to StrPath | None once https://bugs.python.org/issue40447 is resolved
prependdir: StrPath | None = ...,
limit_sl_dest: StrPath | None = ...,
hardlink_dupes: bool = ...,
) -> int: ...
def compile_file(
fullname: StrPath,
ddir: Optional[StrPath] = ...,
ddir: StrPath | None = ...,
force: bool = ...,
rx: Optional[_SupportsSearch] = ...,
rx: _SupportsSearch | None = ...,
quiet: int = ...,
legacy: bool = ...,
optimize: int = ...,
invalidation_mode: Optional[PycInvalidationMode] = ...,
invalidation_mode: PycInvalidationMode | None = ...,
*,
stripdir: Optional[str] = ..., # TODO: change to Optional[StrPath] once https://bugs.python.org/issue40447 is resolved
prependdir: Optional[StrPath] = ...,
limit_sl_dest: Optional[StrPath] = ...,
stripdir: str | None = ..., # TODO: change to StrPath | None once https://bugs.python.org/issue40447 is resolved
prependdir: StrPath | None = ...,
limit_sl_dest: StrPath | None = ...,
hardlink_dupes: bool = ...,
) -> int: ...
@@ -46,33 +46,33 @@ elif sys.version_info >= (3, 7):
def compile_dir(
dir: StrPath,
maxlevels: int = ...,
ddir: Optional[StrPath] = ...,
ddir: StrPath | None = ...,
force: bool = ...,
rx: Optional[_SupportsSearch] = ...,
rx: _SupportsSearch | None = ...,
quiet: int = ...,
legacy: bool = ...,
optimize: int = ...,
workers: int = ...,
invalidation_mode: Optional[PycInvalidationMode] = ...,
invalidation_mode: PycInvalidationMode | None = ...,
) -> int: ...
def compile_file(
fullname: StrPath,
ddir: Optional[StrPath] = ...,
ddir: StrPath | None = ...,
force: bool = ...,
rx: Optional[_SupportsSearch] = ...,
rx: _SupportsSearch | None = ...,
quiet: int = ...,
legacy: bool = ...,
optimize: int = ...,
invalidation_mode: Optional[PycInvalidationMode] = ...,
invalidation_mode: PycInvalidationMode | None = ...,
) -> int: ...
else:
def compile_dir(
dir: StrPath,
maxlevels: int = ...,
ddir: Optional[StrPath] = ...,
ddir: StrPath | None = ...,
force: bool = ...,
rx: Optional[_SupportsSearch] = ...,
rx: _SupportsSearch | None = ...,
quiet: int = ...,
legacy: bool = ...,
optimize: int = ...,
@@ -80,9 +80,9 @@ else:
) -> int: ...
def compile_file(
fullname: StrPath,
ddir: Optional[StrPath] = ...,
ddir: StrPath | None = ...,
force: bool = ...,
rx: Optional[_SupportsSearch] = ...,
rx: _SupportsSearch | None = ...,
quiet: int = ...,
legacy: bool = ...,
optimize: int = ...,
@@ -96,7 +96,7 @@ if sys.version_info >= (3, 7):
quiet: int = ...,
legacy: bool = ...,
optimize: int = ...,
invalidation_mode: Optional[PycInvalidationMode] = ...,
invalidation_mode: PycInvalidationMode | None = ...,
) -> int: ...
else:
+8 -22
View File
@@ -3,21 +3,7 @@ import threading
from _typeshed import Self
from abc import abstractmethod
from logging import Logger
from typing import (
Any,
Callable,
Container,
Generic,
Iterable,
Iterator,
List,
Optional,
Protocol,
Sequence,
Set,
TypeVar,
overload,
)
from typing import Any, Callable, Container, Generic, Iterable, Iterator, List, Protocol, Sequence, Set, TypeVar, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -60,11 +46,11 @@ class Future(Generic[_T]):
def running(self) -> bool: ...
def done(self) -> bool: ...
def add_done_callback(self, fn: Callable[[Future[_T]], Any]) -> None: ...
def result(self, timeout: Optional[float] = ...) -> _T: ...
def result(self, timeout: float | None = ...) -> _T: ...
def set_running_or_notify_cancel(self) -> bool: ...
def set_result(self, result: _T) -> None: ...
def exception(self, timeout: Optional[float] = ...) -> Optional[BaseException]: ...
def set_exception(self, exception: Optional[BaseException]) -> None: ...
def exception(self, timeout: float | None = ...) -> BaseException | None: ...
def set_exception(self, exception: BaseException | None) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
@@ -74,16 +60,16 @@ class Executor:
else:
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
def map(
self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...
self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: float | None = ..., chunksize: int = ...
) -> Iterator[_T]: ...
if sys.version_info >= (3, 9):
def shutdown(self, wait: bool = ..., *, cancel_futures: bool = ...) -> None: ...
else:
def shutdown(self, wait: bool = ...) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Optional[bool]: ...
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool | None: ...
def as_completed(fs: Iterable[Future[_T]], timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ...
def as_completed(fs: Iterable[Future[_T]], timeout: float | None = ...) -> Iterator[Future[_T]]: ...
# Ideally this would be a namedtuple, but mypy doesn't support generic tuple types. See #1976
class DoneAndNotDoneFutures(Sequence[Set[Future[_T]]]):
@@ -96,7 +82,7 @@ class DoneAndNotDoneFutures(Sequence[Set[Future[_T]]]):
@overload
def __getitem__(self, s: slice) -> DoneAndNotDoneFutures[_T]: ...
def wait(fs: Iterable[Future[_T]], timeout: Optional[float] = ..., return_when: str = ...) -> DoneAndNotDoneFutures[_T]: ...
def wait(fs: Iterable[Future[_T]], timeout: float | None = ..., return_when: str = ...) -> DoneAndNotDoneFutures[_T]: ...
class _Waiter:
event: threading.Event
+5 -5
View File
@@ -1,5 +1,5 @@
import sys
from typing import Any, Callable, Optional, Tuple
from typing import Any, Callable, Tuple
from ._base import Executor
@@ -17,12 +17,12 @@ if sys.version_info >= (3, 7):
class ProcessPoolExecutor(Executor):
def __init__(
self,
max_workers: Optional[int] = ...,
mp_context: Optional[BaseContext] = ...,
initializer: Optional[Callable[..., None]] = ...,
max_workers: int | None = ...,
mp_context: BaseContext | None = ...,
initializer: Callable[..., None] | None = ...,
initargs: Tuple[Any, ...] = ...,
) -> None: ...
else:
class ProcessPoolExecutor(Executor):
def __init__(self, max_workers: Optional[int] = ...) -> None: ...
def __init__(self, max_workers: int | None = ...) -> None: ...
+4 -4
View File
@@ -1,6 +1,6 @@
import queue
import sys
from typing import Any, Callable, Generic, Iterable, Mapping, Optional, Tuple, TypeVar
from typing import Any, Callable, Generic, Iterable, Mapping, Tuple, TypeVar
from ._base import Executor, Future
@@ -21,13 +21,13 @@ class ThreadPoolExecutor(Executor):
if sys.version_info >= (3, 7):
def __init__(
self,
max_workers: Optional[int] = ...,
max_workers: int | None = ...,
thread_name_prefix: str = ...,
initializer: Optional[Callable[..., None]] = ...,
initializer: Callable[..., None] | None = ...,
initargs: Tuple[Any, ...] = ...,
) -> None: ...
else:
def __init__(self, max_workers: Optional[int] = ..., thread_name_prefix: str = ...) -> None: ...
def __init__(self, max_workers: int | None = ..., thread_name_prefix: str = ...) -> None: ...
class _WorkItem(Generic[_S]):
future: Future[_S]
+3 -9
View File
@@ -60,7 +60,7 @@ if sys.version_info >= (3, 10):
class suppress(ContextManager[None]):
def __init__(self, *exceptions: Type[BaseException]) -> None: ...
def __exit__(
self, exctype: Optional[Type[BaseException]], excinst: Optional[BaseException], exctb: Optional[TracebackType]
self, exctype: Type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None
) -> bool: ...
class redirect_stdout(ContextManager[_T_io]):
@@ -81,10 +81,7 @@ class ExitStack(ContextManager[ExitStack]):
def close(self) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self,
__exc_type: Optional[Type[BaseException]],
__exc_value: Optional[BaseException],
__traceback: Optional[TracebackType],
self, __exc_type: Type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None
) -> bool: ...
if sys.version_info >= (3, 7):
@@ -103,10 +100,7 @@ if sys.version_info >= (3, 7):
def aclose(self) -> Awaitable[None]: ...
def __aenter__(self: Self) -> Awaitable[Self]: ...
def __aexit__(
self,
__exc_type: Optional[Type[BaseException]],
__exc_value: Optional[BaseException],
__traceback: Optional[TracebackType],
self, __exc_type: Type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None
) -> Awaitable[bool]: ...
if sys.version_info >= (3, 10):
+4 -4
View File
@@ -1,5 +1,5 @@
import sys
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, Optional, TypeVar, Union, overload
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -14,7 +14,7 @@ class ContextVar(Generic[_T]):
@overload
def get(self) -> _T: ...
@overload
def get(self, default: Union[_D, _T]) -> Union[_D, _T]: ...
def get(self, default: _D | _T) -> _D | _T: ...
def set(self, value: _T) -> Token[_T]: ...
def reset(self, token: Token[_T]) -> None: ...
if sys.version_info >= (3, 9):
@@ -36,9 +36,9 @@ def copy_context() -> Context: ...
class Context(Mapping[ContextVar[Any], Any]):
def __init__(self) -> None: ...
@overload
def get(self, __key: ContextVar[Any]) -> Optional[Any]: ...
def get(self, __key: ContextVar[Any]) -> Any | None: ...
@overload
def get(self, __key: ContextVar[Any], __default: Optional[Any]) -> Any: ...
def get(self, __key: ContextVar[Any], __default: Any | None) -> Any: ...
def run(self, callable: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ...
def copy(self) -> Context: ...
def __getitem__(self, key: ContextVar[Any]) -> Any: ...
+2 -2
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): ...
+2 -2
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: ...
+4 -4
View File
@@ -1,5 +1,5 @@
import sys
from typing import List, Optional, Union
from typing import List
class _Method: ...
@@ -13,9 +13,9 @@ if sys.version_info >= (3, 7):
methods: List[_Method]
if sys.version_info >= (3, 7):
def mksalt(method: Optional[_Method] = ..., *, rounds: Optional[int] = ...) -> str: ...
def mksalt(method: _Method | None = ..., *, rounds: int | None = ...) -> str: ...
else:
def mksalt(method: Optional[_Method] = ...) -> str: ...
def mksalt(method: _Method | None = ...) -> str: ...
def crypt(word: str, salt: Optional[Union[str, _Method]] = ...) -> str: ...
def crypt(word: str, salt: str | _Method | None = ...) -> str: ...
+12 -12
View File
@@ -17,7 +17,7 @@ from _csv import (
unregister_dialect as unregister_dialect,
writer as writer,
)
from typing import Any, Generic, Iterable, Iterator, List, Mapping, Optional, Sequence, Type, TypeVar, overload
from typing import Any, Generic, Iterable, Iterator, List, Mapping, Sequence, Type, TypeVar, overload
if sys.version_info >= (3, 8):
from typing import Dict as _DictReadMapping
@@ -46,9 +46,9 @@ class unix_dialect(Dialect):
quoting: int
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 +57,8 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
self,
f: Iterable[str],
fieldnames: Sequence[_T],
restkey: Optional[str] = ...,
restval: Optional[str] = ...,
restkey: str | None = ...,
restval: str | None = ...,
dialect: _DialectLike = ...,
*args: Any,
**kwds: Any,
@@ -67,9 +67,9 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T, str]]):
def __init__(
self: DictReader[str],
f: Iterable[str],
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 +79,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,
@@ -102,5 +102,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: ...
+2 -3
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: ...
+17 -17
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: ...
+3 -3
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: ...
+20 -20
View File
@@ -1,5 +1,5 @@
import sys
from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar, Union, overload
from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Tuple, Type, TypeVar, overload
from typing_extensions import Protocol
if sys.version_info >= (3, 9):
@@ -74,7 +74,7 @@ class Field(Generic[_T]):
default: _T
default_factory: _DefaultFactory[_T]
repr: bool
hash: Optional[bool]
hash: bool | None
init: bool
compare: bool
metadata: Mapping[str, Any]
@@ -86,7 +86,7 @@ class Field(Generic[_T]):
default_factory: Callable[[], _T],
init: bool,
repr: bool,
hash: Optional[bool],
hash: bool | None,
compare: bool,
metadata: Mapping[str, Any],
kw_only: bool,
@@ -98,7 +98,7 @@ class Field(Generic[_T]):
default_factory: Callable[[], _T],
init: bool,
repr: bool,
hash: Optional[bool],
hash: bool | None,
compare: bool,
metadata: Mapping[str, Any],
) -> None: ...
@@ -114,9 +114,9 @@ if sys.version_info >= (3, 10):
default: _T,
init: bool = ...,
repr: bool = ...,
hash: Optional[bool] = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Optional[Mapping[str, Any]] = ...,
metadata: Mapping[str, Any] | None = ...,
kw_only: bool = ...,
) -> _T: ...
@overload
@@ -125,9 +125,9 @@ if sys.version_info >= (3, 10):
default_factory: Callable[[], _T],
init: bool = ...,
repr: bool = ...,
hash: Optional[bool] = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Optional[Mapping[str, Any]] = ...,
metadata: Mapping[str, Any] | None = ...,
kw_only: bool = ...,
) -> _T: ...
@overload
@@ -135,9 +135,9 @@ if sys.version_info >= (3, 10):
*,
init: bool = ...,
repr: bool = ...,
hash: Optional[bool] = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Optional[Mapping[str, Any]] = ...,
metadata: Mapping[str, Any] | None = ...,
kw_only: bool = ...,
) -> Any: ...
@@ -148,9 +148,9 @@ else:
default: _T,
init: bool = ...,
repr: bool = ...,
hash: Optional[bool] = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Optional[Mapping[str, Any]] = ...,
metadata: Mapping[str, Any] | None = ...,
) -> _T: ...
@overload
def field(
@@ -158,18 +158,18 @@ else:
default_factory: Callable[[], _T],
init: bool = ...,
repr: bool = ...,
hash: Optional[bool] = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Optional[Mapping[str, Any]] = ...,
metadata: Mapping[str, Any] | None = ...,
) -> _T: ...
@overload
def field(
*,
init: bool = ...,
repr: bool = ...,
hash: Optional[bool] = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Optional[Mapping[str, Any]] = ...,
metadata: Mapping[str, Any] | None = ...,
) -> Any: ...
def fields(class_or_instance: Any) -> Tuple[Field[Any], ...]: ...
@@ -189,10 +189,10 @@ class InitVar(Generic[_T]):
if sys.version_info >= (3, 10):
def make_dataclass(
cls_name: str,
fields: Iterable[Union[str, Tuple[str, type], Tuple[str, type, Field[Any]]]],
fields: Iterable[str | Tuple[str, type] | Tuple[str, type, Field[Any]]],
*,
bases: Tuple[type, ...] = ...,
namespace: Optional[Dict[str, Any]] = ...,
namespace: Dict[str, Any] | None = ...,
init: bool = ...,
repr: bool = ...,
eq: bool = ...,
@@ -206,10 +206,10 @@ if sys.version_info >= (3, 10):
else:
def make_dataclass(
cls_name: str,
fields: Iterable[Union[str, Tuple[str, type], Tuple[str, type, Field[Any]]]],
fields: Iterable[str | Tuple[str, type] | Tuple[str, type, Field[Any]]],
*,
bases: Tuple[type, ...] = ...,
namespace: Optional[Dict[str, Any]] = ...,
namespace: Dict[str, Any] | None = ...,
init: bool = ...,
repr: bool = ...,
eq: bool = ...,
+21 -21
View File
@@ -1,6 +1,6 @@
import sys
from time import struct_time
from typing import ClassVar, NamedTuple, Optional, SupportsAbs, Tuple, Type, TypeVar, overload
from typing import ClassVar, NamedTuple, SupportsAbs, Tuple, Type, TypeVar, overload
_S = TypeVar("_S")
@@ -8,9 +8,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: ...
# Alias required to avoid name conflicts with date(time).tzinfo.
@@ -91,7 +91,7 @@ class time:
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
tzinfo: _tzinfo | None = ...,
*,
fold: int = ...,
) -> _S: ...
@@ -104,7 +104,7 @@ class time:
@property
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> Optional[_tzinfo]: ...
def tzinfo(self) -> _tzinfo | None: ...
@property
def fold(self) -> int: ...
def __le__(self, other: time) -> bool: ...
@@ -118,16 +118,16 @@ class time:
def fromisoformat(cls: Type[_S], time_string: str) -> _S: ...
def strftime(self, fmt: str) -> str: ...
def __format__(self, fmt: str) -> str: ...
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] = ...,
tzinfo: _tzinfo | None = ...,
*,
fold: int = ...,
) -> time: ...
@@ -195,7 +195,7 @@ class datetime(date):
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
tzinfo: _tzinfo | None = ...,
*,
fold: int = ...,
) -> _S: ...
@@ -214,11 +214,11 @@ class datetime(date):
@property
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> Optional[_tzinfo]: ...
def tzinfo(self) -> _tzinfo | None: ...
@property
def fold(self) -> int: ...
@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
@@ -227,7 +227,7 @@ class datetime(date):
def fromordinal(cls: Type[_S], n: int) -> _S: ...
if sys.version_info >= (3, 8):
@classmethod
def now(cls: Type[_S], tz: Optional[_tzinfo] = ...) -> _S: ...
def now(cls: Type[_S], tz: _tzinfo | None = ...) -> _S: ...
else:
@overload
@classmethod
@@ -238,7 +238,7 @@ class datetime(date):
@classmethod
def utcnow(cls: Type[_S]) -> _S: ...
@classmethod
def combine(cls, date: _date, time: _time, tzinfo: Optional[_tzinfo] = ...) -> datetime: ...
def combine(cls, date: _date, time: _time, tzinfo: _tzinfo | None = ...) -> datetime: ...
if sys.version_info >= (3, 7):
@classmethod
def fromisoformat(cls: Type[_S], date_string: str) -> _S: ...
@@ -260,21 +260,21 @@ class datetime(date):
minute: int = ...,
second: int = ...,
microsecond: int = ...,
tzinfo: Optional[_tzinfo] = ...,
tzinfo: _tzinfo | None = ...,
*,
fold: int = ...,
) -> datetime: ...
if sys.version_info >= (3, 8):
def astimezone(self: _S, tz: Optional[_tzinfo] = ...) -> _S: ...
def astimezone(self: _S, tz: _tzinfo | None = ...) -> _S: ...
else:
def astimezone(self, tz: Optional[_tzinfo] = ...) -> datetime: ...
def astimezone(self, tz: _tzinfo | None = ...) -> datetime: ...
def ctime(self) -> str: ...
def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
@classmethod
def strptime(cls, date_string: str, format: str) -> 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
+2 -2
View File
@@ -1,6 +1,6 @@
from _typeshed import Self
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]
@@ -82,7 +82,7 @@ class _Database(MutableMapping[_KeyType, bytes]):
def __del__(self) -> None: ...
def __enter__(self: Self) -> Self: ...
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): ...
+2 -2
View File
@@ -1,6 +1,6 @@
from _typeshed import Self
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]
@@ -20,7 +20,7 @@ class _Database(MutableMapping[_KeyType, bytes]):
def __del__(self) -> None: ...
def __enter__(self: Self) -> Self: ...
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: ...
+6 -6
View File
@@ -1,6 +1,6 @@
from _typeshed import Self
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]
@@ -10,8 +10,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: ...
@@ -22,12 +22,12 @@ class _gdbm:
def __len__(self) -> int: ...
def __enter__(self: Self) -> Self: ...
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
+4 -4
View File
@@ -1,6 +1,6 @@
from _typeshed import Self
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]
@@ -20,12 +20,12 @@ class _dbm:
def __del__(self) -> None: ...
def __enter__(self: Self) -> Self: ...
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
+53 -53
View File
@@ -1,6 +1,6 @@
import numbers
from types import TracebackType
from typing import Any, Container, Dict, List, NamedTuple, Optional, Sequence, Tuple, Type, TypeVar, Union, overload
from typing import Any, Container, Dict, List, NamedTuple, Sequence, Tuple, Type, TypeVar, Union, overload
_Decimal = Union[Decimal, int]
_DecimalNew = Union[Decimal, float, str, Tuple[int, Sequence[int], int]]
@@ -44,18 +44,18 @@ class FloatOperation(DecimalException, TypeError): ...
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 __bool__(self) -> bool: ...
def compare(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def compare(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __hash__(self) -> int: ...
def as_tuple(self) -> DecimalTuple: ...
def as_integer_ratio(self) -> Tuple[int, int]: ...
def to_eng_string(self, context: Optional[Context] = ...) -> str: ...
def to_eng_string(self, context: Context | None = ...) -> str: ...
def __abs__(self) -> Decimal: ...
def __add__(self, other: _Decimal) -> Decimal: ...
def __divmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ...
@@ -69,7 +69,7 @@ class Decimal(object):
def __mul__(self, other: _Decimal) -> Decimal: ...
def __neg__(self) -> Decimal: ...
def __pos__(self) -> Decimal: ...
def __pow__(self, other: _Decimal, modulo: Optional[_Decimal] = ...) -> Decimal: ...
def __pow__(self, other: _Decimal, modulo: _Decimal | None = ...) -> Decimal: ...
def __radd__(self, other: _Decimal) -> Decimal: ...
def __rdivmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ...
def __rfloordiv__(self, other: _Decimal) -> Decimal: ...
@@ -80,7 +80,7 @@ class Decimal(object):
def __str__(self) -> str: ...
def __sub__(self, other: _Decimal) -> Decimal: ...
def __truediv__(self, other: _Decimal) -> Decimal: ...
def remainder_near(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def remainder_near(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __float__(self) -> float: ...
def __int__(self) -> int: ...
def __trunc__(self) -> int: ...
@@ -96,64 +96,64 @@ class Decimal(object):
def __round__(self, ndigits: int) -> Decimal: ...
def __floor__(self) -> int: ...
def __ceil__(self) -> int: ...
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 quantize(self, exp: _Decimal, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
def same_quantum(self, other: _Decimal, context: Optional[Context] = ...) -> 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 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: str | None = ..., context: Context | None = ...) -> Decimal: ...
def same_quantum(self, other: _Decimal, context: Context | None = ...) -> bool: ...
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) -> Decimal: ...
def compare_signal(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def compare_total(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def compare_total_mag(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def compare_signal(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def compare_total(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def compare_total_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def copy_abs(self) -> Decimal: ...
def copy_negate(self) -> Decimal: ...
def copy_sign(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def exp(self, context: Optional[Context] = ...) -> Decimal: ...
def copy_sign(self, other: _Decimal, context: Context | None = ...) -> 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]
@@ -168,15 +168,15 @@ class Context(object):
flags: Dict[_TrapType, bool]
def __init__(
self,
prec: Optional[int] = ...,
rounding: Optional[str] = ...,
Emin: Optional[int] = ...,
Emax: Optional[int] = ...,
capitals: Optional[int] = ...,
clamp: Optional[int] = ...,
flags: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
traps: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
_ignored_flags: Optional[List[_TrapType]] = ...,
prec: int | None = ...,
rounding: str | None = ...,
Emin: int | None = ...,
Emax: int | None = ...,
capitals: int | None = ...,
clamp: int | None = ...,
flags: None | Dict[_TrapType, bool] | Container[_TrapType] = ...,
traps: None | Dict[_TrapType, bool] | Container[_TrapType] = ...,
_ignored_flags: List[_TrapType] | None = ...,
) -> None: ...
# __setattr__() only allows to set a specific set of attributes,
# already defined above.
@@ -236,7 +236,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: ...
+8 -25
View File
@@ -1,20 +1,5 @@
import sys
from typing import (
Any,
AnyStr,
Callable,
Generic,
Iterable,
Iterator,
List,
NamedTuple,
Optional,
Sequence,
Tuple,
TypeVar,
Union,
overload,
)
from typing import Any, AnyStr, Callable, Generic, Iterable, Iterator, List, NamedTuple, Sequence, Tuple, TypeVar, Union, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -29,15 +14,13 @@ 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: ...
def set_seq2(self, b: Sequence[_T]) -> None: ...
if sys.version_info >= (3, 9):
def find_longest_match(
self, alo: int = ..., ahi: Optional[int] = ..., blo: int = ..., bhi: Optional[int] = ...
) -> Match: ...
def find_longest_match(self, alo: int = ..., ahi: int | None = ..., blo: int = ..., bhi: int | None = ...) -> Match: ...
else:
def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ...
def get_matching_blocks(self) -> List[Match]: ...
@@ -60,7 +43,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[str], b: Sequence[str]) -> Iterator[str]: ...
def IS_LINE_JUNK(line: str, pat: Any = ...) -> bool: ... # pat is undocumented
@@ -86,16 +69,16 @@ def context_diff(
lineterm: str = ...,
) -> Iterator[str]: ...
def ndiff(
a: Sequence[str], b: Sequence[str], linejunk: Optional[_JunkCallback] = ..., charjunk: Optional[_JunkCallback] = ...
a: Sequence[str], b: Sequence[str], linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...
) -> Iterator[str]: ...
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,
+11 -13
View File
@@ -16,7 +16,7 @@ from opcode import (
opname as opname,
stack_effect as stack_effect,
)
from typing import IO, Any, Callable, Dict, Iterator, List, NamedTuple, Optional, Tuple, Union
from typing import IO, Any, Callable, Dict, Iterator, List, NamedTuple, Tuple, Union
# Strictly this should not have to include Callable, but mypy doesn't use FunctionType
# for functions (python/mypy#3171)
@@ -26,19 +26,17 @@ _have_code_or_string = Union[_have_code, str, bytes]
class Instruction(NamedTuple):
opname: str
opcode: int
arg: Optional[int]
arg: int | None
argval: Any
argrepr: str
offset: int
starts_line: Optional[int]
starts_line: int | None
is_jump_target: bool
class Bytecode:
codeobj: types.CodeType
first_line: int
def __init__(
self, x: _have_code_or_string, *, first_line: Optional[int] = ..., current_offset: Optional[int] = ...
) -> None: ...
def __init__(self, x: _have_code_or_string, *, first_line: int | None = ..., current_offset: int | None = ...) -> None: ...
def __iter__(self) -> Iterator[Instruction]: ...
def __repr__(self) -> str: ...
def info(self) -> str: ...
@@ -54,13 +52,13 @@ def pretty_flags(flags: int) -> str: ...
def code_info(x: _have_code_or_string) -> str: ...
if sys.version_info >= (3, 7):
def dis(x: Optional[_have_code_or_string] = ..., *, file: Optional[IO[str]] = ..., depth: Optional[int] = ...) -> None: ...
def dis(x: _have_code_or_string | None = ..., *, file: IO[str] | None = ..., depth: int | None = ...) -> None: ...
else:
def dis(x: Optional[_have_code_or_string] = ..., *, file: Optional[IO[str]] = ...) -> None: ...
def dis(x: _have_code_or_string | None = ..., *, file: IO[str] | None = ...) -> None: ...
def distb(tb: Optional[types.TracebackType] = ..., *, file: Optional[IO[str]] = ...) -> None: ...
def disassemble(co: _have_code, lasti: int = ..., *, file: Optional[IO[str]] = ...) -> None: ...
def disco(co: _have_code, lasti: int = ..., *, file: Optional[IO[str]] = ...) -> None: ...
def show_code(co: _have_code, *, file: Optional[IO[str]] = ...) -> None: ...
def get_instructions(x: _have_code, *, first_line: Optional[int] = ...) -> Iterator[Instruction]: ...
def distb(tb: types.TracebackType | None = ..., *, file: IO[str] | None = ...) -> None: ...
def disassemble(co: _have_code, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ...
def disco(co: _have_code, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ...
def show_code(co: _have_code, *, file: IO[str] | None = ...) -> None: ...
def get_instructions(x: _have_code, *, first_line: int | None = ...) -> Iterator[Instruction]: ...
+7 -9
View File
@@ -1,22 +1,20 @@
from typing import Optional
def make_archive(
base_name: str,
format: str,
root_dir: Optional[str] = ...,
base_dir: Optional[str] = ...,
root_dir: str | None = ...,
base_dir: str | None = ...,
verbose: int = ...,
dry_run: int = ...,
owner: Optional[str] = ...,
group: Optional[str] = ...,
owner: str | None = ...,
group: str | None = ...,
) -> str: ...
def make_tarball(
base_name: str,
base_dir: str,
compress: Optional[str] = ...,
compress: str | None = ...,
verbose: int = ...,
dry_run: int = ...,
owner: Optional[str] = ...,
group: Optional[str] = ...,
owner: str | None = ...,
group: str | None = ...,
) -> str: ...
def make_zipfile(base_name: str, base_dir: str, verbose: int = ..., dry_run: int = ...) -> str: ...
+58 -58
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: ...
+14 -14
View File
@@ -1,9 +1,9 @@
from abc import abstractmethod
from distutils.dist import Distribution
from typing import Any, Callable, Iterable, List, Optional, Tuple, Union
from typing import Any, Callable, Iterable, List, 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: str, level: int = ...) -> None: ...
def debug_print(self, msg: str) -> 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: str, *option_pairs: Tuple[str, str]) -> None: ...
def get_finalized_command(self, command: str, create: int = ...) -> Command: ...
def reinitialize_command(self, command: Union[Command, str], reinit_subcommands: int = ...) -> Command: ...
def reinitialize_command(self, command: Command | str, reinit_subcommands: int = ...) -> Command: ...
def run_command(self, command: str) -> None: ...
def get_sub_commands(self) -> List[str]: ...
def warn(self, msg: str) -> None: ...
def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: Optional[str] = ..., level: int = ...) -> None: ...
def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: str | 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
+4 -4
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: ...
+1 -3
View File
@@ -1,3 +1 @@
from typing import Optional
DEBUG: Optional[bool]
DEBUG: bool | None
+25 -25
View File
@@ -1,26 +1,26 @@
from _typeshed import StrOrBytesPath, SupportsWrite
from distutils.cmd import Command
from typing import IO, Any, Dict, Iterable, List, Mapping, Optional, Tuple, Type, Union
from typing import IO, Any, Dict, Iterable, List, Mapping, Tuple, Type
class DistributionMetadata:
def __init__(self, path: Optional[Union[int, StrOrBytesPath]] = ...) -> None: ...
name: Optional[str]
version: Optional[str]
author: Optional[str]
author_email: Optional[str]
maintainer: Optional[str]
maintainer_email: Optional[str]
url: Optional[str]
license: Optional[str]
description: Optional[str]
long_description: Optional[str]
keywords: Optional[Union[str, List[str]]]
platforms: Optional[Union[str, List[str]]]
classifiers: Optional[Union[str, List[str]]]
download_url: Optional[str]
provides: Optional[List[str]]
requires: Optional[List[str]]
obsoletes: Optional[List[str]]
def __init__(self, path: int | StrOrBytesPath | None = ...) -> None: ...
name: str | None
version: str | None
author: str | None
author_email: str | None
maintainer: str | None
maintainer_email: str | None
url: str | None
license: str | None
description: str | None
long_description: str | None
keywords: str | List[str] | None
platforms: str | List[str] | None
classifiers: str | List[str] | None
download_url: str | None
provides: List[str] | None
requires: List[str] | None
obsoletes: List[str] | None
def read_pkg_file(self, file: IO[str]) -> None: ...
def write_pkg_info(self, base_dir: str) -> None: ...
def write_pkg_file(self, file: SupportsWrite[str]) -> None: ...
@@ -38,9 +38,9 @@ class DistributionMetadata:
def get_licence(self) -> str: ...
def get_description(self) -> str: ...
def get_long_description(self) -> str: ...
def get_keywords(self) -> Union[str, List[str]]: ...
def get_platforms(self) -> Union[str, List[str]]: ...
def get_classifiers(self) -> Union[str, List[str]]: ...
def get_keywords(self) -> str | List[str]: ...
def get_platforms(self) -> str | List[str]: ...
def get_classifiers(self) -> str | List[str]: ...
def get_download_url(self) -> str: ...
def get_requires(self) -> List[str]: ...
def set_requires(self, value: Iterable[str]) -> None: ...
@@ -52,7 +52,7 @@ class DistributionMetadata:
class Distribution:
cmdclass: Dict[str, Type[Command]]
metadata: DistributionMetadata
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, str]]: ...
def parse_config_files(self, filenames: Optional[Iterable[str]] = ...) -> None: ...
def get_command_obj(self, command: str, create: bool = ...) -> Optional[Command]: ...
def parse_config_files(self, filenames: Iterable[str] | None = ...) -> None: ...
def get_command_obj(self, command: str, create: bool = ...) -> Command | None: ...
+15 -15
View File
@@ -1,22 +1,22 @@
from typing import List, Optional, Tuple
from typing import List, Tuple
class Extension:
def __init__(
self,
name: str,
sources: List[str],
include_dirs: Optional[List[str]] = ...,
define_macros: Optional[List[Tuple[str, Optional[str]]]] = ...,
undef_macros: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
libraries: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
extra_objects: Optional[List[str]] = ...,
extra_compile_args: Optional[List[str]] = ...,
extra_link_args: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
swig_opts: Optional[str] = ..., # undocumented
depends: Optional[List[str]] = ...,
language: Optional[str] = ...,
optional: Optional[bool] = ...,
include_dirs: List[str] | None = ...,
define_macros: List[Tuple[str, str | None]] | None = ...,
undef_macros: List[str] | None = ...,
library_dirs: List[str] | None = ...,
libraries: List[str] | None = ...,
runtime_library_dirs: List[str] | None = ...,
extra_objects: List[str] | None = ...,
extra_compile_args: List[str] | None = ...,
extra_link_args: List[str] | None = ...,
export_symbols: List[str] | None = ...,
swig_opts: str | None = ..., # undocumented
depends: List[str] | None = ...,
language: str | None = ...,
optional: bool | None = ...,
) -> None: ...
+7 -7
View File
@@ -1,22 +1,22 @@
from typing import Any, Iterable, List, Mapping, Optional, Tuple, Union, overload
from typing import Any, Iterable, 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:
def __init__(self, options: Iterable[str] = ...) -> None: ...
+2 -2
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]: ...
+11 -22
View File
@@ -1,9 +1,9 @@
from typing import Iterable, List, Optional, Pattern, Union, overload
from typing import Iterable, List, Pattern, overload
from typing_extensions import Literal
# class is entirely undocumented
class FileList:
allfiles: Optional[Iterable[str]] = ...
allfiles: Iterable[str] | None = ...
files: List[str] = ...
def __init__(self, warn: None = ..., debug_print: None = ...) -> None: ...
def set_allfiles(self, allfiles: Iterable[str]) -> None: ...
@@ -16,45 +16,34 @@ class FileList:
def process_template_line(self, line: str) -> None: ...
@overload
def include_pattern(
self, pattern: str, anchor: Union[int, bool] = ..., prefix: Optional[str] = ..., is_regex: Literal[0, False] = ...
self, pattern: str, anchor: int | bool = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ...
) -> bool: ...
@overload
def include_pattern(self, pattern: Union[str, Pattern[str]], *, is_regex: Literal[True, 1] = ...) -> bool: ...
def include_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ...
@overload
def include_pattern(
self,
pattern: Union[str, Pattern[str]],
anchor: Union[int, bool] = ...,
prefix: Optional[str] = ...,
is_regex: Union[int, bool] = ...,
self, pattern: str | Pattern[str], anchor: int | bool = ..., prefix: str | None = ..., is_regex: int | bool = ...
) -> bool: ...
@overload
def exclude_pattern(
self, pattern: str, anchor: Union[int, bool] = ..., prefix: Optional[str] = ..., is_regex: Literal[0, False] = ...
self, pattern: str, anchor: int | bool = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ...
) -> bool: ...
@overload
def exclude_pattern(self, pattern: Union[str, Pattern[str]], *, is_regex: Literal[True, 1] = ...) -> bool: ...
def exclude_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ...
@overload
def exclude_pattern(
self,
pattern: Union[str, Pattern[str]],
anchor: Union[int, bool] = ...,
prefix: Optional[str] = ...,
is_regex: Union[int, bool] = ...,
self, pattern: str | Pattern[str], anchor: int | bool = ..., prefix: str | None = ..., is_regex: int | bool = ...
) -> bool: ...
def findall(dir: str = ...) -> List[str]: ...
def glob_to_re(pattern: str) -> str: ...
@overload
def translate_pattern(
pattern: str, anchor: Union[int, bool] = ..., prefix: Optional[str] = ..., is_regex: Literal[False, 0] = ...
pattern: str, anchor: int | bool = ..., prefix: str | None = ..., is_regex: Literal[False, 0] = ...
) -> Pattern[str]: ...
@overload
def translate_pattern(pattern: Union[str, Pattern[str]], *, is_regex: Literal[True, 1] = ...) -> Pattern[str]: ...
def translate_pattern(pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> Pattern[str]: ...
@overload
def translate_pattern(
pattern: Union[str, Pattern[str]],
anchor: Union[int, bool] = ...,
prefix: Optional[str] = ...,
is_regex: Union[int, bool] = ...,
pattern: str | Pattern[str], anchor: int | bool = ..., prefix: str | None = ..., is_regex: int | bool = ...
) -> Pattern[str]: ...
+2 -2
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: ...
+5 -5
View File
@@ -1,13 +1,13 @@
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: ...
+5 -5
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: Optional[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 = ...) -> None: ...
def readline(self) -> str | None: ...
def readlines(self) -> List[str]: ...
def unreadline(self, line: str) -> str: ...
+13 -13
View File
@@ -1,38 +1,38 @@
from abc import abstractmethod
from typing import Optional, Pattern, Tuple, TypeVar, Union
from typing import Pattern, Tuple, TypeVar
_T = TypeVar("_T", bound=Version)
class Version:
def __repr__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __lt__(self: _T, other: Union[_T, str]) -> bool: ...
def __le__(self: _T, other: Union[_T, str]) -> bool: ...
def __gt__(self: _T, other: Union[_T, str]) -> bool: ...
def __ge__(self: _T, other: Union[_T, str]) -> bool: ...
def __lt__(self: _T, other: _T | str) -> bool: ...
def __le__(self: _T, other: _T | str) -> bool: ...
def __gt__(self: _T, other: _T | str) -> bool: ...
def __ge__(self: _T, other: _T | str) -> bool: ...
@abstractmethod
def __init__(self, vstring: Optional[str] = ...) -> None: ...
def __init__(self, vstring: str | None = ...) -> None: ...
@abstractmethod
def parse(self: _T, vstring: str) -> _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[str, int]]
def __init__(self, vstring: Optional[str] = ...) -> None: ...
prerelease: Tuple[str, int] | None
def __init__(self, vstring: str | None = ...) -> None: ...
def parse(self: _T, vstring: str) -> _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: str
version: Tuple[Union[str, int], ...]
def __init__(self, vstring: Optional[str] = ...) -> None: ...
version: Tuple[str | int, ...]
def __init__(self, vstring: str | None = ...) -> None: ...
def parse(self: _T, vstring: str) -> _T: ...
def __str__(self) -> str: ...
def _cmp(self: _T, other: Union[_T, str]) -> bool: ...
def _cmp(self: _T, other: _T | str) -> bool: ...
+46 -53
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
@@ -33,7 +33,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]
@@ -41,10 +41,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: ...
@@ -52,26 +52,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:
@@ -81,10 +79,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]
@@ -97,15 +95,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:
@@ -126,40 +124,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: ...
@@ -168,9 +161,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: ...
@@ -190,10 +183,10 @@ class SkipDocTestCase(DocTestCase):
class _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: ...
@@ -204,15 +197,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: ...
+6 -6
View File
@@ -1,4 +1,4 @@
from typing import Any, Iterator, List, Optional
from typing import Any, Iterator, List
QP: int # undocumented
BASE64: int # undocumented
@@ -8,12 +8,12 @@ class Charset:
input_charset: str
header_encoding: int
body_encoding: int
output_charset: Optional[str]
input_codec: Optional[str]
output_codec: Optional[str]
output_charset: str | None
input_codec: str | None
output_codec: str | None
def __init__(self, input_charset: str = ...) -> None: ...
def get_body_encoding(self) -> str: ...
def get_output_charset(self) -> Optional[str]: ...
def get_output_charset(self) -> str | None: ...
def header_encode(self, string: str) -> str: ...
def header_encode_lines(self, string: str, maxlengths: Iterator[int]) -> List[str]: ...
def body_encode(self, string: str) -> str: ...
@@ -22,7 +22,7 @@ class Charset:
def __ne__(self, other: Any) -> bool: ...
def add_charset(
charset: str, header_enc: Optional[int] = ..., body_enc: Optional[int] = ..., output_charset: Optional[str] = ...
charset: str, header_enc: int | None = ..., body_enc: int | None = ..., output_charset: str | None = ...
) -> None: ...
def add_alias(alias: str, canonical: str) -> None: ...
def add_codec(charset: str, codecname: str) -> None: ...
+2 -3
View File
@@ -1,5 +1,4 @@
import sys
from typing import Optional
class MessageError(Exception): ...
class MessageParseError(MessageError): ...
@@ -9,7 +8,7 @@ class MultipartConversionError(MessageError, TypeError): ...
class CharsetError(MessageError): ...
class MessageDefect(ValueError):
def __init__(self, line: Optional[str] = ...) -> None: ...
def __init__(self, line: str | None = ...) -> None: ...
class NoBoundaryInMultipartDefect(MessageDefect): ...
class StartBoundaryNotFoundDefect(MessageDefect): ...
@@ -31,7 +30,7 @@ class InvalidHeaderDefect(HeaderDefect): ...
class HeaderMissingRequiredValue(HeaderDefect): ...
class NonPrintableDefect(HeaderDefect):
def __init__(self, non_printables: Optional[str]) -> None: ...
def __init__(self, non_printables: str | None) -> None: ...
class ObsoleteHeaderDefect(HeaderDefect): ...
class NonASCIILocalPartDefect(HeaderDefect): ...
+9 -19
View File
@@ -1,40 +1,30 @@
from email.message import Message
from email.policy import Policy
from typing import BinaryIO, Optional, TextIO
from typing import BinaryIO, TextIO
class Generator:
def clone(self, fp: TextIO) -> Generator: ...
def write(self, s: str) -> None: ...
def __init__(
self,
outfp: TextIO,
mangle_from_: Optional[bool] = ...,
maxheaderlen: Optional[int] = ...,
*,
policy: Optional[Policy] = ...,
self, outfp: TextIO, mangle_from_: bool | None = ..., maxheaderlen: int | None = ..., *, policy: Policy | None = ...
) -> None: ...
def flatten(self, msg: Message, unixfrom: bool = ..., linesep: Optional[str] = ...) -> None: ...
def flatten(self, msg: Message, unixfrom: bool = ..., linesep: str | None = ...) -> None: ...
class BytesGenerator:
def clone(self, fp: BinaryIO) -> BytesGenerator: ...
def write(self, s: str) -> None: ...
def __init__(
self,
outfp: BinaryIO,
mangle_from_: Optional[bool] = ...,
maxheaderlen: Optional[int] = ...,
*,
policy: Optional[Policy] = ...,
self, outfp: BinaryIO, mangle_from_: bool | None = ..., maxheaderlen: int | None = ..., *, policy: Policy | None = ...
) -> None: ...
def flatten(self, msg: Message, unixfrom: bool = ..., linesep: Optional[str] = ...) -> None: ...
def flatten(self, msg: Message, unixfrom: bool = ..., linesep: str | None = ...) -> None: ...
class DecodedGenerator(Generator):
def __init__(
self,
outfp: TextIO,
mangle_from_: Optional[bool] = ...,
maxheaderlen: Optional[int] = ...,
fmt: Optional[str] = ...,
mangle_from_: bool | None = ...,
maxheaderlen: int | None = ...,
fmt: str | None = ...,
*,
policy: Optional[Policy] = ...,
policy: Policy | None = ...,
) -> None: ...

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