Add more defaults to the stdlib (#9606)

Continuing work towards #8988.

The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are:

- Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine)
- Defaults in non-py311 branches
- Defaults for float parameters
- Defaults for overloads
This commit is contained in:
Alex Waygood
2023-01-29 01:51:23 +00:00
committed by GitHub
parent 25e02db42c
commit 33a62ae42d
150 changed files with 2761 additions and 2704 deletions

View File

@@ -8,27 +8,27 @@ _T = TypeVar("_T")
if sys.version_info >= (3, 10):
@overload
def bisect_left(
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ..., *, key: None = ...
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None, *, key: None = None
) -> int: ...
@overload
def bisect_left(
a: Sequence[_T],
x: SupportsRichComparisonT,
lo: int = ...,
hi: int | None = ...,
lo: int = 0,
hi: int | None = None,
*,
key: Callable[[_T], SupportsRichComparisonT] = ...,
) -> int: ...
@overload
def bisect_right(
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ..., *, key: None = ...
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None, *, key: None = None
) -> int: ...
@overload
def bisect_right(
a: Sequence[_T],
x: SupportsRichComparisonT,
lo: int = ...,
hi: int | None = ...,
lo: int = 0,
hi: int | None = None,
*,
key: Callable[[_T], SupportsRichComparisonT] = ...,
) -> int: ...
@@ -36,39 +36,39 @@ if sys.version_info >= (3, 10):
def insort_left(
a: MutableSequence[SupportsRichComparisonT],
x: SupportsRichComparisonT,
lo: int = ...,
hi: int | None = ...,
lo: int = 0,
hi: int | None = None,
*,
key: None = ...,
key: None = None,
) -> None: ...
@overload
def insort_left(
a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsRichComparisonT] = ...
a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT] = ...
) -> None: ...
@overload
def insort_right(
a: MutableSequence[SupportsRichComparisonT],
x: SupportsRichComparisonT,
lo: int = ...,
hi: int | None = ...,
lo: int = 0,
hi: int | None = None,
*,
key: None = ...,
key: None = None,
) -> None: ...
@overload
def insort_right(
a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsRichComparisonT] = ...
a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT] = ...
) -> None: ...
else:
def bisect_left(
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ...
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
) -> int: ...
def bisect_right(
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ...
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
) -> int: ...
def insort_left(
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ...
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
) -> None: ...
def insort_right(
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ...
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
) -> None: ...

View File

@@ -1 +1 @@
def getpreferredencoding(do_setlocale: bool = ...) -> str: ...
def getpreferredencoding(do_setlocale: bool = True) -> str: ...

View File

@@ -45,27 +45,29 @@ _BytesToBytesEncoding: TypeAlias = Literal[
_StrToStrEncoding: TypeAlias = Literal["rot13", "rot_13"]
@overload
def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = ...) -> bytes: ...
def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ...
@overload
def encode(obj: str, encoding: _StrToStrEncoding, errors: str = ...) -> str: ... # type: ignore[misc]
def encode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ... # type: ignore[misc]
@overload
def encode(obj: str, encoding: str = ..., errors: str = ...) -> bytes: ...
def encode(obj: str, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
@overload
def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = ...) -> bytes: ... # type: ignore[misc]
def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ... # type: ignore[misc]
@overload
def decode(obj: str, encoding: _StrToStrEncoding, errors: str = ...) -> str: ...
def decode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ...
# these are documented as text encodings but in practice they also accept str as input
@overload
def decode(
obj: str, encoding: Literal["unicode_escape", "unicode-escape", "raw_unicode_escape", "raw-unicode-escape"], errors: str = ...
obj: str,
encoding: Literal["unicode_escape", "unicode-escape", "raw_unicode_escape", "raw-unicode-escape"],
errors: str = "strict",
) -> str: ...
# hex is officially documented as a bytes to bytes encoding, but it appears to also work with str
@overload
def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = ...) -> bytes: ...
def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = "strict") -> bytes: ...
@overload
def decode(obj: ReadableBuffer, encoding: str = ..., errors: str = ...) -> str: ...
def decode(obj: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> str: ...
def lookup(__encoding: str) -> codecs.CodecInfo: ...
def charmap_build(__map: str) -> _CharMap: ...
def ascii_decode(__data: ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...

View File

@@ -66,7 +66,7 @@ if sys.version_info >= (3, 11):
) -> _ContextManager: ...
else:
def localcontext(ctx: Context | None = ...) -> _ContextManager: ...
def localcontext(ctx: Context | None = None) -> _ContextManager: ...
class Decimal:
def __new__(cls: type[Self], value: _DecimalNew = ..., context: Context | None = ...) -> Self: ...

View File

@@ -11,12 +11,12 @@ def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwa
def exit() -> NoReturn: ...
def get_ident() -> int: ...
def allocate_lock() -> LockType: ...
def stack_size(size: int | None = ...) -> int: ...
def stack_size(size: int | None = None) -> int: ...
class LockType:
locked_status: bool
def acquire(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ...
def __enter__(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ...
def acquire(self, waitflag: bool | None = None, timeout: int = -1) -> bool: ...
def __enter__(self, waitflag: bool | None = None, timeout: int = -1) -> bool: ...
def __exit__(self, typ: type[BaseException] | None, val: BaseException | None, tb: TracebackType | None) -> None: ...
def release(self) -> bool: ...
def locked(self) -> bool: ...

View File

@@ -59,17 +59,17 @@ class Thread:
def ident(self) -> int | None: ...
def __init__(
self,
group: None = ...,
target: Callable[..., object] | None = ...,
name: str | None = ...,
group: None = None,
target: Callable[..., object] | None = None,
name: str | None = None,
args: Iterable[Any] = ...,
kwargs: Mapping[str, Any] | None = ...,
kwargs: Mapping[str, Any] | None = None,
*,
daemon: bool | None = ...,
daemon: bool | None = None,
) -> None: ...
def start(self) -> None: ...
def run(self) -> None: ...
def join(self, timeout: float | None = ...) -> None: ...
def join(self, timeout: float | None = None) -> None: ...
def getName(self) -> str: ...
def setName(self, name: str) -> None: ...
if sys.version_info >= (3, 8):
@@ -99,32 +99,32 @@ class _RLock:
def __exit__(
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 acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
def release(self) -> None: ...
RLock = _RLock
class Condition:
def __init__(self, lock: Lock | _RLock | None = ...) -> None: ...
def __init__(self, lock: Lock | _RLock | None = None) -> None: ...
def __enter__(self) -> bool: ...
def __exit__(
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: float | None = ...) -> bool: ...
def wait_for(self, predicate: Callable[[], _T], timeout: float | None = ...) -> _T: ...
def notify(self, n: int = ...) -> None: ...
def wait(self, timeout: float | None = None) -> bool: ...
def wait_for(self, predicate: Callable[[], _T], timeout: float | None = None) -> _T: ...
def notify(self, n: int = 1) -> None: ...
def notify_all(self) -> None: ...
def notifyAll(self) -> None: ...
class Semaphore:
def __init__(self, value: int = ...) -> None: ...
def __init__(self, value: int = 1) -> None: ...
def __exit__(
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: ...
def acquire(self, blocking: bool = True, timeout: float | None = None) -> bool: ...
def __enter__(self, blocking: bool = True, timeout: float | None = None) -> bool: ...
if sys.version_info >= (3, 9):
def release(self, n: int = ...) -> None: ...
else:
@@ -136,7 +136,7 @@ class Event:
def is_set(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
def wait(self, timeout: float | None = ...) -> bool: ...
def wait(self, timeout: float | None = None) -> bool: ...
if sys.version_info >= (3, 8):
from _thread import _excepthook, _ExceptHookArgs
@@ -149,8 +149,8 @@ class Timer(Thread):
self,
interval: float,
function: Callable[..., object],
args: Iterable[Any] | None = ...,
kwargs: Mapping[str, Any] | None = ...,
args: Iterable[Any] | None = None,
kwargs: Mapping[str, Any] | None = None,
) -> None: ...
def cancel(self) -> None: ...
@@ -161,8 +161,8 @@ class Barrier:
def n_waiting(self) -> int: ...
@property
def broken(self) -> bool: ...
def __init__(self, parties: int, action: Callable[[], None] | None = ..., timeout: float | None = ...) -> None: ...
def wait(self, timeout: float | None = ...) -> int: ...
def __init__(self, parties: int, action: Callable[[], None] | None = None, timeout: float | None = None) -> None: ...
def wait(self, timeout: float | None = None) -> int: ...
def reset(self) -> None: ...
def abort(self) -> None: ...

View File

@@ -5,9 +5,9 @@ _onceregistry: dict[Any, Any]
filters: list[tuple[str, str | None, type[Warning], str | None, int]]
@overload
def warn(message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...) -> None: ...
def warn(message: str, category: type[Warning] | None = None, stacklevel: int = 1, source: Any | None = None) -> None: ...
@overload
def warn(message: Warning, category: Any = ..., stacklevel: int = ..., source: Any | None = ...) -> None: ...
def warn(message: Warning, category: Any = None, stacklevel: int = 1, source: Any | None = None) -> None: ...
@overload
def warn_explicit(
message: str,

View File

@@ -13,7 +13,7 @@ _T = TypeVar("_T")
class WeakSet(MutableSet[_T], Generic[_T]):
@overload
def __init__(self, data: None = ...) -> None: ...
def __init__(self, data: None = None) -> None: ...
@overload
def __init__(self, data: Iterable[_T]) -> None: ...
def add(self, item: _T) -> None: ...

View File

@@ -128,7 +128,7 @@ if sys.platform == "win32":
@overload
def ConnectNamedPipe(handle: int, overlapped: Literal[True]) -> Overlapped: ...
@overload
def ConnectNamedPipe(handle: int, overlapped: Literal[False] = ...) -> None: ...
def ConnectNamedPipe(handle: int, overlapped: Literal[False] = False) -> None: ...
@overload
def ConnectNamedPipe(handle: int, overlapped: bool) -> Overlapped | None: ...
def CreateFile(
@@ -189,7 +189,7 @@ if sys.platform == "win32":
@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]: ...
def ReadFile(handle: int, size: int, overlapped: Literal[False] = False) -> tuple[bytes, int]: ...
@overload
def ReadFile(handle: int, size: int, overlapped: int | bool) -> tuple[Any, int]: ...
def SetNamedPipeHandleState(
@@ -202,7 +202,7 @@ if sys.platform == "win32":
@overload
def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: Literal[True]) -> tuple[Overlapped, int]: ...
@overload
def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: Literal[False] = ...) -> tuple[int, int]: ...
def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: Literal[False] = False) -> tuple[int, int]: ...
@overload
def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: int | bool) -> tuple[Any, int]: ...
@final

View File

@@ -81,7 +81,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: str | None = ...) -> Any: ...
def open(f: _File, mode: str | None = None) -> Any: ...
if sys.version_info < (3, 9):
@overload
@@ -89,4 +89,4 @@ if sys.version_info < (3, 9):
@overload
def openfp(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ...
@overload
def openfp(f: _File, mode: str | None = ...) -> Any: ...
def openfp(f: _File, mode: str | None = None) -> Any: ...

View File

@@ -148,23 +148,23 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
else:
def __init__(
self,
prog: str | None = ...,
usage: str | None = ...,
description: str | None = ...,
epilog: str | None = ...,
prog: str | None = None,
usage: str | None = None,
description: str | None = None,
epilog: str | None = None,
parents: Sequence[ArgumentParser] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: str = ...,
fromfile_prefix_chars: str | None = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
add_help: bool = ...,
allow_abbrev: bool = ...,
prefix_chars: str = "-",
fromfile_prefix_chars: str | None = None,
argument_default: Any = None,
conflict_handler: str = "error",
add_help: bool = True,
allow_abbrev: bool = True,
) -> None: ...
# 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: Sequence[str] | None = ...) -> Namespace: ...
def parse_args(self, args: Sequence[str] | None = None) -> Namespace: ...
@overload
def parse_args(self, args: Sequence[str] | None, namespace: None) -> Namespace: ... # type: ignore[misc]
@overload
@@ -378,10 +378,10 @@ class _StoreConstAction(Action):
option_strings: Sequence[str],
dest: str,
const: Any,
default: Any = ...,
required: bool = ...,
help: str | None = ...,
metavar: str | tuple[str, ...] | None = ...,
default: Any = None,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
) -> None: ...
# undocumented
@@ -422,10 +422,10 @@ class _AppendConstAction(Action):
option_strings: Sequence[str],
dest: str,
const: Any,
default: Any = ...,
required: bool = ...,
help: str | None = ...,
metavar: str | tuple[str, ...] | None = ...,
default: Any = None,
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = None,
) -> None: ...
# undocumented

View File

@@ -174,11 +174,11 @@ if sys.version_info >= (3, 8):
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any] = ...,
mode: Literal["exec"] = ...,
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
mode: Literal["exec"] = "exec",
*,
type_comments: bool = ...,
feature_version: None | int | tuple[int, int] = ...,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Module: ...
@overload
def parse(
@@ -186,8 +186,8 @@ if sys.version_info >= (3, 8):
filename: str | ReadableBuffer | os.PathLike[Any],
mode: Literal["eval"],
*,
type_comments: bool = ...,
feature_version: None | int | tuple[int, int] = ...,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Expression: ...
@overload
def parse(
@@ -195,8 +195,8 @@ if sys.version_info >= (3, 8):
filename: str | ReadableBuffer | os.PathLike[Any],
mode: Literal["func_type"],
*,
type_comments: bool = ...,
feature_version: None | int | tuple[int, int] = ...,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> FunctionType: ...
@overload
def parse(
@@ -204,47 +204,49 @@ if sys.version_info >= (3, 8):
filename: str | ReadableBuffer | os.PathLike[Any],
mode: Literal["single"],
*,
type_comments: bool = ...,
feature_version: None | int | tuple[int, int] = ...,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Interactive: ...
@overload
def parse(
source: str | ReadableBuffer,
*,
mode: Literal["eval"],
type_comments: bool = ...,
feature_version: None | int | tuple[int, int] = ...,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Expression: ...
@overload
def parse(
source: str | ReadableBuffer,
*,
mode: Literal["func_type"],
type_comments: bool = ...,
feature_version: None | int | tuple[int, int] = ...,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> FunctionType: ...
@overload
def parse(
source: str | ReadableBuffer,
*,
mode: Literal["single"],
type_comments: bool = ...,
feature_version: None | int | tuple[int, int] = ...,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> Interactive: ...
@overload
def parse(
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any] = ...,
mode: str = ...,
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
mode: str = "exec",
*,
type_comments: bool = ...,
feature_version: None | int | tuple[int, int] = ...,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> AST: ...
else:
@overload
def parse(
source: str | ReadableBuffer, filename: str | ReadableBuffer | os.PathLike[Any] = ..., mode: Literal["exec"] = ...
source: str | ReadableBuffer,
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
mode: Literal["exec"] = "exec",
) -> Module: ...
@overload
def parse(
@@ -259,7 +261,9 @@ else:
@overload
def parse(source: str | ReadableBuffer, *, mode: Literal["single"]) -> Interactive: ...
@overload
def parse(source: str | ReadableBuffer, filename: str | ReadableBuffer | os.PathLike[Any] = ..., mode: str = ...) -> AST: ...
def parse(
source: str | ReadableBuffer, filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>", mode: str = "exec"
) -> AST: ...
if sys.version_info >= (3, 9):
def unparse(ast_obj: AST) -> str: ...
@@ -272,7 +276,7 @@ if sys.version_info >= (3, 9):
) -> str: ...
else:
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
def dump(node: AST, annotate_fields: bool = True, include_attributes: bool = False) -> str: ...
def fix_missing_locations(node: _T) -> _T: ...
def get_docstring(node: AsyncFunctionDef | FunctionDef | ClassDef | Module, clean: bool = True) -> str | None: ...

View File

@@ -90,7 +90,7 @@ class BaseEventLoop(AbstractEventLoop):
self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, name: object = None, context: Context | None = None
) -> Task[_T]: ...
elif sys.version_info >= (3, 8):
def create_task(self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, name: object = ...) -> Task[_T]: ...
def create_task(self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, name: object = None) -> Task[_T]: ...
else:
def create_task(self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T]) -> Task[_T]: ...
@@ -120,36 +120,36 @@ class BaseEventLoop(AbstractEventLoop):
host: str = ...,
port: int = ...,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
ssl_shutdown_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: None = None,
local_addr: tuple[str, int] | None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
ssl_shutdown_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
@overload
async def create_connection(
self,
protocol_factory: Callable[[], _ProtocolT],
host: None = ...,
port: None = ...,
host: None = None,
port: None = None,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: socket,
local_addr: None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
ssl_shutdown_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
local_addr: None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
ssl_shutdown_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
elif sys.version_info >= (3, 8):
@overload
@@ -159,34 +159,34 @@ class BaseEventLoop(AbstractEventLoop):
host: str = ...,
port: int = ...,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: None = None,
local_addr: tuple[str, int] | None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
@overload
async def create_connection(
self,
protocol_factory: Callable[[], _ProtocolT],
host: None = ...,
port: None = ...,
host: None = None,
port: None = None,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: socket,
local_addr: None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
local_addr: None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
else:
@overload
@@ -196,67 +196,67 @@ class BaseEventLoop(AbstractEventLoop):
host: str = ...,
port: int = ...,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: None = None,
local_addr: tuple[str, int] | None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
) -> tuple[Transport, _ProtocolT]: ...
@overload
async def create_connection(
self,
protocol_factory: Callable[[], _ProtocolT],
host: None = ...,
port: None = ...,
host: None = None,
port: None = None,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: socket,
local_addr: None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
local_addr: None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
) -> tuple[Transport, _ProtocolT]: ...
if sys.version_info >= (3, 11):
@overload
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: str | Sequence[str] | None = ...,
host: str | Sequence[str] | None = None,
port: int = ...,
*,
family: int = ...,
flags: int = ...,
sock: None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
ssl_shutdown_timeout: float | None = ...,
start_serving: bool = ...,
sock: None = None,
backlog: int = 100,
ssl: _SSLContext = None,
reuse_address: bool | None = None,
reuse_port: bool | None = None,
ssl_handshake_timeout: float | None = None,
ssl_shutdown_timeout: float | None = None,
start_serving: bool = True,
) -> Server: ...
@overload
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: None = ...,
port: None = ...,
host: None = None,
port: None = None,
*,
family: int = ...,
flags: int = ...,
sock: socket = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
ssl_shutdown_timeout: float | None = ...,
start_serving: bool = ...,
backlog: int = 100,
ssl: _SSLContext = None,
reuse_address: bool | None = None,
reuse_port: bool | None = None,
ssl_handshake_timeout: float | None = None,
ssl_shutdown_timeout: float | None = None,
start_serving: bool = True,
) -> Server: ...
async def start_tls(
self,
@@ -283,35 +283,35 @@ class BaseEventLoop(AbstractEventLoop):
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: str | Sequence[str] | None = ...,
host: str | Sequence[str] | None = None,
port: int = ...,
*,
family: int = ...,
flags: int = ...,
sock: None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
start_serving: bool = ...,
sock: None = None,
backlog: int = 100,
ssl: _SSLContext = None,
reuse_address: bool | None = None,
reuse_port: bool | None = None,
ssl_handshake_timeout: float | None = None,
start_serving: bool = True,
) -> Server: ...
@overload
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: None = ...,
port: None = ...,
host: None = None,
port: None = None,
*,
family: int = ...,
flags: int = ...,
sock: socket = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
start_serving: bool = ...,
backlog: int = 100,
ssl: _SSLContext = None,
reuse_address: bool | None = None,
reuse_port: bool | None = None,
ssl_handshake_timeout: float | None = None,
start_serving: bool = True,
) -> Server: ...
async def start_tls(
self,
@@ -319,17 +319,17 @@ class BaseEventLoop(AbstractEventLoop):
protocol: BaseProtocol,
sslcontext: ssl.SSLContext,
*,
server_side: bool = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
server_side: bool = False,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
) -> Transport: ...
async def connect_accepted_socket(
self,
protocol_factory: Callable[[], _ProtocolT],
sock: socket,
*,
ssl: _SSLContext = ...,
ssl_handshake_timeout: float | None = ...,
ssl: _SSLContext = None,
ssl_handshake_timeout: float | None = None,
) -> tuple[Transport, _ProtocolT]: ...
async def sock_sendfile(
@@ -356,16 +356,16 @@ class BaseEventLoop(AbstractEventLoop):
async def create_datagram_endpoint(
self,
protocol_factory: Callable[[], _ProtocolT],
local_addr: tuple[str, int] | str | None = ...,
remote_addr: tuple[str, int] | str | None = ...,
local_addr: tuple[str, int] | str | None = None,
remote_addr: tuple[str, int] | str | None = None,
*,
family: int = ...,
proto: int = ...,
flags: int = ...,
family: int = 0,
proto: int = 0,
flags: int = 0,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
allow_broadcast: bool | None = ...,
sock: socket | None = ...,
reuse_port: bool | None = None,
allow_broadcast: bool | None = None,
sock: socket | None = None,
) -> tuple[DatagramTransport, _ProtocolT]: ...
# Pipes and subprocesses.
async def connect_read_pipe(

View File

@@ -167,7 +167,7 @@ class AbstractEventLoop:
elif sys.version_info >= (3, 8):
@abstractmethod
def create_task(
self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, name: str | None = ...
self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, name: str | None = None
) -> Task[_T]: ...
else:
@abstractmethod
@@ -212,37 +212,37 @@ class AbstractEventLoop:
host: str = ...,
port: int = ...,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
ssl_shutdown_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: None = None,
local_addr: tuple[str, int] | None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
ssl_shutdown_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
@overload
@abstractmethod
async def create_connection(
self,
protocol_factory: Callable[[], _ProtocolT],
host: None = ...,
port: None = ...,
host: None = None,
port: None = None,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: socket,
local_addr: None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
ssl_shutdown_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
local_addr: None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
ssl_shutdown_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
elif sys.version_info >= (3, 8):
@overload
@@ -253,35 +253,35 @@ class AbstractEventLoop:
host: str = ...,
port: int = ...,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: None = None,
local_addr: tuple[str, int] | None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
@overload
@abstractmethod
async def create_connection(
self,
protocol_factory: Callable[[], _ProtocolT],
host: None = ...,
port: None = ...,
host: None = None,
port: None = None,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: socket,
local_addr: None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
happy_eyeballs_delay: float | None = ...,
interleave: int | None = ...,
local_addr: None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
happy_eyeballs_delay: float | None = None,
interleave: int | None = None,
) -> tuple[Transport, _ProtocolT]: ...
else:
@overload
@@ -292,31 +292,31 @@ class AbstractEventLoop:
host: str = ...,
port: int = ...,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
sock: None = ...,
local_addr: tuple[str, int] | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: None = None,
local_addr: tuple[str, int] | None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
) -> tuple[Transport, _ProtocolT]: ...
@overload
@abstractmethod
async def create_connection(
self,
protocol_factory: Callable[[], _ProtocolT],
host: None = ...,
port: None = ...,
host: None = None,
port: None = None,
*,
ssl: _SSLContext = ...,
family: int = ...,
proto: int = ...,
flags: int = ...,
ssl: _SSLContext = None,
family: int = 0,
proto: int = 0,
flags: int = 0,
sock: socket,
local_addr: None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
local_addr: None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
) -> tuple[Transport, _ProtocolT]: ...
if sys.version_info >= (3, 11):
@overload
@@ -324,38 +324,38 @@ class AbstractEventLoop:
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: str | Sequence[str] | None = ...,
host: str | Sequence[str] | None = None,
port: int = ...,
*,
family: int = ...,
flags: int = ...,
sock: None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
ssl_shutdown_timeout: float | None = ...,
start_serving: bool = ...,
sock: None = None,
backlog: int = 100,
ssl: _SSLContext = None,
reuse_address: bool | None = None,
reuse_port: bool | None = None,
ssl_handshake_timeout: float | None = None,
ssl_shutdown_timeout: float | None = None,
start_serving: bool = True,
) -> Server: ...
@overload
@abstractmethod
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: None = ...,
port: None = ...,
host: None = None,
port: None = None,
*,
family: int = ...,
flags: int = ...,
sock: socket = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
ssl_shutdown_timeout: float | None = ...,
start_serving: bool = ...,
backlog: int = 100,
ssl: _SSLContext = None,
reuse_address: bool | None = None,
reuse_port: bool | None = None,
ssl_handshake_timeout: float | None = None,
ssl_shutdown_timeout: float | None = None,
start_serving: bool = True,
) -> Server: ...
@abstractmethod
async def start_tls(
@@ -387,36 +387,36 @@ class AbstractEventLoop:
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: str | Sequence[str] | None = ...,
host: str | Sequence[str] | None = None,
port: int = ...,
*,
family: int = ...,
flags: int = ...,
sock: None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
start_serving: bool = ...,
sock: None = None,
backlog: int = 100,
ssl: _SSLContext = None,
reuse_address: bool | None = None,
reuse_port: bool | None = None,
ssl_handshake_timeout: float | None = None,
start_serving: bool = True,
) -> Server: ...
@overload
@abstractmethod
async def create_server(
self,
protocol_factory: _ProtocolFactory,
host: None = ...,
port: None = ...,
host: None = None,
port: None = None,
*,
family: int = ...,
flags: int = ...,
sock: socket = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
reuse_address: bool | None = ...,
reuse_port: bool | None = ...,
ssl_handshake_timeout: float | None = ...,
start_serving: bool = ...,
backlog: int = 100,
ssl: _SSLContext = None,
reuse_address: bool | None = None,
reuse_port: bool | None = None,
ssl_handshake_timeout: float | None = None,
start_serving: bool = True,
) -> Server: ...
@abstractmethod
async def start_tls(
@@ -425,20 +425,20 @@ class AbstractEventLoop:
protocol: BaseProtocol,
sslcontext: ssl.SSLContext,
*,
server_side: bool = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
server_side: bool = False,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
) -> Transport: ...
async def create_unix_server(
self,
protocol_factory: _ProtocolFactory,
path: StrPath | None = ...,
path: StrPath | None = None,
*,
sock: socket | None = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
ssl_handshake_timeout: float | None = ...,
start_serving: bool = ...,
sock: socket | None = None,
backlog: int = 100,
ssl: _SSLContext = None,
ssl_handshake_timeout: float | None = None,
start_serving: bool = True,
) -> Server: ...
if sys.version_info >= (3, 11):
async def connect_accepted_socket(
@@ -456,8 +456,8 @@ class AbstractEventLoop:
protocol_factory: Callable[[], _ProtocolT],
sock: socket,
*,
ssl: _SSLContext = ...,
ssl_handshake_timeout: float | None = ...,
ssl: _SSLContext = None,
ssl_handshake_timeout: float | None = None,
) -> tuple[Transport, _ProtocolT]: ...
if sys.version_info >= (3, 11):
async def create_unix_connection(
@@ -475,12 +475,12 @@ class AbstractEventLoop:
async def create_unix_connection(
self,
protocol_factory: Callable[[], _ProtocolT],
path: str | None = ...,
path: str | None = None,
*,
ssl: _SSLContext = ...,
sock: socket | None = ...,
server_hostname: str | None = ...,
ssl_handshake_timeout: float | None = ...,
ssl: _SSLContext = None,
sock: socket | None = None,
server_hostname: str | None = None,
ssl_handshake_timeout: float | None = None,
) -> tuple[Transport, _ProtocolT]: ...
@abstractmethod

View File

@@ -44,7 +44,7 @@ class Future(Awaitable[_T], Iterable[_T]):
def get_loop(self) -> AbstractEventLoop: ...
@property
def _callbacks(self: Self) -> list[tuple[Callable[[Self], Any], Context]]: ...
def add_done_callback(self: Self, __fn: Callable[[Self], object], *, context: Context | None = ...) -> None: ...
def add_done_callback(self: Self, __fn: Callable[[Self], object], *, context: Context | None = None) -> None: ...
if sys.version_info >= (3, 9):
def cancel(self, msg: Any | None = None) -> bool: ...
else:

View File

@@ -69,7 +69,7 @@ class Condition(_ContextManagerMixin):
if sys.version_info >= (3, 11):
def __init__(self, lock: Lock | None = None) -> None: ...
else:
def __init__(self, lock: Lock | None = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
def __init__(self, lock: Lock | None = None, *, loop: AbstractEventLoop | None = ...) -> None: ...
def locked(self) -> bool: ...
async def acquire(self) -> Literal[True]: ...
@@ -85,7 +85,7 @@ class Semaphore(_ContextManagerMixin):
if sys.version_info >= (3, 11):
def __init__(self, value: int = 1) -> None: ...
else:
def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
def __init__(self, value: int = 1, *, loop: AbstractEventLoop | None = ...) -> None: ...
def locked(self) -> bool: ...
async def acquire(self) -> Literal[True]: ...

View File

@@ -47,9 +47,9 @@ class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTran
loop: events.AbstractEventLoop,
sock: socket,
protocol: streams.StreamReaderProtocol,
waiter: futures.Future[Any] | None = ...,
extra: Mapping[Any, Any] | None = ...,
server: events.AbstractServer | None = ...,
waiter: futures.Future[Any] | None = None,
extra: Mapping[Any, Any] | None = None,
server: events.AbstractServer | None = None,
) -> None: ...
class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, transports.WriteTransport): ...

View File

@@ -16,7 +16,7 @@ class Queue(Generic[_T]):
if sys.version_info >= (3, 11):
def __init__(self, maxsize: int = 0) -> None: ...
else:
def __init__(self, maxsize: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
def __init__(self, maxsize: int = 0, *, loop: AbstractEventLoop | None = ...) -> None: ...
def _init(self, maxsize: int) -> None: ...
def _get(self) -> _T: ...

View File

@@ -32,4 +32,4 @@ elif sys.version_info >= (3, 8):
def run(main: Coroutine[Any, Any, _T], *, debug: bool | None = None) -> _T: ...
else:
def run(main: Coroutine[Any, Any, _T], *, debug: bool = ...) -> _T: ...
def run(main: Coroutine[Any, Any, _T], *, debug: bool = False) -> _T: ...

View File

@@ -48,7 +48,7 @@ if sys.version_info < (3, 11):
_need_ssldata: bool
_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: ...
def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: str | None = None) -> None: ...
@property
def context(self) -> ssl.SSLContext: ...
@property
@@ -57,11 +57,11 @@ if sys.version_info < (3, 11):
def need_ssldata(self) -> bool: ...
@property
def wrapped(self) -> bool: ...
def do_handshake(self, callback: Callable[[BaseException | None], object] | None = ...) -> list[bytes]: ...
def shutdown(self, callback: Callable[[], object] | None = ...) -> list[bytes]: ...
def do_handshake(self, callback: Callable[[BaseException | None], object] | None = None) -> list[bytes]: ...
def shutdown(self, callback: Callable[[], object] | 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]: ...
def feed_ssldata(self, data: bytes, only_handshake: bool = False) -> tuple[list[bytes], list[bytes]]: ...
def feed_appdata(self, data: bytes, offset: int = 0) -> tuple[list[bytes], int]: ...
class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
@@ -131,10 +131,10 @@ class SSLProtocol(_SSLProtocolBase):
app_protocol: protocols.BaseProtocol,
sslcontext: ssl.SSLContext,
waiter: futures.Future[Any],
server_side: bool = ...,
server_hostname: str | None = ...,
call_connection_made: bool = ...,
ssl_handshake_timeout: int | None = ...,
server_side: bool = False,
server_hostname: str | None = None,
call_connection_made: bool = True,
ssl_handshake_timeout: int | None = None,
) -> None: ...
def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ...

View File

@@ -78,21 +78,21 @@ if sys.version_info >= (3, 10):
else:
async def open_connection(
host: str | None = ...,
port: int | str | None = ...,
host: str | None = None,
port: int | str | None = None,
*,
loop: events.AbstractEventLoop | None = ...,
limit: int = ...,
loop: events.AbstractEventLoop | None = None,
limit: int = 65536,
ssl_handshake_timeout: float | None = ...,
**kwds: Any,
) -> tuple[StreamReader, StreamWriter]: ...
async def start_server(
client_connected_cb: _ClientConnectedCallback,
host: str | None = ...,
port: int | str | None = ...,
host: str | None = None,
port: int | str | None = None,
*,
loop: events.AbstractEventLoop | None = ...,
limit: int = ...,
loop: events.AbstractEventLoop | None = None,
limit: int = 65536,
ssl_handshake_timeout: float | None = ...,
**kwds: Any,
) -> Server: ...

View File

@@ -109,10 +109,10 @@ if sys.version_info >= (3, 11):
elif sys.version_info >= (3, 10):
async def create_subprocess_shell(
cmd: str | bytes,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
limit: int = ...,
stdin: int | IO[Any] | None = None,
stdout: int | IO[Any] | None = None,
stderr: int | IO[Any] | None = None,
limit: int = 65536,
*,
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
universal_newlines: Literal[False] = ...,
@@ -141,10 +141,10 @@ elif sys.version_info >= (3, 10):
async def create_subprocess_exec(
program: _ExecArg,
*args: _ExecArg,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
limit: int = ...,
stdin: int | IO[Any] | None = None,
stdout: int | IO[Any] | None = None,
stderr: int | IO[Any] | None = None,
limit: int = 65536,
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
universal_newlines: Literal[False] = ...,
shell: Literal[True] = ...,
@@ -173,11 +173,11 @@ elif sys.version_info >= (3, 10):
else: # >= 3.9
async def create_subprocess_shell(
cmd: str | bytes,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
loop: events.AbstractEventLoop | None = ...,
limit: int = ...,
stdin: int | IO[Any] | None = None,
stdout: int | IO[Any] | None = None,
stderr: int | IO[Any] | None = None,
loop: events.AbstractEventLoop | None = None,
limit: int = 65536,
*,
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
universal_newlines: Literal[False] = ...,
@@ -205,11 +205,11 @@ else: # >= 3.9
async def create_subprocess_exec(
program: _ExecArg,
*args: _ExecArg,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
loop: events.AbstractEventLoop | None = ...,
limit: int = ...,
stdin: int | IO[Any] | None = None,
stdout: int | IO[Any] | None = None,
stderr: int | IO[Any] | None = None,
loop: events.AbstractEventLoop | None = None,
limit: int = 65536,
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
universal_newlines: Literal[False] = ...,
shell: Literal[True] = ...,

View File

@@ -55,13 +55,13 @@ if sys.version_info >= (3, 10):
else:
def as_completed(
fs: Iterable[_FutureLike[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ...
fs: Iterable[_FutureLike[_T]], *, loop: AbstractEventLoop | None = None, timeout: float | None = None
) -> Iterator[Future[_T]]: ...
@overload
def ensure_future(coro_or_future: _FT, *, loop: AbstractEventLoop | None = ...) -> _FT: ... # type: ignore[misc]
def ensure_future(coro_or_future: _FT, *, loop: AbstractEventLoop | None = None) -> _FT: ... # type: ignore[misc]
@overload
def ensure_future(coro_or_future: Awaitable[_T], *, loop: AbstractEventLoop | None = ...) -> Task[_T]: ...
def ensure_future(coro_or_future: Awaitable[_T], *, loop: AbstractEventLoop | None = None) -> Task[_T]: ...
# `gather()` actually returns a list with length equal to the number
# of tasks passed; however, Tuple is used similar to the annotation for
@@ -72,10 +72,10 @@ def ensure_future(coro_or_future: Awaitable[_T], *, loop: AbstractEventLoop | No
# but having overlapping overloads is the only way to get acceptable type inference in all edge cases.
if sys.version_info >= (3, 10):
@overload
def gather(__coro_or_future1: _FutureLike[_T1], *, return_exceptions: Literal[False] = ...) -> Future[tuple[_T1]]: ... # type: ignore[misc]
def gather(__coro_or_future1: _FutureLike[_T1], *, return_exceptions: Literal[False] = False) -> Future[tuple[_T1]]: ... # type: ignore[misc]
@overload
def gather( # type: ignore[misc]
__coro_or_future1: _FutureLike[_T1], __coro_or_future2: _FutureLike[_T2], *, return_exceptions: Literal[False] = ...
__coro_or_future1: _FutureLike[_T1], __coro_or_future2: _FutureLike[_T2], *, return_exceptions: Literal[False] = False
) -> Future[tuple[_T1, _T2]]: ...
@overload
def gather( # type: ignore[misc]
@@ -83,7 +83,7 @@ if sys.version_info >= (3, 10):
__coro_or_future2: _FutureLike[_T2],
__coro_or_future3: _FutureLike[_T3],
*,
return_exceptions: Literal[False] = ...,
return_exceptions: Literal[False] = False,
) -> Future[tuple[_T1, _T2, _T3]]: ...
@overload
def gather( # type: ignore[misc]
@@ -92,7 +92,7 @@ if sys.version_info >= (3, 10):
__coro_or_future3: _FutureLike[_T3],
__coro_or_future4: _FutureLike[_T4],
*,
return_exceptions: Literal[False] = ...,
return_exceptions: Literal[False] = False,
) -> Future[tuple[_T1, _T2, _T3, _T4]]: ...
@overload
def gather( # type: ignore[misc]
@@ -102,7 +102,7 @@ if sys.version_info >= (3, 10):
__coro_or_future4: _FutureLike[_T4],
__coro_or_future5: _FutureLike[_T5],
*,
return_exceptions: Literal[False] = ...,
return_exceptions: Literal[False] = False,
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
@overload
def gather(__coro_or_future1: _FutureLike[_T1], *, return_exceptions: bool) -> Future[tuple[_T1 | BaseException]]: ... # type: ignore[misc]
@@ -140,20 +140,20 @@ if sys.version_info >= (3, 10):
tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
]: ...
@overload
def gather(*coros_or_futures: _FutureLike[Any], return_exceptions: bool = ...) -> Future[list[Any]]: ... # type: ignore[misc]
def gather(*coros_or_futures: _FutureLike[Any], return_exceptions: bool = False) -> Future[list[Any]]: ... # type: ignore[misc]
else:
@overload
def gather( # type: ignore[misc]
__coro_or_future1: _FutureLike[_T1], *, loop: AbstractEventLoop | None = ..., return_exceptions: Literal[False] = ...
__coro_or_future1: _FutureLike[_T1], *, loop: AbstractEventLoop | None = None, return_exceptions: Literal[False] = False
) -> Future[tuple[_T1]]: ...
@overload
def gather( # type: ignore[misc]
__coro_or_future1: _FutureLike[_T1],
__coro_or_future2: _FutureLike[_T2],
*,
loop: AbstractEventLoop | None = ...,
return_exceptions: Literal[False] = ...,
loop: AbstractEventLoop | None = None,
return_exceptions: Literal[False] = False,
) -> Future[tuple[_T1, _T2]]: ...
@overload
def gather( # type: ignore[misc]
@@ -161,8 +161,8 @@ else:
__coro_or_future2: _FutureLike[_T2],
__coro_or_future3: _FutureLike[_T3],
*,
loop: AbstractEventLoop | None = ...,
return_exceptions: Literal[False] = ...,
loop: AbstractEventLoop | None = None,
return_exceptions: Literal[False] = False,
) -> Future[tuple[_T1, _T2, _T3]]: ...
@overload
def gather( # type: ignore[misc]
@@ -171,8 +171,8 @@ else:
__coro_or_future3: _FutureLike[_T3],
__coro_or_future4: _FutureLike[_T4],
*,
loop: AbstractEventLoop | None = ...,
return_exceptions: Literal[False] = ...,
loop: AbstractEventLoop | None = None,
return_exceptions: Literal[False] = False,
) -> Future[tuple[_T1, _T2, _T3, _T4]]: ...
@overload
def gather( # type: ignore[misc]
@@ -182,19 +182,19 @@ else:
__coro_or_future4: _FutureLike[_T4],
__coro_or_future5: _FutureLike[_T5],
*,
loop: AbstractEventLoop | None = ...,
return_exceptions: Literal[False] = ...,
loop: AbstractEventLoop | None = None,
return_exceptions: Literal[False] = False,
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
@overload
def gather( # type: ignore[misc]
__coro_or_future1: _FutureLike[_T1], *, loop: AbstractEventLoop | None = ..., return_exceptions: bool
__coro_or_future1: _FutureLike[_T1], *, loop: AbstractEventLoop | None = None, return_exceptions: bool
) -> Future[tuple[_T1 | BaseException]]: ...
@overload
def gather( # type: ignore[misc]
__coro_or_future1: _FutureLike[_T1],
__coro_or_future2: _FutureLike[_T2],
*,
loop: AbstractEventLoop | None = ...,
loop: AbstractEventLoop | None = None,
return_exceptions: bool,
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException]]: ...
@overload
@@ -203,7 +203,7 @@ else:
__coro_or_future2: _FutureLike[_T2],
__coro_or_future3: _FutureLike[_T3],
*,
loop: AbstractEventLoop | None = ...,
loop: AbstractEventLoop | None = None,
return_exceptions: bool,
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ...
@overload
@@ -213,7 +213,7 @@ else:
__coro_or_future3: _FutureLike[_T3],
__coro_or_future4: _FutureLike[_T4],
*,
loop: AbstractEventLoop | None = ...,
loop: AbstractEventLoop | None = None,
return_exceptions: bool,
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ...
@overload
@@ -224,14 +224,14 @@ else:
__coro_or_future4: _FutureLike[_T4],
__coro_or_future5: _FutureLike[_T5],
*,
loop: AbstractEventLoop | None = ...,
loop: AbstractEventLoop | None = None,
return_exceptions: bool,
) -> Future[
tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
]: ...
@overload
def gather( # type: ignore[misc]
*coros_or_futures: _FutureLike[Any], loop: AbstractEventLoop | None = ..., return_exceptions: bool = ...
*coros_or_futures: _FutureLike[Any], loop: AbstractEventLoop | None = None, return_exceptions: bool = False
) -> Future[list[Any]]: ...
def run_coroutine_threadsafe(coro: _FutureLike[_T], loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ...
@@ -243,28 +243,36 @@ if sys.version_info >= (3, 10):
@overload
async def sleep(delay: float, result: _T) -> _T: ...
@overload
async def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> tuple[set[_FT], set[_FT]]: ... # type: ignore[misc]
async def wait(fs: Iterable[_FT], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED") -> tuple[set[_FT], set[_FT]]: ... # type: ignore[misc]
@overload
async def wait(
fs: Iterable[Awaitable[_T]], *, timeout: float | None = ..., return_when: str = ...
fs: Iterable[Awaitable[_T]], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED"
) -> tuple[set[Task[_T]], set[Task[_T]]]: ...
async def wait_for(fut: _FutureLike[_T], timeout: float | None) -> _T: ...
else:
def shield(arg: _FutureLike[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ...
def shield(arg: _FutureLike[_T], *, loop: AbstractEventLoop | None = None) -> Future[_T]: ...
@overload
async def sleep(delay: float, *, loop: AbstractEventLoop | None = ...) -> None: ...
async def sleep(delay: float, *, loop: AbstractEventLoop | None = None) -> None: ...
@overload
async def sleep(delay: float, result: _T, *, loop: AbstractEventLoop | None = ...) -> _T: ...
async def sleep(delay: float, result: _T, *, loop: AbstractEventLoop | None = None) -> _T: ...
@overload
async def wait( # type: ignore[misc]
fs: Iterable[_FT], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...
fs: Iterable[_FT],
*,
loop: AbstractEventLoop | None = None,
timeout: float | None = None,
return_when: str = "ALL_COMPLETED",
) -> tuple[set[_FT], set[_FT]]: ...
@overload
async def wait(
fs: Iterable[Awaitable[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...
fs: Iterable[Awaitable[_T]],
*,
loop: AbstractEventLoop | None = None,
timeout: float | None = None,
return_when: str = "ALL_COMPLETED",
) -> tuple[set[Task[_T]], set[Task[_T]]]: ...
async def wait_for(fut: _FutureLike[_T], timeout: float | None, *, loop: AbstractEventLoop | None = ...) -> _T: ...
async def wait_for(fut: _FutureLike[_T], timeout: float | None, *, loop: AbstractEventLoop | None = None) -> _T: ...
# mypy and pyright complain that a subclass of an invariant class shouldn't be covariant.
# While this is true in general, here it's sort-of okay to have a covariant subclass,
@@ -295,9 +303,9 @@ class Task(Future[_T_co], Generic[_T_co]): # type: ignore[type-var] # pyright:
def uncancel(self) -> int: ...
if sys.version_info < (3, 9):
@classmethod
def current_task(cls, loop: AbstractEventLoop | None = ...) -> Task[Any] | None: ...
def current_task(cls, loop: AbstractEventLoop | None = None) -> Task[Any] | None: ...
@classmethod
def all_tasks(cls, loop: AbstractEventLoop | None = ...) -> set[Task[Any]]: ...
def all_tasks(cls, loop: AbstractEventLoop | None = None) -> set[Task[Any]]: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
@@ -309,7 +317,7 @@ if sys.version_info >= (3, 11):
) -> Task[_T]: ...
elif sys.version_info >= (3, 8):
def create_task(coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = ...) -> Task[_T]: ...
def create_task(coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = None) -> Task[_T]: ...
else:
def create_task(coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T]) -> Task[_T]: ...

View File

@@ -33,7 +33,7 @@ if sys.platform == "win32":
class _WindowsSelectorEventLoop(selector_events.BaseSelectorEventLoop): ...
class ProactorEventLoop(proactor_events.BaseProactorEventLoop):
def __init__(self, proactor: IocpProactor | None = ...) -> None: ...
def __init__(self, proactor: IocpProactor | None = None) -> None: ...
async def create_pipe_connection(
self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str
) -> tuple[proactor_events._ProactorDuplexPipeTransport, streams.StreamReaderProtocol]: ...
@@ -45,10 +45,10 @@ if sys.platform == "win32":
def __init__(self, concurrency: int = ...) -> None: ...
def __del__(self) -> None: ...
def set_loop(self, loop: events.AbstractEventLoop) -> None: ...
def select(self, timeout: int | None = ...) -> list[futures.Future[Any]]: ...
def recv(self, conn: socket.socket, nbytes: int, flags: int = ...) -> futures.Future[bytes]: ...
def recv_into(self, conn: socket.socket, buf: WriteableBuffer, flags: int = ...) -> futures.Future[Any]: ...
def send(self, conn: socket.socket, buf: WriteableBuffer, flags: int = ...) -> futures.Future[Any]: ...
def select(self, timeout: int | None = None) -> list[futures.Future[Any]]: ...
def recv(self, conn: socket.socket, nbytes: int, flags: int = 0) -> futures.Future[bytes]: ...
def recv_into(self, conn: socket.socket, buf: WriteableBuffer, flags: int = 0) -> futures.Future[Any]: ...
def send(self, conn: socket.socket, buf: WriteableBuffer, flags: int = 0) -> futures.Future[Any]: ...
def accept(self, listener: socket.socket) -> futures.Future[Any]: ...
def connect(
self,
@@ -58,7 +58,7 @@ if sys.platform == "win32":
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: str) -> windows_utils.PipeHandle: ...
def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: int | None = ...) -> bool: ...
def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: int | None = None) -> bool: ...
def close(self) -> None: ...
SelectorEventLoop = _WindowsSelectorEventLoop

View File

@@ -16,7 +16,7 @@ if sys.platform == "win32":
BUFSIZE: Literal[8192]
PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT
def pipe(*, duplex: bool = ..., overlapped: tuple[bool, bool] = ..., bufsize: int = ...) -> tuple[int, int]: ...
def pipe(*, duplex: bool = False, overlapped: tuple[bool, bool] = ..., bufsize: int = 8192) -> tuple[int, int]: ...
class PipeHandle:
def __init__(self, handle: int) -> None: ...
@@ -51,8 +51,8 @@ if sys.platform == "win32":
def __init__(
self,
args: subprocess._CMD,
stdin: subprocess._FILE | None = ...,
stdout: subprocess._FILE | None = ...,
stderr: subprocess._FILE | None = ...,
stdin: subprocess._FILE | None = None,
stdout: subprocess._FILE | None = None,
stderr: subprocess._FILE | None = None,
**kwds: Any,
) -> None: ...

View File

@@ -15,12 +15,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: _MapType | None = None) -> None: ...
def poll2(timeout: float = ..., map: _MapType | None = None) -> None: ...
def poll(timeout: float = 0.0, map: _MapType | None = None) -> None: ...
def poll2(timeout: float = 0.0, map: _MapType | None = None) -> None: ...
poll3 = poll2
def loop(timeout: float = ..., use_poll: bool = False, map: _MapType | None = None, count: int | None = None) -> None: ...
def loop(timeout: float = 30.0, use_poll: bool = False, map: _MapType | None = None, count: int | None = None) -> None: ...
# Not really subclass of socket.socket; it's only delegation.
# It is not covariant to it.

View File

@@ -228,14 +228,14 @@ class int:
signed: bool = False,
) -> Self: ...
else:
def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = ...) -> bytes: ...
def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = False) -> bytes: ...
@classmethod
def from_bytes(
cls: type[Self],
bytes: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer,
byteorder: Literal["little", "big"],
*,
signed: bool = ...,
signed: bool = False,
) -> Self: ...
def __add__(self, __x: int) -> int: ...
@@ -432,14 +432,14 @@ class str(Sequence[str]):
) -> bool: ...
if sys.version_info >= (3, 8):
@overload
def expandtabs(self: LiteralString, tabsize: SupportsIndex = ...) -> LiteralString: ...
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
@overload
def expandtabs(self, tabsize: SupportsIndex = ...) -> str: ... # type: ignore[misc]
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
else:
@overload
def expandtabs(self: LiteralString, tabsize: int = ...) -> LiteralString: ...
def expandtabs(self: LiteralString, tabsize: int = 8) -> LiteralString: ...
@overload
def expandtabs(self, tabsize: int = ...) -> str: ... # type: ignore[misc]
def expandtabs(self, tabsize: int = 8) -> str: ... # type: ignore[misc]
def find(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
@overload
@@ -507,21 +507,21 @@ class str(Sequence[str]):
@overload
def rpartition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc]
@overload
def rsplit(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ...
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
@overload
def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc]
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
@overload
def rstrip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ...
@overload
def rstrip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc]
@overload
def split(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ...
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
@overload
def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc]
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
@overload
def splitlines(self: LiteralString, keepends: bool = ...) -> list[LiteralString]: ...
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
@overload
def splitlines(self, keepends: bool = ...) -> list[str]: ... # type: ignore[misc]
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
def startswith(
self, __prefix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
@@ -847,7 +847,7 @@ class memoryview(Sequence[int]):
@overload
def __setitem__(self, __i: SupportsIndex, __o: SupportsIndex) -> None: ...
if sys.version_info >= (3, 8):
def tobytes(self, order: Literal["C", "F", "A"] | None = "C") -> bytes: ...
def tobytes(self, order: Literal["C", "F", "A"] | None = ...) -> bytes: ...
else:
def tobytes(self) -> bytes: ...
@@ -976,9 +976,9 @@ class list(MutableSequence[_T], Generic[_T]):
# Use list[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison]
# to work around invariance
@overload
def sort(self: list[SupportsRichComparisonT], *, key: None = ..., reverse: bool = ...) -> None: ...
def sort(self: list[SupportsRichComparisonT], *, key: None = None, reverse: bool = False) -> None: ...
@overload
def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = ...) -> None: ...
def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = False) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
__hash__: ClassVar[None] # type: ignore[assignment]
@@ -1481,13 +1481,13 @@ _Opener: TypeAlias = Callable[[str, int], int]
@overload
def open(
file: FileDescriptorOrPath,
mode: OpenTextMode = ...,
buffering: int = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
closefd: bool = ...,
opener: _Opener | None = ...,
mode: OpenTextMode = "r",
buffering: int = -1,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
closefd: bool = True,
opener: _Opener | None = None,
) -> TextIOWrapper: ...
# Unbuffered binary mode: returns a FileIO
@@ -1496,11 +1496,11 @@ def open(
file: FileDescriptorOrPath,
mode: OpenBinaryMode,
buffering: Literal[0],
encoding: None = ...,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: _Opener | None = ...,
encoding: None = None,
errors: None = None,
newline: None = None,
closefd: bool = True,
opener: _Opener | None = None,
) -> FileIO: ...
# Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter
@@ -1508,34 +1508,34 @@ def open(
def open(
file: FileDescriptorOrPath,
mode: OpenBinaryModeUpdating,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: _Opener | None = ...,
buffering: Literal[-1, 1] = -1,
encoding: None = None,
errors: None = None,
newline: None = None,
closefd: bool = True,
opener: _Opener | None = None,
) -> BufferedRandom: ...
@overload
def open(
file: FileDescriptorOrPath,
mode: OpenBinaryModeWriting,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: _Opener | None = ...,
buffering: Literal[-1, 1] = -1,
encoding: None = None,
errors: None = None,
newline: None = None,
closefd: bool = True,
opener: _Opener | None = None,
) -> BufferedWriter: ...
@overload
def open(
file: FileDescriptorOrPath,
mode: OpenBinaryModeReading,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: _Opener | None = ...,
buffering: Literal[-1, 1] = -1,
encoding: None = None,
errors: None = None,
newline: None = None,
closefd: bool = True,
opener: _Opener | None = None,
) -> BufferedReader: ...
# Buffering cannot be determined: fall back to BinaryIO
@@ -1543,12 +1543,12 @@ def open(
def open(
file: FileDescriptorOrPath,
mode: OpenBinaryMode,
buffering: int = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: _Opener | None = ...,
buffering: int = -1,
encoding: None = None,
errors: None = None,
newline: None = None,
closefd: bool = True,
opener: _Opener | None = None,
) -> BinaryIO: ...
# Fallback if mode is not specified
@@ -1556,12 +1556,12 @@ def open(
def open(
file: FileDescriptorOrPath,
mode: str,
buffering: int = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
closefd: bool = ...,
opener: _Opener | None = ...,
buffering: int = -1,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
closefd: bool = True,
opener: _Opener | None = None,
) -> IO[Any]: ...
def ord(__c: str | bytes | bytearray) -> int: ...
@@ -1571,14 +1571,14 @@ class _SupportsWriteAndFlush(SupportsWrite[_T_contra], Protocol[_T_contra]):
@overload
def print(
*values: object,
sep: str | None = ...,
end: str | None = ...,
file: SupportsWrite[str] | None = ...,
flush: Literal[False] = ...,
sep: str | None = " ",
end: str | None = "\n",
file: SupportsWrite[str] | None = None,
flush: Literal[False] = False,
) -> None: ...
@overload
def print(
*values: object, sep: str | None = ..., end: str | None = ..., file: _SupportsWriteAndFlush[str] | None = ..., flush: bool
*values: object, sep: str | None = " ", end: str | None = "\n", file: _SupportsWriteAndFlush[str] | None = None, flush: bool
) -> None: ...
_E = TypeVar("_E", contravariant=True)
@@ -1603,38 +1603,38 @@ if sys.version_info >= (3, 8):
@overload
def pow(base: int, exp: int, mod: int) -> int: ...
@overload
def pow(base: int, exp: Literal[0], mod: None = ...) -> Literal[1]: ... # type: ignore[misc]
def pow(base: int, exp: Literal[0], mod: None = None) -> Literal[1]: ... # type: ignore[misc]
@overload
def pow(base: int, exp: _PositiveInteger, mod: None = ...) -> int: ... # type: ignore[misc]
def pow(base: int, exp: _PositiveInteger, mod: None = None) -> int: ... # type: ignore[misc]
@overload
def pow(base: int, exp: _NegativeInteger, mod: None = ...) -> float: ... # type: ignore[misc]
def pow(base: int, exp: _NegativeInteger, mod: None = None) -> float: ... # type: ignore[misc]
# int base & positive-int exp -> int; int base & negative-int exp -> float
# return type must be Any as `int | float` causes too many false-positive errors
@overload
def pow(base: int, exp: int, mod: None = ...) -> Any: ...
def pow(base: int, exp: int, mod: None = None) -> Any: ...
@overload
def pow(base: _PositiveInteger, exp: float, mod: None = ...) -> float: ...
def pow(base: _PositiveInteger, exp: float, mod: None = None) -> float: ...
@overload
def pow(base: _NegativeInteger, exp: float, mod: None = ...) -> complex: ...
def pow(base: _NegativeInteger, exp: float, mod: None = None) -> complex: ...
@overload
def pow(base: float, exp: int, mod: None = ...) -> float: ...
def pow(base: float, exp: int, mod: None = None) -> float: ...
# float base & float exp could return float or complex
# return type must be Any (same as complex base, complex exp),
# as `float | complex` causes too many false-positive errors
@overload
def pow(base: float, exp: complex | _SupportsSomeKindOfPow, mod: None = ...) -> Any: ...
def pow(base: float, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> Any: ...
@overload
def pow(base: complex, exp: complex | _SupportsSomeKindOfPow, mod: None = ...) -> complex: ...
def pow(base: complex, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> complex: ...
@overload
def pow(base: _SupportsPow2[_E, _T_co], exp: _E, mod: None = ...) -> _T_co: ...
def pow(base: _SupportsPow2[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ...
@overload
def pow(base: _SupportsPow3NoneOnly[_E, _T_co], exp: _E, mod: None = ...) -> _T_co: ...
def pow(base: _SupportsPow3NoneOnly[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ...
@overload
def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M = ...) -> _T_co: ...
@overload
def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = ...) -> Any: ...
def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = None) -> Any: ...
@overload
def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = ...) -> complex: ...
def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex: ...
else:
@overload
@@ -1692,7 +1692,7 @@ class _SupportsRound2(Protocol[_T_co]):
def __round__(self, __ndigits: int) -> _T_co: ...
@overload
def round(number: _SupportsRound1[_T], ndigits: None = ...) -> _T: ...
def round(number: _SupportsRound1[_T], ndigits: None = None) -> _T: ...
@overload
def round(number: _SupportsRound2[_T], ndigits: SupportsIndex) -> _T: ...
@@ -1701,10 +1701,10 @@ def round(number: _SupportsRound2[_T], ndigits: SupportsIndex) -> _T: ...
def setattr(__obj: object, __name: str, __value: Any) -> None: ...
@overload
def sorted(
__iterable: Iterable[SupportsRichComparisonT], *, key: None = ..., reverse: bool = ...
__iterable: Iterable[SupportsRichComparisonT], *, key: None = None, reverse: bool = False
) -> list[SupportsRichComparisonT]: ...
@overload
def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsRichComparison], reverse: bool = ...) -> list[_T]: ...
def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsRichComparison], reverse: bool = False) -> list[_T]: ...
_AddableT1 = TypeVar("_AddableT1", bound=SupportsAdd[Any, Any])
_AddableT2 = TypeVar("_AddableT2", bound=SupportsAdd[Any, Any])
@@ -1719,7 +1719,7 @@ _SupportsSumNoDefaultT = TypeVar("_SupportsSumNoDefaultT", bound=_SupportsSumWit
# Instead, we special-case the most common examples of this: bool and literal integers.
if sys.version_info >= (3, 8):
@overload
def sum(__iterable: Iterable[bool | _LiteralInteger], start: int = ...) -> int: ... # type: ignore[misc]
def sum(__iterable: Iterable[bool | _LiteralInteger], start: int = 0) -> int: ... # type: ignore[misc]
else:
@overload

View File

@@ -30,94 +30,94 @@ _WriteTextMode: TypeAlias = Literal["wt", "xt", "at"]
@overload
def open(
filename: _ReadableFileobj,
mode: _ReadBinaryMode = ...,
compresslevel: int = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
mode: _ReadBinaryMode = "rb",
compresslevel: int = 9,
encoding: None = None,
errors: None = None,
newline: None = None,
) -> BZ2File: ...
@overload
def open(
filename: _ReadableFileobj,
mode: _ReadTextMode,
compresslevel: int = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
compresslevel: int = 9,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
) -> TextIO: ...
@overload
def open(
filename: _WritableFileobj,
mode: _WriteBinaryMode,
compresslevel: int = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
compresslevel: int = 9,
encoding: None = None,
errors: None = None,
newline: None = None,
) -> BZ2File: ...
@overload
def open(
filename: _WritableFileobj,
mode: _WriteTextMode,
compresslevel: int = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
compresslevel: int = 9,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
) -> TextIO: ...
@overload
def open(
filename: StrOrBytesPath,
mode: _ReadBinaryMode | _WriteBinaryMode = ...,
compresslevel: int = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
mode: _ReadBinaryMode | _WriteBinaryMode = "rb",
compresslevel: int = 9,
encoding: None = None,
errors: None = None,
newline: None = None,
) -> BZ2File: ...
@overload
def open(
filename: StrOrBytesPath,
mode: _ReadTextMode | _WriteTextMode,
compresslevel: int = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
compresslevel: int = 9,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
) -> TextIO: ...
@overload
def open(
filename: StrOrBytesPath | _ReadableFileobj | _WritableFileobj,
mode: str,
compresslevel: int = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
compresslevel: int = 9,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
) -> BZ2File | TextIO: ...
class BZ2File(BaseStream, IO[bytes]):
def __enter__(self: Self) -> Self: ...
if sys.version_info >= (3, 9):
@overload
def __init__(self, filename: _WritableFileobj, mode: _WriteBinaryMode, *, compresslevel: int = ...) -> None: ...
def __init__(self, filename: _WritableFileobj, mode: _WriteBinaryMode, *, compresslevel: int = 9) -> None: ...
@overload
def __init__(self, filename: _ReadableFileobj, mode: _ReadBinaryMode = ..., *, compresslevel: int = ...) -> None: ...
def __init__(self, filename: _ReadableFileobj, mode: _ReadBinaryMode = "r", *, compresslevel: int = 9) -> None: ...
@overload
def __init__(
self, filename: StrOrBytesPath, mode: _ReadBinaryMode | _WriteBinaryMode = ..., *, compresslevel: int = ...
self, filename: StrOrBytesPath, mode: _ReadBinaryMode | _WriteBinaryMode = "r", *, compresslevel: int = 9
) -> None: ...
else:
@overload
def __init__(
self, filename: _WritableFileobj, mode: _WriteBinaryMode, buffering: Any | None = ..., compresslevel: int = ...
self, filename: _WritableFileobj, mode: _WriteBinaryMode, buffering: Any | None = None, compresslevel: int = 9
) -> None: ...
@overload
def __init__(
self, filename: _ReadableFileobj, mode: _ReadBinaryMode = ..., buffering: Any | None = ..., compresslevel: int = ...
self, filename: _ReadableFileobj, mode: _ReadBinaryMode = "r", buffering: Any | None = None, compresslevel: int = 9
) -> None: ...
@overload
def __init__(
self,
filename: StrOrBytesPath,
mode: _ReadBinaryMode | _WriteBinaryMode = ...,
buffering: Any | None = ...,
compresslevel: int = ...,
mode: _ReadBinaryMode | _WriteBinaryMode = "r",
buffering: Any | None = None,
compresslevel: int = 9,
) -> None: ...
def read(self, size: int | None = -1) -> bytes: ...

View File

@@ -52,7 +52,7 @@ def print_directory() -> None: ...
def print_environ_usage() -> None: ...
if sys.version_info < (3, 8):
def escape(s: str, quote: bool | None = ...) -> str: ...
def escape(s: str, quote: bool | None = None) -> str: ...
class MiniFieldStorage:
# The first five "Any" attributes here are always None, but mypy doesn't support that

View File

@@ -27,7 +27,7 @@ def atanh(__z: _C) -> complex: ...
def cos(__z: _C) -> complex: ...
def cosh(__z: _C) -> complex: ...
def exp(__z: _C) -> complex: ...
def isclose(a: _C, b: _C, *, rel_tol: SupportsFloat = ..., abs_tol: SupportsFloat = ...) -> bool: ...
def isclose(a: _C, b: _C, *, rel_tol: SupportsFloat = 1e-09, abs_tol: SupportsFloat = 0.0) -> bool: ...
def isinf(__z: _C) -> bool: ...
def isnan(__z: _C) -> bool: ...
def log(__x: _C, __y_obj: _C = ...) -> complex: ...

View File

@@ -128,7 +128,7 @@ def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ...
def getreader(encoding: str) -> _StreamReader: ...
def getwriter(encoding: str) -> _StreamWriter: ...
def open(
filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = -1
filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = ...
) -> StreamReaderWriter: ...
def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = None, errors: str = "strict") -> StreamRecoder: ...
def iterencode(iterator: Iterable[str], encoding: str, errors: str = "strict") -> Generator[bytes, None, None]: ...

View File

@@ -76,7 +76,7 @@ class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
# See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963.
@classmethod
@overload
def fromkeys(cls, iterable: Iterable[_T], value: None = ...) -> UserDict[_T, Any | None]: ...
def fromkeys(cls, iterable: Iterable[_T], value: None = None) -> UserDict[_T, Any | None]: ...
@classmethod
@overload
def fromkeys(cls, iterable: Iterable[_T], value: _S) -> UserDict[_T, _S]: ...
@@ -92,7 +92,7 @@ class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
class UserList(MutableSequence[_T]):
data: list[_T]
@overload
def __init__(self, initlist: None = ...) -> None: ...
def __init__(self, initlist: None = None) -> None: ...
@overload
def __init__(self, initlist: Iterable[_T]) -> None: ...
def __lt__(self, other: list[_T] | UserList[_T]) -> bool: ...
@@ -167,7 +167,7 @@ class UserString(Sequence[UserString]):
if sys.version_info >= (3, 8):
def encode(self: UserString, encoding: str | None = "utf-8", errors: str | None = "strict") -> bytes: ...
else:
def encode(self: Self, encoding: str | None = ..., errors: str | None = ...) -> Self: ...
def encode(self: Self, encoding: str | None = None, errors: str | None = None) -> Self: ...
def endswith(self, suffix: str | tuple[str, ...], start: int | None = 0, end: int | None = sys.maxsize) -> bool: ...
def expandtabs(self: Self, tabsize: int = 8) -> Self: ...
@@ -353,7 +353,7 @@ class OrderedDict(dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
# See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963.
@classmethod
@overload
def fromkeys(cls, iterable: Iterable[_T], value: None = ...) -> OrderedDict[_T, Any | None]: ...
def fromkeys(cls, iterable: Iterable[_T], value: None = None) -> OrderedDict[_T, Any | None]: ...
@classmethod
@overload
def fromkeys(cls, iterable: Iterable[_T], value: _S) -> OrderedDict[_T, _S]: ...

View File

@@ -45,59 +45,59 @@ if sys.version_info >= (3, 10):
elif sys.version_info >= (3, 9):
def compile_dir(
dir: StrPath,
maxlevels: int | None = ...,
ddir: StrPath | None = ...,
force: bool = ...,
rx: _SupportsSearch | None = ...,
quiet: int = ...,
legacy: bool = ...,
optimize: int = ...,
workers: int = ...,
invalidation_mode: PycInvalidationMode | None = ...,
maxlevels: int | None = None,
ddir: StrPath | None = None,
force: bool = False,
rx: _SupportsSearch | None = None,
quiet: int = 0,
legacy: bool = False,
optimize: int = -1,
workers: int = 1,
invalidation_mode: PycInvalidationMode | None = None,
*,
stripdir: str | None = ..., # https://bugs.python.org/issue40447
prependdir: StrPath | None = ...,
limit_sl_dest: StrPath | None = ...,
hardlink_dupes: bool = ...,
stripdir: str | None = None, # https://bugs.python.org/issue40447
prependdir: StrPath | None = None,
limit_sl_dest: StrPath | None = None,
hardlink_dupes: bool = False,
) -> int: ...
def compile_file(
fullname: StrPath,
ddir: StrPath | None = ...,
force: bool = ...,
rx: _SupportsSearch | None = ...,
quiet: int = ...,
legacy: bool = ...,
optimize: int = ...,
invalidation_mode: PycInvalidationMode | None = ...,
ddir: StrPath | None = None,
force: bool = False,
rx: _SupportsSearch | None = None,
quiet: int = 0,
legacy: bool = False,
optimize: int = -1,
invalidation_mode: PycInvalidationMode | None = None,
*,
stripdir: str | None = ..., # https://bugs.python.org/issue40447
prependdir: StrPath | None = ...,
limit_sl_dest: StrPath | None = ...,
hardlink_dupes: bool = ...,
stripdir: str | None = None, # https://bugs.python.org/issue40447
prependdir: StrPath | None = None,
limit_sl_dest: StrPath | None = None,
hardlink_dupes: bool = False,
) -> int: ...
else:
def compile_dir(
dir: StrPath,
maxlevels: int = ...,
ddir: StrPath | None = ...,
force: bool = ...,
rx: _SupportsSearch | None = ...,
quiet: int = ...,
legacy: bool = ...,
optimize: int = ...,
workers: int = ...,
invalidation_mode: PycInvalidationMode | None = ...,
maxlevels: int = 10,
ddir: StrPath | None = None,
force: bool = False,
rx: _SupportsSearch | None = None,
quiet: int = 0,
legacy: bool = False,
optimize: int = -1,
workers: int = 1,
invalidation_mode: PycInvalidationMode | None = None,
) -> int: ...
def compile_file(
fullname: StrPath,
ddir: StrPath | None = ...,
force: bool = ...,
rx: _SupportsSearch | None = ...,
quiet: int = ...,
legacy: bool = ...,
optimize: int = ...,
invalidation_mode: PycInvalidationMode | None = ...,
ddir: StrPath | None = None,
force: bool = False,
rx: _SupportsSearch | None = None,
quiet: int = 0,
legacy: bool = False,
optimize: int = -1,
invalidation_mode: PycInvalidationMode | None = None,
) -> int: ...
def compile_path(

View File

@@ -60,7 +60,7 @@ class Executor:
if sys.version_info >= (3, 9):
def shutdown(self, wait: bool = True, *, cancel_futures: bool = False) -> None: ...
else:
def shutdown(self, wait: bool = ...) -> None: ...
def shutdown(self, wait: bool = True) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(

View File

@@ -58,7 +58,7 @@ class _ResultItem:
self, work_id: int, exception: Exception | None = None, result: Any | None = None, exit_pid: int | None = None
) -> None: ...
else:
def __init__(self, work_id: int, exception: Exception | None = ..., result: Any | None = ...) -> None: ...
def __init__(self, work_id: int, exception: Exception | None = None, result: Any | None = None) -> None: ...
class _CallItem:
work_id: int
@@ -83,7 +83,7 @@ class _SafeQueue(Queue[Future[Any]]):
) -> None: ...
else:
def __init__(
self, max_size: int | None = ..., *, ctx: BaseContext, pending_work_items: dict[int, _WorkItem[Any]]
self, max_size: int | None = 0, *, ctx: BaseContext, pending_work_items: dict[int, _WorkItem[Any]]
) -> None: ...
def _on_queue_feeder_error(self, e: Exception, obj: _CallItem) -> None: ...
@@ -102,7 +102,7 @@ if sys.version_info >= (3, 11):
else:
def _sendback_result(
result_queue: SimpleQueue[_WorkItem[Any]], work_id: int, result: Any | None = ..., exception: Exception | None = ...
result_queue: SimpleQueue[_WorkItem[Any]], work_id: int, result: Any | None = None, exception: Exception | None = None
) -> None: ...
if sys.version_info >= (3, 11):
@@ -181,9 +181,9 @@ class ProcessPoolExecutor(Executor):
else:
def __init__(
self,
max_workers: int | None = ...,
mp_context: BaseContext | None = ...,
initializer: Callable[..., object] | None = ...,
max_workers: int | None = None,
mp_context: BaseContext | None = None,
initializer: Callable[..., object] | None = None,
initargs: tuple[Any, ...] = ...,
) -> None: ...
if sys.version_info >= (3, 9):

View File

@@ -65,32 +65,32 @@ class RawConfigParser(_Parser):
@overload
def __init__(
self,
defaults: Mapping[str, str | None] | None = ...,
defaults: Mapping[str, str | None] | None = None,
dict_type: type[Mapping[str, str]] = ...,
allow_no_value: Literal[True] = ...,
*,
delimiters: Sequence[str] = ...,
comment_prefixes: Sequence[str] = ...,
inline_comment_prefixes: Sequence[str] | None = ...,
strict: bool = ...,
empty_lines_in_values: bool = ...,
default_section: str = ...,
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
default_section: str = "DEFAULT",
interpolation: Interpolation | None = ...,
converters: _ConvertersMap = ...,
) -> None: ...
@overload
def __init__(
self,
defaults: _Section | None = ...,
defaults: _Section | None = None,
dict_type: type[Mapping[str, str]] = ...,
allow_no_value: bool = ...,
allow_no_value: bool = False,
*,
delimiters: Sequence[str] = ...,
comment_prefixes: Sequence[str] = ...,
inline_comment_prefixes: Sequence[str] | None = ...,
strict: bool = ...,
empty_lines_in_values: bool = ...,
default_section: str = ...,
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
default_section: str = "DEFAULT",
interpolation: Interpolation | None = ...,
converters: _ConvertersMap = ...,
) -> None: ...
@@ -114,22 +114,22 @@ class RawConfigParser(_Parser):
# These get* methods are partially applied (with the same names) in
# SectionProxy; the stubs should be kept updated together
@overload
def getint(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> int: ...
def getint(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> int: ...
@overload
def getint(
self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ...
self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T = ...
) -> int | _T: ...
@overload
def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> float: ...
def getfloat(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> float: ...
@overload
def getfloat(
self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ...
self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T = ...
) -> float | _T: ...
@overload
def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> bool: ...
def getboolean(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> bool: ...
@overload
def getboolean(
self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ...
self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T = ...
) -> bool | _T: ...
def _get_conv(
self,
@@ -143,13 +143,15 @@ class RawConfigParser(_Parser):
) -> _T: ...
# This is incompatible with MutableMapping so we ignore the type
@overload # type: ignore[override]
def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> str | Any: ...
def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> str | Any: ...
@overload
def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T) -> str | _T | Any: ...
def get(
self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T
) -> str | _T | Any: ...
@overload
def items(self, *, raw: bool = ..., vars: _Section | None = ...) -> ItemsView[str, SectionProxy]: ...
def items(self, *, raw: bool = False, vars: _Section | None = None) -> ItemsView[str, SectionProxy]: ...
@overload
def items(self, section: str, raw: bool = ..., vars: _Section | None = ...) -> list[tuple[str, str]]: ...
def items(self, section: str, raw: bool = False, vars: _Section | None = None) -> list[tuple[str, str]]: ...
def set(self, section: str, option: str, value: str | None = None) -> None: ...
def write(self, fp: SupportsWrite[str], space_around_delimiters: bool = True) -> None: ...
def remove_option(self, section: str, option: str) -> bool: ...
@@ -159,9 +161,9 @@ class RawConfigParser(_Parser):
class ConfigParser(RawConfigParser):
# This is incompatible with MutableMapping so we ignore the type
@overload # type: ignore[override]
def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> str: ...
def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> str: ...
@overload
def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T) -> str | _T: ...
def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T) -> str | _T: ...
if sys.version_info < (3, 12):
class SafeConfigParser(ConfigParser): ... # deprecated alias

View File

@@ -174,7 +174,7 @@ if sys.version_info >= (3, 10):
class nullcontext(AbstractContextManager[_T], AbstractAsyncContextManager[_T]):
enter_result: _T
@overload
def __init__(self: nullcontext[None], enter_result: None = ...) -> None: ...
def __init__(self: nullcontext[None], enter_result: None = None) -> None: ...
@overload
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
def __enter__(self) -> _T: ...
@@ -186,7 +186,7 @@ else:
class nullcontext(AbstractContextManager[_T]):
enter_result: _T
@overload
def __init__(self: nullcontext[None], enter_result: None = ...) -> None: ...
def __init__(self: nullcontext[None], enter_result: None = None) -> None: ...
@overload
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
def __enter__(self) -> _T: ...

View File

@@ -76,9 +76,9 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T | Any, str | Any]]):
self,
f: Iterable[str],
fieldnames: Sequence[_T],
restkey: str | None = ...,
restval: str | None = ...,
dialect: _DialectLike = ...,
restkey: str | None = None,
restval: str | None = None,
dialect: _DialectLike = "excel",
*,
delimiter: str = ...,
quotechar: str | None = ...,
@@ -93,10 +93,10 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T | Any, str | Any]]):
def __init__(
self: DictReader[str],
f: Iterable[str],
fieldnames: Sequence[str] | None = ...,
restkey: str | None = ...,
restval: str | None = ...,
dialect: _DialectLike = ...,
fieldnames: Sequence[str] | None = None,
restkey: str | None = None,
restval: str | None = None,
dialect: _DialectLike = "excel",
*,
delimiter: str = ...,
quotechar: str | None = ...,

View File

@@ -33,7 +33,12 @@ class CDLL:
) -> None: ...
else:
def __init__(
self, name: str | None, mode: int = ..., handle: int | None = ..., use_errno: bool = ..., use_last_error: bool = ...
self,
name: str | None,
mode: int = ...,
handle: int | None = None,
use_errno: bool = False,
use_last_error: bool = False,
) -> None: ...
def __getattr__(self, name: str) -> _NamedFuncPointer: ...
@@ -181,7 +186,7 @@ def sizeof(obj_or_type: _CData | type[_CData]) -> int: ...
def string_at(address: _CVoidConstPLike, size: int = -1) -> bytes: ...
if sys.platform == "win32":
def WinError(code: int | None = ..., descr: str | None = ...) -> OSError: ...
def WinError(code: int | None = None, descr: str | None = None) -> OSError: ...
def wstring_at(address: _CVoidConstPLike, size: int = -1) -> str: ...

View File

@@ -74,37 +74,43 @@ if sys.version_info >= (3, 11):
@overload
def dataclass(
*,
init: bool = ...,
repr: bool = ...,
eq: bool = ...,
order: bool = ...,
unsafe_hash: bool = ...,
frozen: bool = ...,
match_args: bool = ...,
kw_only: bool = ...,
slots: bool = ...,
weakref_slot: bool = ...,
init: bool = True,
repr: bool = True,
eq: bool = True,
order: bool = False,
unsafe_hash: bool = False,
frozen: bool = False,
match_args: bool = True,
kw_only: bool = False,
slots: bool = False,
weakref_slot: bool = False,
) -> Callable[[type[_T]], type[_T]]: ...
elif sys.version_info >= (3, 10):
@overload
def dataclass(
*,
init: bool = ...,
repr: bool = ...,
eq: bool = ...,
order: bool = ...,
unsafe_hash: bool = ...,
frozen: bool = ...,
match_args: bool = ...,
kw_only: bool = ...,
slots: bool = ...,
init: bool = True,
repr: bool = True,
eq: bool = True,
order: bool = False,
unsafe_hash: bool = False,
frozen: bool = False,
match_args: bool = True,
kw_only: bool = False,
slots: bool = False,
) -> Callable[[type[_T]], type[_T]]: ...
else:
@overload
def dataclass(
*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ...
*,
init: bool = True,
repr: bool = True,
eq: bool = True,
order: bool = False,
unsafe_hash: bool = False,
frozen: bool = False,
) -> Callable[[type[_T]], type[_T]]: ...
# See https://github.com/python/mypy/issues/10750
@@ -157,32 +163,32 @@ if sys.version_info >= (3, 10):
def field(
*,
default: _T,
init: bool = ...,
repr: bool = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Mapping[Any, Any] | None = ...,
init: bool = True,
repr: bool = True,
hash: bool | None = None,
compare: bool = True,
metadata: Mapping[Any, Any] | None = None,
kw_only: bool = ...,
) -> _T: ...
@overload
def field(
*,
default_factory: Callable[[], _T],
init: bool = ...,
repr: bool = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Mapping[Any, Any] | None = ...,
init: bool = True,
repr: bool = True,
hash: bool | None = None,
compare: bool = True,
metadata: Mapping[Any, Any] | None = None,
kw_only: bool = ...,
) -> _T: ...
@overload
def field(
*,
init: bool = ...,
repr: bool = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Mapping[Any, Any] | None = ...,
init: bool = True,
repr: bool = True,
hash: bool | None = None,
compare: bool = True,
metadata: Mapping[Any, Any] | None = None,
kw_only: bool = ...,
) -> Any: ...
@@ -191,30 +197,30 @@ else:
def field(
*,
default: _T,
init: bool = ...,
repr: bool = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Mapping[Any, Any] | None = ...,
init: bool = True,
repr: bool = True,
hash: bool | None = None,
compare: bool = True,
metadata: Mapping[Any, Any] | None = None,
) -> _T: ...
@overload
def field(
*,
default_factory: Callable[[], _T],
init: bool = ...,
repr: bool = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Mapping[Any, Any] | None = ...,
init: bool = True,
repr: bool = True,
hash: bool | None = None,
compare: bool = True,
metadata: Mapping[Any, Any] | None = None,
) -> _T: ...
@overload
def field(
*,
init: bool = ...,
repr: bool = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Mapping[Any, Any] | None = ...,
init: bool = True,
repr: bool = True,
hash: bool | None = None,
compare: bool = True,
metadata: Mapping[Any, Any] | None = None,
) -> Any: ...
def fields(class_or_instance: _DataclassInstance | type[_DataclassInstance]) -> tuple[Field[Any], ...]: ...
@@ -268,16 +274,16 @@ elif sys.version_info >= (3, 10):
fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]],
*,
bases: tuple[type, ...] = ...,
namespace: dict[str, Any] | None = ...,
init: bool = ...,
repr: bool = ...,
eq: bool = ...,
order: bool = ...,
unsafe_hash: bool = ...,
frozen: bool = ...,
match_args: bool = ...,
kw_only: bool = ...,
slots: bool = ...,
namespace: dict[str, Any] | None = None,
init: bool = True,
repr: bool = True,
eq: bool = True,
order: bool = False,
unsafe_hash: bool = False,
frozen: bool = False,
match_args: bool = True,
kw_only: bool = False,
slots: bool = False,
) -> type: ...
else:
@@ -286,13 +292,13 @@ else:
fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]],
*,
bases: tuple[type, ...] = ...,
namespace: dict[str, Any] | None = ...,
init: bool = ...,
repr: bool = ...,
eq: bool = ...,
order: bool = ...,
unsafe_hash: bool = ...,
frozen: bool = ...,
namespace: dict[str, Any] | None = None,
init: bool = True,
repr: bool = True,
eq: bool = True,
order: bool = False,
unsafe_hash: bool = False,
frozen: bool = False,
) -> type: ...
def replace(__obj: _DataclassT, **changes: Any) -> _DataclassT: ...

View File

@@ -265,7 +265,7 @@ class datetime(date):
else:
@overload
@classmethod
def now(cls: type[Self], tz: None = ...) -> Self: ...
def now(cls: type[Self], tz: None = None) -> Self: ...
@overload
@classmethod
def now(cls, tz: _TzInfo) -> datetime: ...

View File

@@ -29,16 +29,16 @@ class Match(NamedTuple):
class SequenceMatcher(Generic[_T]):
@overload
def __init__(self, isjunk: Callable[[_T], bool] | None, a: Sequence[_T], b: Sequence[_T], autojunk: bool = ...) -> None: ...
def __init__(self, isjunk: Callable[[_T], bool] | None, a: Sequence[_T], b: Sequence[_T], autojunk: bool = True) -> None: ...
@overload
def __init__(self, *, a: Sequence[_T], b: Sequence[_T], autojunk: bool = ...) -> None: ...
def __init__(self, *, a: Sequence[_T], b: Sequence[_T], autojunk: bool = True) -> None: ...
@overload
def __init__(
self: SequenceMatcher[str],
isjunk: Callable[[str], bool] | None = ...,
a: Sequence[str] = ...,
b: Sequence[str] = ...,
autojunk: bool = ...,
isjunk: Callable[[str], bool] | None = None,
a: Sequence[str] = "",
b: Sequence[str] = "",
autojunk: bool = True,
) -> None: ...
def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ...
def set_seq1(self, a: Sequence[_T]) -> None: ...
@@ -59,10 +59,10 @@ class SequenceMatcher(Generic[_T]):
# mypy thinks the signatures of the overloads overlap, but the types still work fine
@overload
def get_close_matches(word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ...) -> list[AnyStr]: ... # type: ignore[misc]
def get_close_matches(word: AnyStr, possibilities: Iterable[AnyStr], n: int = 3, cutoff: float = 0.6) -> list[AnyStr]: ... # type: ignore[misc]
@overload
def get_close_matches(
word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = ..., cutoff: float = ...
word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = 3, cutoff: float = 0.6
) -> list[Sequence[_T]]: ...
class Differ:

View File

@@ -86,7 +86,9 @@ class Bytecode:
cls: type[Self], tb: types.TracebackType, *, show_caches: bool = False, adaptive: bool = False
) -> Self: ...
else:
def __init__(self, x: _HaveCodeType | str, *, first_line: int | None = ..., current_offset: int | None = ...) -> None: ...
def __init__(
self, x: _HaveCodeType | str, *, first_line: int | None = None, current_offset: int | None = None
) -> None: ...
@classmethod
def from_traceback(cls: type[Self], tb: types.TracebackType) -> Self: ...
@@ -113,7 +115,7 @@ if sys.version_info >= (3, 11):
else:
def dis(
x: _HaveCodeType | str | bytes | bytearray | None = ..., *, file: IO[str] | None = ..., depth: int | None = ...
x: _HaveCodeType | str | bytes | bytearray | None = None, *, file: IO[str] | None = None, depth: int | None = None
) -> None: ...
if sys.version_info >= (3, 11):
@@ -131,9 +133,9 @@ if sys.version_info >= (3, 11):
) -> Iterator[Instruction]: ...
else:
def disassemble(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ...
def disco(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ...
def distb(tb: types.TracebackType | None = ..., *, file: IO[str] | None = ...) -> None: ...
def get_instructions(x: _HaveCodeType, *, first_line: int | None = ...) -> Iterator[Instruction]: ...
def disassemble(co: _HaveCodeType, lasti: int = -1, *, file: IO[str] | None = None) -> None: ...
def disco(co: _HaveCodeType, lasti: int = -1, *, file: IO[str] | None = None) -> None: ...
def distb(tb: types.TracebackType | None = None, *, file: IO[str] | None = None) -> None: ...
def get_instructions(x: _HaveCodeType, *, first_line: int | None = None) -> Iterator[Instruction]: ...
def show_code(co: _HaveCodeType, *, file: IO[str] | None = None) -> None: ...

View File

@@ -9,9 +9,9 @@ if sys.platform == "win32":
class PyDialog(Dialog):
def __init__(self, *args, **kw) -> None: ...
def title(self, title) -> None: ...
def back(self, title, next, name: str = ..., active: int = ...): ...
def cancel(self, title, next, name: str = ..., active: int = ...): ...
def next(self, title, next, name: str = ..., active: int = ...): ...
def back(self, title, next, name: str = "Back", active: int = 1): ...
def cancel(self, title, next, name: str = "Cancel", active: int = 1): ...
def next(self, title, next, name: str = "Next", active: int = 1): ...
def xbutton(self, name, title, next, xpos): ...
class bdist_msi(Command):

View File

@@ -11,6 +11,6 @@ class bdist_wininst(Command):
def finalize_options(self) -> None: ...
def run(self) -> None: ...
def get_inidata(self) -> str: ...
def create_exe(self, arcname: StrOrBytesPath, fullname: str, bitmap: StrOrBytesPath | None = ...) -> None: ...
def create_exe(self, arcname: StrOrBytesPath, fullname: str, bitmap: StrOrBytesPath | None = None) -> None: ...
def get_installer_filename(self, fullname: str) -> str: ...
def get_exe_bytes(self) -> bytes: ...

View File

@@ -14,7 +14,7 @@ class FancyGetopt:
def __init__(self, option_table: list[_Option] | None = None) -> None: ...
# TODO kinda wrong, `getopt(object=object())` is invalid
@overload
def getopt(self, args: list[str] | None = ...) -> _GR: ...
def getopt(self, args: list[str] | None = None) -> _GR: ...
@overload
def getopt(self, args: list[str] | None, object: Any) -> list[str]: ...
def get_option_order(self) -> list[tuple[str, str]]: ...

View File

@@ -18,34 +18,34 @@ class FileList:
def process_template_line(self, line: str) -> None: ...
@overload
def include_pattern(
self, pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ...
self, pattern: str, anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: Literal[0, False] = 0
) -> bool: ...
@overload
def include_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ...
@overload
def include_pattern(
self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ...
self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: int = 0
) -> bool: ...
@overload
def exclude_pattern(
self, pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ...
self, pattern: str, anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: Literal[0, False] = 0
) -> bool: ...
@overload
def exclude_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ...
@overload
def exclude_pattern(
self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ...
self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: int = 0
) -> bool: ...
def findall(dir: str = ".") -> list[str]: ...
def glob_to_re(pattern: str) -> str: ...
@overload
def translate_pattern(
pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[False, 0] = ...
pattern: str, anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: Literal[False, 0] = 0
) -> Pattern[str]: ...
@overload
def translate_pattern(pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> Pattern[str]: ...
@overload
def translate_pattern(
pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ...
pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: int = 0
) -> Pattern[str]: ...

View File

@@ -7,7 +7,7 @@ ERROR: int
FATAL: int
class Log:
def __init__(self, threshold: int = 3) -> None: ...
def __init__(self, threshold: int = ...) -> None: ...
def log(self, level: int, msg: str, *args: Any) -> None: ...
def debug(self, msg: str, *args: Any) -> None: ...
def info(self, msg: str, *args: Any) -> None: ...

View File

@@ -9,7 +9,7 @@ _MessageT = TypeVar("_MessageT", bound=Message)
class FeedParser(Generic[_MessageT]):
@overload
def __init__(self: FeedParser[Message], _factory: None = ..., *, policy: Policy = ...) -> None: ...
def __init__(self: FeedParser[Message], _factory: None = None, *, policy: Policy = ...) -> None: ...
@overload
def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
def feed(self, data: str) -> None: ...
@@ -17,7 +17,7 @@ class FeedParser(Generic[_MessageT]):
class BytesFeedParser(Generic[_MessageT]):
@overload
def __init__(self: BytesFeedParser[Message], _factory: None = ..., *, policy: Policy = ...) -> None: ...
def __init__(self: BytesFeedParser[Message], _factory: None = None, *, policy: Policy = ...) -> None: ...
@overload
def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
def feed(self, data: bytes | bytearray) -> None: ...

View File

@@ -112,7 +112,7 @@ class EnumMeta(ABCMeta):
def __dir__(self) -> list[str]: ...
# Simple value lookup
@overload # type: ignore[override]
def __call__(cls: type[_EnumMemberT], value: Any, names: None = ...) -> _EnumMemberT: ...
def __call__(cls: type[_EnumMemberT], value: Any, names: None = None) -> _EnumMemberT: ...
# Functional Enum API
if sys.version_info >= (3, 11):
@overload
@@ -121,11 +121,11 @@ class EnumMeta(ABCMeta):
value: str,
names: _EnumNames,
*,
module: str | None = ...,
qualname: str | None = ...,
type: type | None = ...,
start: int = ...,
boundary: FlagBoundary | None = ...,
module: str | None = None,
qualname: str | None = None,
type: type | None = None,
start: int = 1,
boundary: FlagBoundary | None = None,
) -> type[Enum]: ...
else:
@overload
@@ -134,10 +134,10 @@ class EnumMeta(ABCMeta):
value: str,
names: _EnumNames,
*,
module: str | None = ...,
qualname: str | None = ...,
type: type | None = ...,
start: int = ...,
module: str | None = None,
qualname: str | None = None,
type: type | None = None,
start: int = 1,
) -> type[Enum]: ...
_member_names_: list[str] # undocumented
_member_map_: dict[str, Enum] # undocumented

View File

@@ -36,89 +36,89 @@ if sys.version_info >= (3, 10):
# encoding and errors are added
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: _TextMode = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
mode: _TextMode = "r",
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = None,
encoding: str | None = None,
errors: str | None = None,
) -> FileInput[str]: ...
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ...,
encoding: None = ...,
errors: None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
encoding: None = None,
errors: None = None,
) -> FileInput[bytes]: ...
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
encoding: str | None = None,
errors: str | None = None,
) -> FileInput[Any]: ...
elif sys.version_info >= (3, 8):
# bufsize is dropped and mode and openhook become keyword-only
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: _TextMode = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ...,
mode: _TextMode = "r",
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = None,
) -> FileInput[str]: ...
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
) -> FileInput[bytes]: ...
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> FileInput[Any]: ...
else:
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
mode: _TextMode = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
mode: _TextMode = "r",
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = None,
) -> FileInput[str]: ...
# Because mode isn't keyword-only here yet, we need two overloads each for
# the bytes case and the fallback case.
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
*,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
) -> FileInput[bytes]: ...
@overload
def input(
@@ -127,17 +127,17 @@ else:
backup: str,
bufsize: int,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
) -> FileInput[bytes]: ...
@overload
def input(
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
*,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> FileInput[Any]: ...
@overload
def input(
@@ -146,7 +146,7 @@ else:
backup: str,
bufsize: int,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> FileInput[Any]: ...
def close() -> None: ...
@@ -164,38 +164,38 @@ class FileInput(Iterator[AnyStr], Generic[AnyStr]):
@overload
def __init__(
self: FileInput[str],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: _TextMode = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
mode: _TextMode = "r",
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = None,
encoding: str | None = None,
errors: str | None = None,
) -> None: ...
@overload
def __init__(
self: FileInput[bytes],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ...,
encoding: None = ...,
errors: None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
encoding: None = None,
errors: None = None,
) -> None: ...
@overload
def __init__(
self: FileInput[Any],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
encoding: str | None = None,
errors: str | None = None,
) -> None: ...
elif sys.version_info >= (3, 8):
@@ -203,57 +203,57 @@ class FileInput(Iterator[AnyStr], Generic[AnyStr]):
@overload
def __init__(
self: FileInput[str],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: _TextMode = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ...,
mode: _TextMode = "r",
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = None,
) -> None: ...
@overload
def __init__(
self: FileInput[bytes],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
) -> None: ...
@overload
def __init__(
self: FileInput[Any],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
*,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> None: ...
else:
@overload
def __init__(
self: FileInput[str],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
mode: _TextMode = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
mode: _TextMode = "r",
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[str]] | None = None,
) -> None: ...
# Because mode isn't keyword-only here yet, we need two overloads each for
# the bytes case and the fallback case.
@overload
def __init__(
self: FileInput[bytes],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
*,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
) -> None: ...
@overload
def __init__(
@@ -263,18 +263,18 @@ class FileInput(Iterator[AnyStr], Generic[AnyStr]):
backup: str,
bufsize: int,
mode: Literal["rb"],
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[bytes]] | None = None,
) -> None: ...
@overload
def __init__(
self: FileInput[Any],
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = ...,
inplace: bool = ...,
backup: str = ...,
bufsize: int = ...,
files: StrOrBytesPath | Iterable[StrOrBytesPath] | None = None,
inplace: bool = False,
backup: str = "",
bufsize: int = 0,
*,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> None: ...
@overload
def __init__(
@@ -284,7 +284,7 @@ class FileInput(Iterator[AnyStr], Generic[AnyStr]):
backup: str,
bufsize: int,
mode: str,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = ...,
openhook: Callable[[StrOrBytesPath, str], _HasReadlineAndFileno[Any]] | None = None,
) -> None: ...
def __del__(self) -> None: ...

View File

@@ -8,11 +8,11 @@ _StylesType: TypeAlias = tuple[Any, ...]
class NullFormatter:
writer: NullWriter | None
def __init__(self, writer: NullWriter | None = ...) -> None: ...
def __init__(self, writer: NullWriter | None = None) -> None: ...
def end_paragraph(self, blankline: int) -> None: ...
def add_line_break(self) -> None: ...
def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
def add_label_data(self, format: str, counter: int, blankline: int | None = ...) -> None: ...
def add_label_data(self, format: str, counter: int, blankline: int | None = None) -> None: ...
def add_flowing_data(self, data: str) -> None: ...
def add_literal_data(self, data: str) -> None: ...
def flush_softspace(self) -> None: ...
@@ -24,8 +24,8 @@ class NullFormatter:
def pop_margin(self) -> None: ...
def set_spacing(self, spacing: str | None) -> None: ...
def push_style(self, *styles: _StylesType) -> None: ...
def pop_style(self, n: int = ...) -> None: ...
def assert_line_data(self, flag: int = ...) -> None: ...
def pop_style(self, n: int = 1) -> None: ...
def assert_line_data(self, flag: int = 1) -> None: ...
class AbstractFormatter:
writer: NullWriter
@@ -45,7 +45,7 @@ class AbstractFormatter:
def end_paragraph(self, blankline: int) -> None: ...
def add_line_break(self) -> None: ...
def add_hor_rule(self, *args: Any, **kw: Any) -> None: ...
def add_label_data(self, format: str, counter: int, blankline: int | None = ...) -> None: ...
def add_label_data(self, format: str, counter: int, blankline: int | None = None) -> None: ...
def format_counter(self, format: Iterable[str], counter: int) -> str: ...
def format_letter(self, case: str, counter: int) -> str: ...
def format_roman(self, case: str, counter: int) -> str: ...
@@ -60,8 +60,8 @@ class AbstractFormatter:
def pop_margin(self) -> None: ...
def set_spacing(self, spacing: str | None) -> None: ...
def push_style(self, *styles: _StylesType) -> None: ...
def pop_style(self, n: int = ...) -> None: ...
def assert_line_data(self, flag: int = ...) -> None: ...
def pop_style(self, n: int = 1) -> None: ...
def assert_line_data(self, flag: int = 1) -> None: ...
class NullWriter:
def flush(self) -> None: ...
@@ -82,7 +82,7 @@ class AbstractWriter(NullWriter): ...
class DumbWriter(NullWriter):
file: IO[str]
maxcol: int
def __init__(self, file: IO[str] | None = ..., maxcol: int = ...) -> None: ...
def __init__(self, file: IO[str] | None = None, maxcol: int = 72) -> None: ...
def reset(self) -> None: ...
def test(file: str | None = ...) -> None: ...
def test(file: str | None = None) -> None: ...

View File

@@ -24,10 +24,10 @@ else:
class Fraction(Rational):
@overload
def __new__(
cls: type[Self], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ...
cls: type[Self], numerator: int | Rational = 0, denominator: int | Rational | None = None, *, _normalize: bool = True
) -> Self: ...
@overload
def __new__(cls: type[Self], __value: float | Decimal | str, *, _normalize: bool = ...) -> Self: ...
def __new__(cls: type[Self], __value: float | Decimal | str, *, _normalize: bool = True) -> Self: ...
@classmethod
def from_float(cls: type[Self], f: float) -> Self: ...
@classmethod
@@ -129,7 +129,7 @@ class Fraction(Rational):
def __floor__(a) -> int: ...
def __ceil__(a) -> int: ...
@overload
def __round__(self, ndigits: None = ...) -> int: ...
def __round__(self, ndigits: None = None) -> int: ...
@overload
def __round__(self, ndigits: int) -> Fraction: ...
def __hash__(self) -> int: ...

View File

@@ -56,12 +56,12 @@ class FTP:
else:
def __init__(
self,
host: str = ...,
user: str = ...,
passwd: str = ...,
acct: str = ...,
host: str = "",
user: str = "",
passwd: str = "",
acct: str = "",
timeout: float = ...,
source_address: tuple[str, int] | None = ...,
source_address: tuple[str, int] | None = None,
) -> None: ...
def connect(
@@ -136,15 +136,15 @@ class FTP_TLS(FTP):
else:
def __init__(
self,
host: str = ...,
user: str = ...,
passwd: str = ...,
acct: str = ...,
keyfile: str | None = ...,
certfile: str | None = ...,
context: SSLContext | None = ...,
host: str = "",
user: str = "",
passwd: str = "",
acct: str = "",
keyfile: str | None = None,
certfile: str | None = None,
context: SSLContext | None = None,
timeout: float = ...,
source_address: tuple[str, int] | None = ...,
source_address: tuple[str, int] | None = None,
) -> None: ...
ssl_version: int
keyfile: str | None

View File

@@ -55,12 +55,12 @@ class _lru_cache_wrapper(Generic[_T]):
if sys.version_info >= (3, 8):
@overload
def lru_cache(maxsize: int | None = ..., typed: bool = ...) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
@overload
def lru_cache(maxsize: Callable[..., _T], typed: bool = ...) -> _lru_cache_wrapper[_T]: ...
def lru_cache(maxsize: Callable[..., _T], typed: bool = False) -> _lru_cache_wrapper[_T]: ...
else:
def lru_cache(maxsize: int | None = ..., typed: bool = ...) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
WRAPPER_ASSIGNMENTS: tuple[
Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"],
@@ -132,9 +132,9 @@ if sys.version_info >= (3, 8):
@property
def __isabstractmethod__(self) -> bool: ...
@overload
def register(self, cls: type[Any], method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
def register(self, cls: type[Any], method: None = None) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
@overload
def register(self, cls: Callable[..., _T], method: None = ...) -> Callable[..., _T]: ...
def register(self, cls: Callable[..., _T], method: None = None) -> Callable[..., _T]: ...
@overload
def register(self, cls: type[Any], method: Callable[..., _T]) -> Callable[..., _T]: ...
def __get__(self, obj: _S, cls: type[_S] | None = None) -> Callable[..., _T]: ...
@@ -144,9 +144,9 @@ if sys.version_info >= (3, 8):
attrname: str | None
def __init__(self, func: Callable[[Any], _T]) -> None: ...
@overload
def __get__(self, instance: None, owner: type[Any] | None = ...) -> cached_property[_T]: ...
def __get__(self, instance: None, owner: type[Any] | None = None) -> cached_property[_T]: ...
@overload
def __get__(self, instance: object, owner: type[Any] | None = ...) -> _T: ...
def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ...
def __set_name__(self, owner: type[Any], name: str) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

View File

@@ -59,14 +59,14 @@ class GNUTranslations(NullTranslations):
@overload # ignores incompatible overloads
def find( # type: ignore[misc]
domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: Literal[False] = ...
domain: str, localedir: StrPath | None = None, languages: Iterable[str] | None = None, all: Literal[False] = False
) -> str | None: ...
@overload
def find(
domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: Literal[True] = ...
domain: str, localedir: StrPath | None = None, languages: Iterable[str] | None = None, all: Literal[True] = ...
) -> list[str]: ...
@overload
def find(domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: bool = ...) -> Any: ...
def find(domain: str, localedir: StrPath | None = None, languages: Iterable[str] | None = None, all: bool = False) -> Any: ...
_NullTranslationsT = TypeVar("_NullTranslationsT", bound=NullTranslations)
@@ -74,19 +74,19 @@ if sys.version_info >= (3, 11):
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
class_: None = ...,
fallback: Literal[False] = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
class_: None = None,
fallback: Literal[False] = False,
) -> GNUTranslations: ...
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
*,
class_: Callable[[io.BufferedReader], _NullTranslationsT],
fallback: Literal[False] = ...,
fallback: Literal[False] = False,
) -> _NullTranslationsT: ...
@overload
def translation(
@@ -94,15 +94,15 @@ if sys.version_info >= (3, 11):
localedir: StrPath | None,
languages: Iterable[str] | None,
class_: Callable[[io.BufferedReader], _NullTranslationsT],
fallback: Literal[False] = ...,
fallback: Literal[False] = False,
) -> _NullTranslationsT: ...
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
class_: Callable[[io.BufferedReader], NullTranslations] | None = ...,
fallback: bool = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
class_: Callable[[io.BufferedReader], NullTranslations] | None = None,
fallback: bool = False,
) -> NullTranslations: ...
def install(domain: str, localedir: StrPath | None = None, *, names: Container[str] | None = None) -> None: ...
@@ -110,21 +110,21 @@ else:
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
class_: None = ...,
fallback: Literal[False] = ...,
codeset: str | None = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
class_: None = None,
fallback: Literal[False] = False,
codeset: str | None = None,
) -> GNUTranslations: ...
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
*,
class_: Callable[[io.BufferedReader], _NullTranslationsT],
fallback: Literal[False] = ...,
codeset: str | None = ...,
fallback: Literal[False] = False,
codeset: str | None = None,
) -> _NullTranslationsT: ...
@overload
def translation(
@@ -132,20 +132,20 @@ else:
localedir: StrPath | None,
languages: Iterable[str] | None,
class_: Callable[[io.BufferedReader], _NullTranslationsT],
fallback: Literal[False] = ...,
codeset: str | None = ...,
fallback: Literal[False] = False,
codeset: str | None = None,
) -> _NullTranslationsT: ...
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
class_: Callable[[io.BufferedReader], NullTranslations] | None = ...,
fallback: bool = ...,
codeset: str | None = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
class_: Callable[[io.BufferedReader], NullTranslations] | None = None,
fallback: bool = False,
codeset: str | None = None,
) -> NullTranslations: ...
def install(
domain: str, localedir: StrPath | None = ..., codeset: str | None = ..., names: Container[str] | None = ...
domain: str, localedir: StrPath | None = None, codeset: str | None = None, names: Container[str] | None = None
) -> None: ...
def textdomain(domain: str | None = None) -> str: ...
@@ -166,6 +166,6 @@ if sys.version_info < (3, 11):
def ldgettext(domain: str, message: str) -> str: ...
def lngettext(msgid1: str, msgid2: str, n: int) -> str: ...
def ldngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ...
def bind_textdomain_codeset(domain: str, codeset: str | None = ...) -> str: ...
def bind_textdomain_codeset(domain: str, codeset: str | None = None) -> str: ...
Catalog = translation

View File

@@ -28,15 +28,15 @@ if sys.version_info >= (3, 11):
elif sys.version_info >= (3, 10):
def glob(
pathname: AnyStr, *, root_dir: StrOrBytesPath | None = ..., dir_fd: int | None = ..., recursive: bool = ...
pathname: AnyStr, *, root_dir: StrOrBytesPath | None = None, dir_fd: int | None = None, recursive: bool = False
) -> list[AnyStr]: ...
def iglob(
pathname: AnyStr, *, root_dir: StrOrBytesPath | None = ..., dir_fd: int | None = ..., recursive: bool = ...
pathname: AnyStr, *, root_dir: StrOrBytesPath | None = None, dir_fd: int | None = None, recursive: bool = False
) -> Iterator[AnyStr]: ...
else:
def glob(pathname: AnyStr, *, recursive: bool = ...) -> list[AnyStr]: ...
def iglob(pathname: AnyStr, *, recursive: bool = ...) -> Iterator[AnyStr]: ...
def glob(pathname: AnyStr, *, recursive: bool = False) -> list[AnyStr]: ...
def iglob(pathname: AnyStr, *, recursive: bool = False) -> Iterator[AnyStr]: ...
def escape(pathname: AnyStr) -> AnyStr: ...
def has_magic(s: str | bytes) -> bool: ... # undocumented

View File

@@ -12,7 +12,7 @@ if sys.version_info >= (3, 11):
class TopologicalSorter(Generic[_T]):
@overload
def __init__(self, graph: None = ...) -> None: ...
def __init__(self, graph: None = None) -> None: ...
@overload
def __init__(self, graph: SupportsItems[_T, Iterable[_T]]) -> None: ...
def add(self, node: _T, *predecessors: _T) -> None: ...

View File

@@ -43,38 +43,38 @@ class _WritableFileobj(Protocol):
@overload
def open(
filename: StrOrBytesPath | _ReadableFileobj,
mode: _ReadBinaryMode = ...,
compresslevel: int = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
mode: _ReadBinaryMode = "rb",
compresslevel: int = 9,
encoding: None = None,
errors: None = None,
newline: None = None,
) -> GzipFile: ...
@overload
def open(
filename: StrOrBytesPath | _WritableFileobj,
mode: _WriteBinaryMode,
compresslevel: int = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
compresslevel: int = 9,
encoding: None = None,
errors: None = None,
newline: None = None,
) -> GzipFile: ...
@overload
def open(
filename: StrOrBytesPath,
mode: _OpenTextMode,
compresslevel: int = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
compresslevel: int = 9,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
) -> TextIO: ...
@overload
def open(
filename: StrOrBytesPath | _ReadableFileobj | _WritableFileobj,
mode: str,
compresslevel: int = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
compresslevel: int = 9,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
) -> GzipFile | TextIO: ...
class _PaddedFile:
@@ -99,45 +99,45 @@ class GzipFile(_compression.BaseStream):
self,
filename: StrOrBytesPath | None,
mode: _ReadBinaryMode,
compresslevel: int = ...,
fileobj: _ReadableFileobj | None = ...,
mtime: float | None = ...,
compresslevel: int = 9,
fileobj: _ReadableFileobj | None = None,
mtime: float | None = None,
) -> None: ...
@overload
def __init__(
self,
*,
mode: _ReadBinaryMode,
compresslevel: int = ...,
fileobj: _ReadableFileobj | None = ...,
mtime: float | None = ...,
compresslevel: int = 9,
fileobj: _ReadableFileobj | None = None,
mtime: float | None = None,
) -> None: ...
@overload
def __init__(
self,
filename: StrOrBytesPath | None,
mode: _WriteBinaryMode,
compresslevel: int = ...,
fileobj: _WritableFileobj | None = ...,
mtime: float | None = ...,
compresslevel: int = 9,
fileobj: _WritableFileobj | None = None,
mtime: float | None = None,
) -> None: ...
@overload
def __init__(
self,
*,
mode: _WriteBinaryMode,
compresslevel: int = ...,
fileobj: _WritableFileobj | None = ...,
mtime: float | None = ...,
compresslevel: int = 9,
fileobj: _WritableFileobj | None = None,
mtime: float | None = None,
) -> None: ...
@overload
def __init__(
self,
filename: StrOrBytesPath | None = ...,
mode: str | None = ...,
compresslevel: int = ...,
fileobj: _ReadableFileobj | _WritableFileobj | None = ...,
mtime: float | None = ...,
filename: StrOrBytesPath | None = None,
mode: str | None = None,
compresslevel: int = 9,
fileobj: _ReadableFileobj | _WritableFileobj | None = None,
mtime: float | None = None,
) -> None: ...
@property
def filename(self) -> str: ...
@@ -162,6 +162,6 @@ if sys.version_info >= (3, 8):
def compress(data: _BufferWithLen, compresslevel: int = 9, *, mtime: float | None = None) -> bytes: ...
else:
def compress(data: _BufferWithLen, compresslevel: int = ...) -> bytes: ...
def compress(data: _BufferWithLen, compresslevel: int = 9) -> bytes: ...
def decompress(data: ReadableBuffer) -> bytes: ...

View File

@@ -23,7 +23,7 @@ if sys.version_info >= (3, 8):
def new(key: bytes | bytearray, *, digestmod: _DigestMod) -> HMAC: ...
else:
def new(key: bytes | bytearray, msg: ReadableBuffer | None = ..., digestmod: _DigestMod | None = ...) -> HMAC: ...
def new(key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod | None = None) -> HMAC: ...
class HMAC:
digest_size: int

View File

@@ -49,7 +49,7 @@ class FileCookieJar(CookieJar):
self, filename: StrPath | None = None, delayload: bool = False, policy: CookiePolicy | None = None
) -> None: ...
else:
def __init__(self, filename: str | None = ..., delayload: bool = ..., policy: CookiePolicy | None = ...) -> None: ...
def __init__(self, filename: str | None = None, delayload: bool = False, policy: CookiePolicy | None = None) -> None: ...
def save(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: ...
def load(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: ...
@@ -104,18 +104,18 @@ class DefaultCookiePolicy(CookiePolicy):
else:
def __init__(
self,
blocked_domains: Sequence[str] | None = ...,
allowed_domains: Sequence[str] | None = ...,
netscape: bool = ...,
rfc2965: bool = ...,
rfc2109_as_netscape: bool | None = ...,
hide_cookie2: bool = ...,
strict_domain: bool = ...,
strict_rfc2965_unverifiable: bool = ...,
strict_ns_unverifiable: bool = ...,
strict_ns_domain: int = ...,
strict_ns_set_initial_dollar: bool = ...,
strict_ns_set_path: bool = ...,
blocked_domains: Sequence[str] | None = None,
allowed_domains: Sequence[str] | None = None,
netscape: bool = True,
rfc2965: bool = False,
rfc2109_as_netscape: bool | None = None,
hide_cookie2: bool = False,
strict_domain: bool = False,
strict_rfc2965_unverifiable: bool = True,
strict_ns_unverifiable: bool = False,
strict_ns_domain: int = 0,
strict_ns_set_initial_dollar: bool = False,
strict_ns_set_path: bool = False,
) -> None: ...
def blocked_domains(self) -> tuple[str, ...]: ...

View File

@@ -44,8 +44,8 @@ class IMAP4:
def __init__(self, host: str = "", port: int = 143, timeout: float | None = None) -> None: ...
def open(self, host: str = "", port: int = 143, timeout: float | None = None) -> None: ...
else:
def __init__(self, host: str = ..., port: int = ...) -> None: ...
def open(self, host: str = ..., port: int = ...) -> None: ...
def __init__(self, host: str = "", port: int = 143) -> None: ...
def open(self, host: str = "", port: int = 143) -> None: ...
def __getattr__(self, attr: str) -> Any: ...
host: str
@@ -123,18 +123,18 @@ class IMAP4_SSL(IMAP4):
else:
def __init__(
self,
host: str = ...,
port: int = ...,
keyfile: str | None = ...,
certfile: str | None = ...,
ssl_context: SSLContext | None = ...,
host: str = "",
port: int = 993,
keyfile: str | None = None,
certfile: str | None = None,
ssl_context: SSLContext | None = None,
) -> None: ...
sslobj: SSLSocket
file: IO[Any]
if sys.version_info >= (3, 9):
def open(self, host: str = "", port: int | None = 993, timeout: float | None = None) -> None: ...
else:
def open(self, host: str = ..., port: int | None = ...) -> None: ...
def open(self, host: str = "", port: int | None = 993) -> None: ...
def ssl(self) -> SSLSocket: ...
@@ -148,7 +148,7 @@ class IMAP4_stream(IMAP4):
if sys.version_info >= (3, 9):
def open(self, host: str | None = None, port: int | None = None, timeout: float | None = None) -> None: ...
else:
def open(self, host: str | None = ..., port: int | None = ...) -> None: ...
def open(self, host: str | None = None, port: int | None = None) -> None: ...
class _Authenticator:
mech: Callable[[bytes], bytes | bytearray | memoryview | str | None]

View File

@@ -10,7 +10,7 @@ class _ReadableBinary(Protocol):
def seek(self, offset: int) -> Any: ...
@overload
def what(file: StrPath | _ReadableBinary, h: None = ...) -> str | None: ...
def what(file: StrPath | _ReadableBinary, h: None = None) -> str | None: ...
@overload
def what(file: Any, h: bytes) -> str | None: ...

View File

@@ -123,7 +123,7 @@ if sys.version_info >= (3, 9):
@abstractmethod
def open(
self,
mode: OpenTextMode = ...,
mode: OpenTextMode = "r",
buffering: int = ...,
encoding: str | None = ...,
errors: str | None = ...,

View File

@@ -297,7 +297,7 @@ if sys.version_info >= (3, 10):
) -> Signature: ...
else:
def signature(obj: _IntrospectableCallable, *, follow_wrapped: bool = ...) -> Signature: ...
def signature(obj: _IntrospectableCallable, *, follow_wrapped: bool = True) -> Signature: ...
class _void: ...
class _empty: ...
@@ -329,7 +329,7 @@ class Signature:
) -> Self: ...
else:
@classmethod
def from_callable(cls: type[Self], obj: _IntrospectableCallable, *, follow_wrapped: bool = ...) -> Self: ...
def from_callable(cls: type[Self], obj: _IntrospectableCallable, *, follow_wrapped: bool = True) -> Self: ...
def __eq__(self, other: object) -> bool: ...
@@ -442,9 +442,9 @@ def formatannotationrelativeto(object: object) -> Callable[[object], str]: ...
if sys.version_info < (3, 11):
def formatargspec(
args: list[str],
varargs: str | None = ...,
varkw: str | None = ...,
defaults: tuple[Any, ...] | None = ...,
varargs: str | None = None,
varkw: str | None = None,
defaults: tuple[Any, ...] | None = None,
kwonlyargs: Sequence[str] | None = ...,
kwonlydefaults: Mapping[str, Any] | None = ...,
annotations: Mapping[str, Any] = ...,

View File

@@ -115,10 +115,10 @@ def setlocale(category: int, locale: _str | Iterable[_str | None] | None = None)
def localeconv() -> Mapping[_str, int | _str | list[int]]: ...
def nl_langinfo(__key: int) -> _str: ...
def getdefaultlocale(envvars: tuple[_str, ...] = ...) -> tuple[_str | None, _str | None]: ...
def getlocale(category: int = 2) -> tuple[_str | None, _str | None]: ...
def getlocale(category: int = ...) -> tuple[_str | None, _str | None]: ...
def getpreferredencoding(do_setlocale: bool = True) -> _str: ...
def normalize(localename: _str) -> _str: ...
def resetlocale(category: int = 0) -> None: ...
def resetlocale(category: int = ...) -> None: ...
def strcoll(__os1: _str, __os2: _str) -> int: ...
def strxfrm(__string: _str) -> _str: ...
def format(percent: _str, value: float | Decimal, grouping: bool = False, monetary: bool = False, *additional: Any) -> _str: ...

View File

@@ -257,7 +257,7 @@ class Logger(Filterer):
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = ...,
exc_info: _ExcInfoType = True,
stack_info: bool = ...,
extra: Mapping[str, object] | None = ...,
) -> None: ...
@@ -266,9 +266,9 @@ class Logger(Filterer):
level: int,
msg: object,
args: _ArgsType,
exc_info: _ExcInfoType | None = ...,
extra: Mapping[str, object] | None = ...,
stack_info: bool = ...,
exc_info: _ExcInfoType | None = None,
extra: Mapping[str, object] | None = None,
stack_info: bool = False,
) -> None: ... # undocumented
fatal = critical
def addHandler(self, hdlr: Handler) -> None: ...
@@ -276,7 +276,7 @@ class Logger(Filterer):
if sys.version_info >= (3, 8):
def findCaller(self, stack_info: bool = False, stacklevel: int = 1) -> tuple[str, int, str, str | None]: ...
else:
def findCaller(self, stack_info: bool = ...) -> tuple[str, int, str, str | None]: ...
def findCaller(self, stack_info: bool = False) -> tuple[str, int, str, str | None]: ...
def handle(self, record: LogRecord) -> None: ...
def makeRecord(
@@ -347,10 +347,10 @@ class Formatter:
) -> None: ...
elif sys.version_info >= (3, 8):
def __init__(
self, fmt: str | None = ..., datefmt: str | None = ..., style: _FormatStyle = ..., validate: bool = ...
self, fmt: str | None = None, datefmt: str | None = None, style: _FormatStyle = "%", validate: bool = True
) -> None: ...
else:
def __init__(self, fmt: str | None = ..., datefmt: str | None = ..., style: _FormatStyle = ...) -> None: ...
def __init__(self, fmt: str | None = None, datefmt: str | None = None, style: _FormatStyle = "%") -> None: ...
def format(self, record: LogRecord) -> str: ...
def formatTime(self, record: LogRecord, datefmt: str | None = None) -> str: ...
@@ -559,7 +559,7 @@ class LoggerAdapter(Generic[_L]):
self,
msg: object,
*args: object,
exc_info: _ExcInfoType = ...,
exc_info: _ExcInfoType = True,
stack_info: bool = ...,
extra: Mapping[str, object] | None = ...,
**kwargs: object,
@@ -693,7 +693,11 @@ else:
msg: object, *args: object, exc_info: _ExcInfoType = ..., stack_info: bool = ..., extra: Mapping[str, object] | None = ...
) -> None: ...
def exception(
msg: object, *args: object, exc_info: _ExcInfoType = ..., stack_info: bool = ..., extra: Mapping[str, object] | None = ...
msg: object,
*args: object,
exc_info: _ExcInfoType = True,
stack_info: bool = ...,
extra: Mapping[str, object] | None = ...,
) -> None: ...
def log(
level: int,
@@ -771,7 +775,7 @@ class StreamHandler(Handler, Generic[_StreamT]):
stream: _StreamT # undocumented
terminator: str
@overload
def __init__(self: StreamHandler[TextIO], stream: None = ...) -> None: ...
def __init__(self: StreamHandler[TextIO], stream: None = None) -> None: ...
@overload
def __init__(self: StreamHandler[_StreamT], stream: _StreamT) -> None: ...
def setStream(self, stream: _StreamT) -> _StreamT | None: ...
@@ -789,7 +793,7 @@ class FileHandler(StreamHandler[TextIOWrapper]):
self, filename: StrPath, mode: str = "a", encoding: str | None = None, delay: bool = False, errors: str | None = None
) -> None: ...
else:
def __init__(self, filename: StrPath, mode: str = ..., encoding: str | None = ..., delay: bool = ...) -> None: ...
def __init__(self, filename: StrPath, mode: str = "a", encoding: str | None = None, delay: bool = False) -> None: ...
def _open(self) -> TextIOWrapper: ... # undocumented

View File

@@ -57,8 +57,8 @@ if sys.version_info >= (3, 10):
else:
def fileConfig(
fname: StrOrBytesPath | IO[str] | RawConfigParser,
defaults: dict[str, str] | None = ...,
disable_existing_loggers: bool = ...,
defaults: dict[str, str] | None = None,
disable_existing_loggers: bool = True,
) -> None: ...
def valid_ident(s: str) -> Literal[True]: ... # undocumented

View File

@@ -25,7 +25,7 @@ class WatchedFileHandler(FileHandler):
self, filename: StrPath, mode: str = "a", encoding: str | None = None, delay: bool = False, errors: str | None = None
) -> None: ...
else:
def __init__(self, filename: StrPath, mode: str = ..., encoding: str | None = ..., delay: bool = ...) -> None: ...
def __init__(self, filename: StrPath, mode: str = "a", encoding: str | None = None, delay: bool = False) -> None: ...
def _statstream(self) -> None: ... # undocumented
def reopenIfNeeded(self) -> None: ...
@@ -38,7 +38,7 @@ class BaseRotatingHandler(FileHandler):
self, filename: StrPath, mode: str, encoding: str | None = None, delay: bool = False, errors: str | None = None
) -> None: ...
else:
def __init__(self, filename: StrPath, mode: str, encoding: str | None = ..., delay: bool = ...) -> None: ...
def __init__(self, filename: StrPath, mode: str, encoding: str | None = None, delay: bool = False) -> None: ...
def rotation_filename(self, default_name: str) -> str: ...
def rotate(self, source: str, dest: str) -> None: ...
@@ -61,11 +61,11 @@ class RotatingFileHandler(BaseRotatingHandler):
def __init__(
self,
filename: StrPath,
mode: str = ...,
maxBytes: int = ...,
backupCount: int = ...,
encoding: str | None = ...,
delay: bool = ...,
mode: str = "a",
maxBytes: int = 0,
backupCount: int = 0,
encoding: str | None = None,
delay: bool = False,
) -> None: ...
def doRollover(self) -> None: ...
@@ -98,13 +98,13 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
def __init__(
self,
filename: StrPath,
when: str = ...,
interval: int = ...,
backupCount: int = ...,
encoding: str | None = ...,
delay: bool = ...,
utc: bool = ...,
atTime: datetime.time | None = ...,
when: str = "h",
interval: int = 1,
backupCount: int = 0,
encoding: str | None = None,
delay: bool = False,
utc: bool = False,
atTime: datetime.time | None = None,
) -> None: ...
def doRollover(self) -> None: ...
@@ -210,7 +210,7 @@ class SMTPHandler(Handler):
subject: str,
credentials: tuple[str, str] | None = None,
secure: tuple[()] | tuple[str] | tuple[str, str] | None = None,
timeout: float = ...,
timeout: float = 5.0,
) -> None: ...
def getSubject(self, record: LogRecord) -> str: ...

View File

@@ -126,67 +126,67 @@ class LZMAFile(io.BufferedIOBase, IO[bytes]):
@overload
def open(
filename: _PathOrFile,
mode: Literal["r", "rb"] = ...,
mode: Literal["r", "rb"] = "rb",
*,
format: int | None = ...,
check: Literal[-1] = ...,
preset: None = ...,
filters: _FilterChain | None = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
format: int | None = None,
check: Literal[-1] = -1,
preset: None = None,
filters: _FilterChain | None = None,
encoding: None = None,
errors: None = None,
newline: None = None,
) -> LZMAFile: ...
@overload
def open(
filename: _PathOrFile,
mode: _OpenBinaryWritingMode,
*,
format: int | None = ...,
check: int = ...,
preset: int | None = ...,
filters: _FilterChain | None = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
format: int | None = None,
check: int = -1,
preset: int | None = None,
filters: _FilterChain | None = None,
encoding: None = None,
errors: None = None,
newline: None = None,
) -> LZMAFile: ...
@overload
def open(
filename: StrOrBytesPath,
mode: Literal["rt"],
*,
format: int | None = ...,
check: Literal[-1] = ...,
preset: None = ...,
filters: _FilterChain | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
format: int | None = None,
check: Literal[-1] = -1,
preset: None = None,
filters: _FilterChain | None = None,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
) -> TextIO: ...
@overload
def open(
filename: StrOrBytesPath,
mode: _OpenTextWritingMode,
*,
format: int | None = ...,
check: int = ...,
preset: int | None = ...,
filters: _FilterChain | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
format: int | None = None,
check: int = -1,
preset: int | None = None,
filters: _FilterChain | None = None,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
) -> TextIO: ...
@overload
def open(
filename: _PathOrFile,
mode: str,
*,
format: int | None = ...,
check: int = ...,
preset: int | None = ...,
filters: _FilterChain | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
format: int | None = None,
check: int = -1,
preset: int | None = None,
filters: _FilterChain | None = None,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
) -> LZMAFile | TextIO: ...
def compress(
data: ReadableBuffer, format: int = 1, check: int = -1, preset: int | None = None, filters: _FilterChain | None = None

View File

@@ -50,9 +50,9 @@ class Mailbox(Generic[_MessageT]):
_path: str # undocumented
_factory: Callable[[IO[Any]], _MessageT] | None # undocumented
@overload
def __init__(self, path: StrPath, factory: Callable[[IO[Any]], _MessageT], create: bool = ...) -> None: ...
def __init__(self, path: StrPath, factory: Callable[[IO[Any]], _MessageT], create: bool = True) -> None: ...
@overload
def __init__(self, path: StrPath, factory: None = ..., create: bool = ...) -> None: ...
def __init__(self, path: StrPath, factory: None = None, create: bool = True) -> None: ...
@abstractmethod
def add(self, message: _MessageData) -> str: ...
@abstractmethod
@@ -62,7 +62,7 @@ class Mailbox(Generic[_MessageT]):
@abstractmethod
def __setitem__(self, key: str, message: _MessageData) -> None: ...
@overload
def get(self, key: str, default: None = ...) -> _MessageT | None: ...
def get(self, key: str, default: None = None) -> _MessageT | None: ...
@overload
def get(self, key: str, default: _T) -> _MessageT | _T: ...
def __getitem__(self, key: str) -> _MessageT: ...
@@ -88,7 +88,7 @@ class Mailbox(Generic[_MessageT]):
def __len__(self) -> int: ...
def clear(self) -> None: ...
@overload
def pop(self, key: str, default: None = ...) -> _MessageT | None: ...
def pop(self, key: str, default: None = None) -> _MessageT | None: ...
@overload
def pop(self, key: str, default: _T = ...) -> _MessageT | _T: ...
def popitem(self) -> tuple[str, _MessageT]: ...

View File

@@ -91,8 +91,8 @@ def isclose(
a: _SupportsFloatOrIndex,
b: _SupportsFloatOrIndex,
*,
rel_tol: _SupportsFloatOrIndex = ...,
abs_tol: _SupportsFloatOrIndex = ...,
rel_tol: _SupportsFloatOrIndex = 1e-09,
abs_tol: _SupportsFloatOrIndex = 0.0,
) -> bool: ...
def isinf(__x: _SupportsFloatOrIndex) -> bool: ...
def isfinite(__x: _SupportsFloatOrIndex) -> bool: ...
@@ -122,9 +122,9 @@ def pow(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...
if sys.version_info >= (3, 8):
@overload
def prod(__iterable: Iterable[SupportsIndex], *, start: SupportsIndex = ...) -> int: ... # type: ignore[misc]
def prod(__iterable: Iterable[SupportsIndex], *, start: SupportsIndex = 1) -> int: ... # type: ignore[misc]
@overload
def prod(__iterable: Iterable[_SupportsFloatOrIndex], *, start: _SupportsFloatOrIndex = ...) -> float: ...
def prod(__iterable: Iterable[_SupportsFloatOrIndex], *, start: _SupportsFloatOrIndex = 1) -> float: ...
def radians(__x: _SupportsFloatOrIndex) -> float: ...
def remainder(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...

View File

@@ -23,7 +23,7 @@ if sys.version_info >= (3, 8):
def guess_type(url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ...
else:
def guess_type(url: str, strict: bool = ...) -> tuple[str | None, str | None]: ...
def guess_type(url: str, strict: bool = True) -> tuple[str | None, str | None]: ...
def guess_all_extensions(type: str, strict: bool = True) -> list[str]: ...
def guess_extension(type: str, strict: bool = True) -> str | None: ...
@@ -48,10 +48,10 @@ class MimeTypes:
if sys.version_info >= (3, 8):
def guess_type(self, url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ...
else:
def guess_type(self, url: str, strict: bool = ...) -> tuple[str | None, str | None]: ...
def guess_type(self, url: str, strict: bool = True) -> tuple[str | None, str | None]: ...
def guess_all_extensions(self, type: str, strict: bool = True) -> list[str]: ...
def read(self, filename: str, strict: bool = True) -> None: ...
def readfp(self, fp: IO[str], strict: bool = True) -> None: ...
if sys.platform == "win32":
def read_windows_registry(self, strict: bool = ...) -> None: ...
def read_windows_registry(self, strict: bool = True) -> None: ...

View File

@@ -43,8 +43,8 @@ class ModuleFinder:
else:
def __init__(
self,
path: list[str] | None = ...,
debug: int = ...,
path: list[str] | None = None,
debug: int = 0,
excludes: Container[str] = ...,
replace_paths: Sequence[tuple[str, str]] = ...,
) -> None: ...

View File

@@ -82,19 +82,19 @@ if sys.platform == "win32":
physical: str,
_logical: str,
default: str,
componentflags: int | None = ...,
componentflags: int | None = None,
) -> None: ...
def start_component(
self,
component: str | None = ...,
feature: Feature | None = ...,
flags: int | None = ...,
keyfile: str | None = ...,
uuid: str | None = ...,
component: str | None = None,
feature: Feature | None = None,
flags: int | None = None,
keyfile: str | None = None,
uuid: str | None = None,
) -> None: ...
def make_short(self, file: str) -> str: ...
def add_file(self, file: str, src: str | None = ..., version: str | None = ..., language: str | None = ...) -> str: ...
def glob(self, pattern: str, exclude: Container[str] | None = ...) -> list[str]: ...
def add_file(self, file: str, src: str | None = None, version: str | None = None, language: str | None = None) -> str: ...
def glob(self, pattern: str, exclude: Container[str] | None = None) -> list[str]: ...
def remove_pyc(self) -> None: ...
class Binary:
@@ -112,10 +112,10 @@ if sys.platform == "win32":
title: str,
desc: str,
display: int,
level: int = ...,
parent: Feature | None = ...,
directory: str | None = ...,
attributes: int = ...,
level: int = 1,
parent: Feature | None = None,
directory: str | None = None,
attributes: int = 0,
) -> None: ...
def set_current(self) -> None: ...
@@ -124,7 +124,7 @@ if sys.platform == "win32":
dlg: Dialog
name: str
def __init__(self, dlg: Dialog, name: str) -> None: ...
def event(self, event: str, argument: str, condition: str = ..., ordering: int | None = ...) -> None: ...
def event(self, event: str, argument: str, condition: str = "1", ordering: int | None = None) -> None: ...
def mapping(self, event: str, attribute: str) -> None: ...
def condition(self, action: str, condition: str) -> None: ...
@@ -133,7 +133,7 @@ if sys.platform == "win32":
property: str
index: int
def __init__(self, dlg: Dialog, name: str, property: str) -> None: ...
def add(self, name: str, x: int, y: int, w: int, h: int, text: str, value: str | None = ...) -> None: ...
def add(self, name: str, x: int, y: int, w: int, h: int, text: str, value: str | None = None) -> None: ...
class Dialog:

View File

@@ -26,7 +26,7 @@ class _ConnectionBase:
def recv_bytes(self, maxlength: int | None = None) -> bytes: ...
def recv_bytes_into(self, buf: Any, offset: int = 0) -> int: ...
def recv(self) -> Any: ...
def poll(self, timeout: float | None = ...) -> bool: ...
def poll(self, timeout: float | None = 0.0) -> bool: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None
@@ -66,4 +66,4 @@ if sys.platform != "win32":
def Pipe(duplex: bool = True) -> tuple[Connection, Connection]: ...
else:
def Pipe(duplex: bool = ...) -> tuple[PipeConnection, PipeConnection]: ...
def Pipe(duplex: bool = True) -> tuple[PipeConnection, PipeConnection]: ...

View File

@@ -54,7 +54,7 @@ class BaseContext:
if sys.platform != "win32":
def Pipe(self, duplex: bool = True) -> tuple[Connection, Connection]: ...
else:
def Pipe(self, duplex: bool = ...) -> tuple[PipeConnection, PipeConnection]: ...
def Pipe(self, duplex: bool = True) -> tuple[PipeConnection, PipeConnection]: ...
def Barrier(
self, parties: int, action: Callable[..., object] | None = None, timeout: float | None = None
@@ -86,24 +86,24 @@ class BaseContext:
@overload
def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[False]) -> _CT: ...
@overload
def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = ...) -> SynchronizedBase[_CT]: ...
def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = True) -> SynchronizedBase[_CT]: ...
@overload
def Value(self, typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike = ...) -> SynchronizedBase[Any]: ...
def Value(self, typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike = True) -> SynchronizedBase[Any]: ...
@overload
def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = ...) -> Any: ...
def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = True) -> Any: ...
@overload
def Array(self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False]) -> _CT: ...
@overload
def Array(
self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = ...
self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = True
) -> SynchronizedArray[_CT]: ...
@overload
def Array(
self, typecode_or_type: str, size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = ...
self, typecode_or_type: str, size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = True
) -> SynchronizedArray[Any]: ...
@overload
def Array(
self, typecode_or_type: str | type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = ...
self, typecode_or_type: str | type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = True
) -> Any: ...
def freeze_support(self) -> None: ...
def get_logger(self) -> Logger: ...
@@ -124,14 +124,14 @@ class BaseContext:
def get_context(self, method: str) -> BaseContext: ...
else:
@overload
def get_context(self, method: None = ...) -> DefaultContext: ...
def get_context(self, method: None = None) -> DefaultContext: ...
@overload
def get_context(self, method: Literal["spawn"]) -> SpawnContext: ...
@overload
def get_context(self, method: str) -> BaseContext: ...
@overload
def get_start_method(self, allow_none: Literal[False] = ...) -> str: ...
def get_start_method(self, allow_none: Literal[False] = False) -> str: ...
@overload
def get_start_method(self, allow_none: bool) -> str | None: ...
def set_start_method(self, method: str | None, force: bool = False) -> None: ...

View File

@@ -23,7 +23,7 @@ class Connection:
) -> None: ...
def __init__(self, _in: Any, _out: Any) -> None: ...
def close(self) -> None: ...
def poll(self, timeout: float = ...) -> bool: ...
def poll(self, timeout: float = 0.0) -> bool: ...
class Listener:
_backlog_queue: Queue[Any] | None

View File

@@ -27,7 +27,7 @@ if sys.platform != "win32":
def rebuild_arena(size: int, dupfd: _SupportsDetach) -> Arena: ...
class Heap:
def __init__(self, size: int = ...) -> None: ...
def __init__(self, size: int = 4096) -> None: ...
def free(self, block: _Block) -> None: ...
def malloc(self, size: int) -> _Block: ...

View File

@@ -137,11 +137,15 @@ class BaseManager:
serializer: str = "pickle",
ctx: BaseContext | None = None,
*,
shutdown_timeout: float = ...,
shutdown_timeout: float = 1.0,
) -> None: ...
else:
def __init__(
self, address: Any | None = ..., authkey: bytes | None = ..., serializer: str = ..., ctx: BaseContext | None = ...
self,
address: Any | None = None,
authkey: bytes | None = None,
serializer: str = "pickle",
ctx: BaseContext | None = None,
) -> None: ...
def get_server(self) -> Server: ...

View File

@@ -21,7 +21,7 @@ if sys.platform == "win32":
def __init__(self, process_obj: BaseProcess) -> None: ...
def duplicate_for_child(self, handle: int) -> int: ...
def wait(self, timeout: float | None = ...) -> int | None: ...
def wait(self, timeout: float | None = None) -> int | None: ...
def poll(self) -> int | None: ...
def terminate(self) -> None: ...

View File

@@ -34,17 +34,17 @@ def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = None) -> N
if sys.platform == "win32":
if sys.version_info >= (3, 8):
def duplicate(
handle: int, target_process: int | None = ..., inheritable: bool = ..., *, source_process: int | None = ...
handle: int, target_process: int | None = None, inheritable: bool = False, *, source_process: int | None = None
) -> int: ...
else:
def duplicate(handle: int, target_process: int | None = ..., inheritable: bool = ...) -> int: ...
def duplicate(handle: int, target_process: int | None = None, inheritable: bool = False) -> int: ...
def steal_handle(source_pid: int, handle: int) -> int: ...
def send_handle(conn: connection.PipeConnection, handle: int, destination_pid: int) -> None: ...
def recv_handle(conn: connection.PipeConnection) -> int: ...
class DupHandle:
def __init__(self, handle: int, access: int, pid: int | None = ...) -> None: ...
def __init__(self, handle: int, access: int, pid: int | None = None) -> None: ...
def detach(self) -> int: ...
else:

View File

@@ -24,9 +24,9 @@ class SharedMemory:
class ShareableList(Generic[_SLT]):
shm: SharedMemory
@overload
def __init__(self, sequence: None = ..., *, name: str | None = ...) -> None: ...
def __init__(self, sequence: None = None, *, name: str | None = None) -> None: ...
@overload
def __init__(self, sequence: Iterable[_SLT], *, name: str | None = ...) -> None: ...
def __init__(self, sequence: Iterable[_SLT], *, name: str | None = None) -> None: ...
def __getitem__(self, position: int) -> _SLT: ...
def __setitem__(self, position: int, value: _SLT) -> None: ...
def __reduce__(self: Self) -> tuple[Self, tuple[_SLT, ...]]: ...

View File

@@ -21,56 +21,56 @@ def RawArray(typecode_or_type: type[_CT], size_or_initializer: int | Sequence[An
@overload
def RawArray(typecode_or_type: str, size_or_initializer: int | Sequence[Any]) -> Any: ...
@overload
def Value(typecode_or_type: type[_CT], *args: Any, lock: Literal[False], ctx: BaseContext | None = ...) -> _CT: ...
def Value(typecode_or_type: type[_CT], *args: Any, lock: Literal[False], ctx: BaseContext | None = None) -> _CT: ...
@overload
def Value(
typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = ..., ctx: BaseContext | None = ...
typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = True, ctx: BaseContext | None = None
) -> SynchronizedBase[_CT]: ...
@overload
def Value(
typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike = ..., ctx: BaseContext | None = ...
typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike = True, ctx: BaseContext | None = None
) -> SynchronizedBase[Any]: ...
@overload
def Value(
typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = ..., ctx: BaseContext | None = ...
typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = True, ctx: BaseContext | None = None
) -> Any: ...
@overload
def Array(
typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False], ctx: BaseContext | None = ...
typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False], ctx: BaseContext | None = None
) -> _CT: ...
@overload
def Array(
typecode_or_type: type[_CT],
size_or_initializer: int | Sequence[Any],
*,
lock: Literal[True] | _LockLike = ...,
ctx: BaseContext | None = ...,
lock: Literal[True] | _LockLike = True,
ctx: BaseContext | None = None,
) -> SynchronizedArray[_CT]: ...
@overload
def Array(
typecode_or_type: str,
size_or_initializer: int | Sequence[Any],
*,
lock: Literal[True] | _LockLike = ...,
ctx: BaseContext | None = ...,
lock: Literal[True] | _LockLike = True,
ctx: BaseContext | None = None,
) -> SynchronizedArray[Any]: ...
@overload
def Array(
typecode_or_type: str | type[_CData],
size_or_initializer: int | Sequence[Any],
*,
lock: bool | _LockLike = ...,
ctx: BaseContext | None = ...,
lock: bool | _LockLike = True,
ctx: BaseContext | None = None,
) -> Any: ...
def copy(obj: _CT) -> _CT: ...
@overload
def synchronized(obj: _SimpleCData[_T], lock: _LockLike | None = ..., ctx: Any | None = ...) -> Synchronized[_T]: ...
def synchronized(obj: _SimpleCData[_T], lock: _LockLike | None = None, ctx: Any | None = None) -> Synchronized[_T]: ...
@overload
def synchronized(obj: ctypes.Array[c_char], lock: _LockLike | None = ..., ctx: Any | None = ...) -> SynchronizedString: ...
def synchronized(obj: ctypes.Array[c_char], lock: _LockLike | None = None, ctx: Any | None = None) -> SynchronizedString: ...
@overload
def synchronized(obj: ctypes.Array[_CT], lock: _LockLike | None = ..., ctx: Any | None = ...) -> SynchronizedArray[_CT]: ...
def synchronized(obj: ctypes.Array[_CT], lock: _LockLike | None = None, ctx: Any | None = None) -> SynchronizedArray[_CT]: ...
@overload
def synchronized(obj: _CT, lock: _LockLike | None = ..., ctx: Any | None = ...) -> SynchronizedBase[_CT]: ...
def synchronized(obj: _CT, lock: _LockLike | None = None, ctx: Any | None = None) -> SynchronizedBase[_CT]: ...
class _AcquireFunc(Protocol):
def __call__(self, block: bool = ..., timeout: float | None = ...) -> bool: ...

View File

@@ -99,7 +99,7 @@ class NNTP:
self, message_spec: None | str | _list[Any] | tuple[Any, ...], *, file: _File = None
) -> tuple[str, _list[tuple[int, dict[str, str]]]]: ...
if sys.version_info < (3, 9):
def xgtitle(self, group: str, *, file: _File = ...) -> tuple[str, _list[tuple[str, str]]]: ...
def xgtitle(self, group: str, *, file: _File = None) -> tuple[str, _list[tuple[str, str]]]: ...
def xpath(self, id: Any) -> tuple[str, str]: ...
def date(self) -> tuple[str, datetime.datetime]: ...

View File

@@ -101,9 +101,9 @@ def join(__path: BytesPath, *paths: BytesPath) -> bytes: ...
if sys.platform == "win32":
if sys.version_info >= (3, 10):
@overload
def realpath(path: PathLike[AnyStr], *, strict: bool = ...) -> AnyStr: ...
def realpath(path: PathLike[AnyStr], *, strict: bool = False) -> AnyStr: ...
@overload
def realpath(path: AnyStr, *, strict: bool = ...) -> AnyStr: ...
def realpath(path: AnyStr, *, strict: bool = False) -> AnyStr: ...
else:
@overload
def realpath(path: PathLike[AnyStr]) -> AnyStr: ...

View File

@@ -60,7 +60,7 @@ class Real(Complex, SupportsFloat):
def __ceil__(self) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: None = ...) -> int: ...
def __round__(self, ndigits: None = None) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: int) -> Any: ...

View File

@@ -240,9 +240,9 @@ class OptionParser(OptionContainer):
def get_usage(self) -> str: ...
def get_version(self) -> str: ...
@overload
def parse_args(self, args: None = ..., values: Values | None = ...) -> tuple[Values, list[str]]: ...
def parse_args(self, args: None = None, values: Values | None = None) -> tuple[Values, list[str]]: ...
@overload
def parse_args(self, args: Sequence[AnyStr], values: Values | None = ...) -> tuple[Values, list[AnyStr]]: ...
def parse_args(self, args: Sequence[AnyStr], values: Values | None = None) -> tuple[Values, list[AnyStr]]: ...
def print_usage(self, file: IO[str] | None = None) -> None: ...
def print_help(self, file: IO[str] | None = None) -> None: ...
def print_version(self, file: IO[str] | None = None) -> None: ...

View File

@@ -367,7 +367,7 @@ class PathLike(Protocol[AnyStr_co]):
def __fspath__(self) -> AnyStr_co: ...
@overload
def listdir(path: StrPath | None = ...) -> list[str]: ...
def listdir(path: StrPath | None = None) -> list[str]: ...
@overload
def listdir(path: BytesPath) -> list[bytes]: ...
@overload
@@ -516,9 +516,9 @@ _Opener: TypeAlias = Callable[[str, int], int]
@overload
def fdopen(
fd: int,
mode: OpenTextMode = ...,
buffering: int = ...,
encoding: str | None = ...,
mode: OpenTextMode = "r",
buffering: int = -1,
encoding: str | None = None,
errors: str | None = ...,
newline: str | None = ...,
closefd: bool = ...,
@@ -529,7 +529,7 @@ def fdopen(
fd: int,
mode: OpenBinaryMode,
buffering: Literal[0],
encoding: None = ...,
encoding: None = None,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
@@ -539,8 +539,8 @@ def fdopen(
def fdopen(
fd: int,
mode: OpenBinaryModeUpdating,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
buffering: Literal[-1, 1] = -1,
encoding: None = None,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
@@ -550,8 +550,8 @@ def fdopen(
def fdopen(
fd: int,
mode: OpenBinaryModeWriting,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
buffering: Literal[-1, 1] = -1,
encoding: None = None,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
@@ -561,8 +561,8 @@ def fdopen(
def fdopen(
fd: int,
mode: OpenBinaryModeReading,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
buffering: Literal[-1, 1] = -1,
encoding: None = None,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
@@ -572,8 +572,8 @@ def fdopen(
def fdopen(
fd: int,
mode: OpenBinaryMode,
buffering: int = ...,
encoding: None = ...,
buffering: int = -1,
encoding: None = None,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
@@ -583,8 +583,8 @@ def fdopen(
def fdopen(
fd: int,
mode: str,
buffering: int = ...,
encoding: str | None = ...,
buffering: int = -1,
encoding: str | None = None,
errors: str | None = ...,
newline: str | None = ...,
closefd: bool = ...,
@@ -737,7 +737,7 @@ class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_Scand
def close(self) -> None: ...
@overload
def scandir(path: None = ...) -> _ScandirIterator[str]: ...
def scandir(path: None = None) -> _ScandirIterator[str]: ...
@overload
def scandir(path: int) -> _ScandirIterator[str]: ...
@overload
@@ -758,11 +758,11 @@ def truncate(path: FileDescriptorOrPath, length: int) -> None: ... # Unix only
def unlink(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ...
def utime(
path: FileDescriptorOrPath,
times: tuple[int, int] | tuple[float, float] | None = ...,
times: tuple[int, int] | tuple[float, float] | None = None,
*,
ns: tuple[int, int] = ...,
dir_fd: int | None = ...,
follow_symlinks: bool = ...,
dir_fd: int | None = None,
follow_symlinks: bool = True,
) -> None: ...
_OnError: TypeAlias = Callable[[OSError], object]
@@ -886,7 +886,7 @@ def times() -> times_result: ...
def waitpid(__pid: int, __options: int) -> tuple[int, int]: ...
if sys.platform == "win32":
def startfile(path: StrOrBytesPath, operation: str | None = ...) -> None: ...
def startfile(path: StrOrBytesPath, operation: str | None = None) -> None: ...
else:
def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...

View File

@@ -106,54 +106,54 @@ class Path(PurePath):
@overload
def open(
self,
mode: OpenTextMode = ...,
buffering: int = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
mode: OpenTextMode = "r",
buffering: int = -1,
encoding: str | None = None,
errors: str | None = None,
newline: str | None = None,
) -> TextIOWrapper: ...
# Unbuffered binary mode: returns a FileIO
@overload
def open(
self, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = ..., errors: None = ..., newline: None = ...
self, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = None, errors: None = None, newline: None = None
) -> FileIO: ...
# Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter
@overload
def open(
self,
mode: OpenBinaryModeUpdating,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
buffering: Literal[-1, 1] = -1,
encoding: None = None,
errors: None = None,
newline: None = None,
) -> BufferedRandom: ...
@overload
def open(
self,
mode: OpenBinaryModeWriting,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
buffering: Literal[-1, 1] = -1,
encoding: None = None,
errors: None = None,
newline: None = None,
) -> BufferedWriter: ...
@overload
def open(
self,
mode: OpenBinaryModeReading,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
buffering: Literal[-1, 1] = -1,
encoding: None = None,
errors: None = None,
newline: None = None,
) -> BufferedReader: ...
# Buffering cannot be determined: fall back to BinaryIO
@overload
def open(
self, mode: OpenBinaryMode, buffering: int = ..., encoding: None = ..., errors: None = ..., newline: None = ...
self, mode: OpenBinaryMode, buffering: int = -1, encoding: None = None, errors: None = None, newline: None = None
) -> BinaryIO: ...
# Fallback if mode is not specified
@overload
def open(
self, mode: str, buffering: int = ..., encoding: str | None = ..., errors: str | None = ..., newline: str | None = ...
self, mode: str, buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None
) -> IO[Any]: ...
if sys.platform != "win32":
# These methods do "exist" on Windows, but they always raise NotImplementedError,
@@ -197,7 +197,7 @@ class Path(PurePath):
self, data: str, encoding: str | None = None, errors: str | None = None, newline: str | None = None
) -> int: ...
else:
def write_text(self, data: str, encoding: str | None = ..., errors: str | None = ...) -> int: ...
def write_text(self, data: str, encoding: str | None = None, errors: str | None = None) -> int: ...
if sys.version_info >= (3, 8) and sys.version_info < (3, 12):
def link_to(self, target: StrOrBytesPath) -> None: ...
if sys.version_info >= (3, 12):

View File

@@ -133,10 +133,10 @@ if sys.version_info >= (3, 8):
) -> Any: ...
else:
def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = ..., *, fix_imports: bool = ...) -> None: ...
def dumps(obj: Any, protocol: int | None = ..., *, fix_imports: bool = ...) -> bytes: ...
def load(file: _ReadableFileobj, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ...
def loads(data: ReadableBuffer, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ...
def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = None, *, fix_imports: bool = True) -> None: ...
def dumps(obj: Any, protocol: int | None = None, *, fix_imports: bool = True) -> bytes: ...
def load(file: _ReadableFileobj, *, fix_imports: bool = True, encoding: str = "ASCII", errors: str = "strict") -> Any: ...
def loads(data: ReadableBuffer, *, fix_imports: bool = True, encoding: str = "ASCII", errors: str = "strict") -> Any: ...
class PickleError(Exception): ...
class PicklingError(PickleError): ...

View File

@@ -10,18 +10,18 @@ if sys.version_info >= (3, 8):
def libc_ver(executable: str | None = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ...
else:
def libc_ver(executable: str = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> tuple[str, str]: ...
def libc_ver(executable: str = ..., lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ...
if sys.version_info < (3, 8):
def linux_distribution(
distname: str = ...,
version: str = ...,
id: str = ...,
distname: str = "",
version: str = "",
id: str = "",
supported_dists: tuple[str, ...] = ...,
full_distribution_name: bool = ...,
) -> tuple[str, str, str]: ...
def dist(
distname: str = ..., version: str = ..., id: str = ..., supported_dists: tuple[str, ...] = ...
distname: str = "", version: str = "", id: str = "", supported_dists: tuple[str, ...] = ...
) -> tuple[str, str, str]: ...
def win32_ver(release: str = "", version: str = "", csd: str = "", ptype: str = "") -> tuple[str, str, str, str]: ...

View File

@@ -56,15 +56,15 @@ else:
def load(
fp: IO[bytes],
*,
fmt: PlistFormat | None = ...,
use_builtin_types: bool = ...,
fmt: PlistFormat | None = None,
use_builtin_types: bool = True,
dict_type: type[MutableMapping[str, Any]] = ...,
) -> Any: ...
def loads(
value: ReadableBuffer,
*,
fmt: PlistFormat | None = ...,
use_builtin_types: bool = ...,
fmt: PlistFormat | None = None,
use_builtin_types: bool = True,
dict_type: type[MutableMapping[str, Any]] = ...,
) -> Any: ...

View File

@@ -118,9 +118,9 @@ def join(__a: BytesPath, *paths: BytesPath) -> bytes: ...
if sys.version_info >= (3, 10):
@overload
def realpath(filename: PathLike[AnyStr], *, strict: bool = ...) -> AnyStr: ...
def realpath(filename: PathLike[AnyStr], *, strict: bool = False) -> AnyStr: ...
@overload
def realpath(filename: AnyStr, *, strict: bool = ...) -> AnyStr: ...
def realpath(filename: AnyStr, *, strict: bool = False) -> AnyStr: ...
else:
@overload
@@ -129,11 +129,11 @@ else:
def realpath(filename: AnyStr) -> AnyStr: ...
@overload
def relpath(path: LiteralString, start: LiteralString | None = ...) -> LiteralString: ...
def relpath(path: LiteralString, start: LiteralString | None = None) -> LiteralString: ...
@overload
def relpath(path: BytesPath, start: BytesPath | None = ...) -> bytes: ...
def relpath(path: BytesPath, start: BytesPath | None = None) -> bytes: ...
@overload
def relpath(path: StrPath, start: StrPath | None = ...) -> str: ...
def relpath(path: StrPath, start: StrPath | None = None) -> str: ...
@overload
def split(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr]: ...
@overload

View File

@@ -21,16 +21,16 @@ if sys.version_info >= (3, 10):
elif sys.version_info >= (3, 8):
def pformat(
object: object,
indent: int = ...,
width: int = ...,
depth: int | None = ...,
indent: int = 1,
width: int = 80,
depth: int | None = None,
*,
compact: bool = ...,
sort_dicts: bool = ...,
compact: bool = False,
sort_dicts: bool = True,
) -> str: ...
else:
def pformat(object: object, indent: int = ..., width: int = ..., depth: int | None = ..., *, compact: bool = ...) -> str: ...
def pformat(object: object, indent: int = 1, width: int = 80, depth: int | None = None, *, compact: bool = False) -> str: ...
if sys.version_info >= (3, 10):
def pp(
@@ -54,7 +54,7 @@ elif sys.version_info >= (3, 8):
depth: int | None = ...,
*,
compact: bool = ...,
sort_dicts: bool = ...,
sort_dicts: bool = False,
) -> None: ...
if sys.version_info >= (3, 10):
@@ -73,24 +73,24 @@ if sys.version_info >= (3, 10):
elif sys.version_info >= (3, 8):
def pprint(
object: object,
stream: IO[str] | None = ...,
indent: int = ...,
width: int = ...,
depth: int | None = ...,
stream: IO[str] | None = None,
indent: int = 1,
width: int = 80,
depth: int | None = None,
*,
compact: bool = ...,
sort_dicts: bool = ...,
compact: bool = False,
sort_dicts: bool = True,
) -> None: ...
else:
def pprint(
object: object,
stream: IO[str] | None = ...,
indent: int = ...,
width: int = ...,
depth: int | None = ...,
stream: IO[str] | None = None,
indent: int = 1,
width: int = 80,
depth: int | None = None,
*,
compact: bool = ...,
compact: bool = False,
) -> None: ...
def isreadable(object: object) -> bool: ...
@@ -113,23 +113,23 @@ class PrettyPrinter:
elif sys.version_info >= (3, 8):
def __init__(
self,
indent: int = ...,
width: int = ...,
depth: int | None = ...,
stream: IO[str] | None = ...,
indent: int = 1,
width: int = 80,
depth: int | None = None,
stream: IO[str] | None = None,
*,
compact: bool = ...,
sort_dicts: bool = ...,
compact: bool = False,
sort_dicts: bool = True,
) -> None: ...
else:
def __init__(
self,
indent: int = ...,
width: int = ...,
depth: int | None = ...,
stream: IO[str] | None = ...,
indent: int = 1,
width: int = 80,
depth: int | None = None,
stream: IO[str] | None = None,
*,
compact: bool = ...,
compact: bool = False,
) -> None: ...
def pformat(self, object: object) -> str: ...

View File

@@ -32,15 +32,15 @@ if sys.version_info >= (3, 8):
else:
def compile(
file: AnyStr,
cfile: AnyStr | None = ...,
dfile: AnyStr | None = ...,
doraise: bool = ...,
optimize: int = ...,
invalidation_mode: PycInvalidationMode | None = ...,
cfile: AnyStr | None = None,
dfile: AnyStr | None = None,
doraise: bool = False,
optimize: int = -1,
invalidation_mode: PycInvalidationMode | None = None,
) -> AnyStr | None: ...
if sys.version_info >= (3, 10):
def main() -> None: ...
else:
def main(args: list[str] | None = ...) -> int: ...
def main(args: list[str] | None = None) -> int: ...

View File

@@ -31,7 +31,7 @@ class Class:
) -> None: ...
else:
def __init__(
self, module: str, name: str, super: list[Class | str] | None, file: str, lineno: int, parent: Class | None = ...
self, module: str, name: str, super: list[Class | str] | None, file: str, lineno: int, parent: Class | None = None
) -> None: ...
class Function:
@@ -60,7 +60,7 @@ class Function:
end_lineno: int | None = None,
) -> None: ...
else:
def __init__(self, module: str, name: str, file: str, lineno: int, parent: Function | Class | None = ...) -> None: ...
def __init__(self, module: str, name: str, file: str, lineno: int, parent: Function | Class | None = None) -> None: ...
def readmodule(module: str, path: Sequence[str] | None = None) -> dict[str, Class]: ...
def readmodule_ex(module: str, path: Sequence[str] | None = None) -> dict[str, Class | Function | list[str]]: ...

View File

@@ -88,19 +88,19 @@ class HTMLDoc(Doc):
) -> str: ...
def multicolumn(self, list: list[_T], format: Callable[[_T], str]) -> str: ...
else:
def heading(self, title: str, fgcol: str, bgcol: str, extras: str = ...) -> str: ...
def heading(self, title: str, fgcol: str, bgcol: str, extras: str = "") -> str: ...
def section(
self,
title: str,
fgcol: str,
bgcol: str,
contents: str,
width: int = ...,
prelude: str = ...,
marginalia: str | None = ...,
gap: str = ...,
width: int = 6,
prelude: str = "",
marginalia: str | None = None,
gap: str = "&nbsp;",
) -> str: ...
def multicolumn(self, list: list[_T], format: Callable[[_T], str], cols: int = ...) -> str: ...
def multicolumn(self, list: list[_T], format: Callable[[_T], str], cols: int = 4) -> str: ...
def bigsection(self, title: str, *args: Any) -> str: ...
def preformat(self, text: str) -> str: ...

View File

@@ -76,5 +76,5 @@ def ErrorString(__code: int) -> str: ...
# intern is undocumented
def ParserCreate(
encoding: str | None = ..., namespace_separator: str | None = ..., intern: dict[str, Any] | None = ...
encoding: str | None = None, namespace_separator: str | None = None, intern: dict[str, Any] | None = None
) -> XMLParserType: ...

View File

@@ -46,7 +46,7 @@ class Random(_random.Random):
if sys.version_info >= (3, 9):
def seed(self, a: int | float | str | bytes | bytearray | None = None, version: int = 2) -> None: ... # type: ignore[override] # noqa: Y041
else:
def seed(self, a: Any = ..., version: int = ...) -> None: ...
def seed(self, a: Any = None, version: int = 2) -> None: ...
def getstate(self) -> tuple[Any, ...]: ...
def setstate(self, state: tuple[Any, ...]) -> None: ...
@@ -67,24 +67,24 @@ class Random(_random.Random):
if sys.version_info >= (3, 11):
def shuffle(self, x: MutableSequence[Any]) -> None: ...
else:
def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ...
def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = None) -> None: ...
if sys.version_info >= (3, 11):
def sample(self, population: Sequence[_T], k: int, *, counts: Iterable[int] | None = None) -> list[_T]: ...
elif sys.version_info >= (3, 9):
def sample(
self, population: Sequence[_T] | AbstractSet[_T], k: int, *, counts: Iterable[int] | None = ...
self, population: Sequence[_T] | AbstractSet[_T], k: int, *, counts: Iterable[int] | None = None
) -> list[_T]: ...
else:
def sample(self, population: Sequence[_T] | AbstractSet[_T], k: int) -> list[_T]: ...
def uniform(self, a: float, b: float) -> float: ...
def triangular(self, low: float = ..., high: float = ..., mode: float | None = None) -> float: ...
def triangular(self, low: float = 0.0, high: float = 1.0, mode: float | None = None) -> float: ...
def betavariate(self, alpha: float, beta: float) -> float: ...
def expovariate(self, lambd: float) -> float: ...
def gammavariate(self, alpha: float, beta: float) -> float: ...
if sys.version_info >= (3, 11):
def gauss(self, mu: float = ..., sigma: float = ...) -> float: ...
def normalvariate(self, mu: float = ..., sigma: float = ...) -> float: ...
def gauss(self, mu: float = 0.0, sigma: float = 1.0) -> float: ...
def normalvariate(self, mu: float = 0.0, sigma: float = 1.0) -> float: ...
else:
def gauss(self, mu: float, sigma: float) -> float: ...
def normalvariate(self, mu: float, sigma: float) -> float: ...

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