Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Sync typeshed #14992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/_compression.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DecompressReader(RawIOBase):
self,
fp: _Reader,
decomp_factory: Callable[..., object],
trailing_error: type[Exception] | tuple[type[Exception], ...] = ...,
trailing_error: type[Exception] | tuple[type[Exception], ...] = (),
**decomp_args: Any,
) -> None: ...
def readinto(self, b: WriteableBuffer) -> int: ...
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/_dummy_thread.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ __all__ = ["error", "start_new_thread", "exit", "get_ident", "allocate_lock", "i
TIMEOUT_MAX: int
error = RuntimeError

def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any] = ...) -> None: ...
def start_new_thread(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any] = {}) -> None: ...
def exit() -> NoReturn: ...
def get_ident() -> int: ...
def allocate_lock() -> LockType: ...
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/_dummy_threading.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Thread:
group: None = None,
target: Callable[..., object] | None = None,
name: str | None = None,
args: Iterable[Any] = ...,
args: Iterable[Any] = (),
kwargs: Mapping[str, Any] | None = None,
*,
daemon: bool | None = None,
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/_sitebuiltins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Quitter:

class _Printer:
MAXLINES: ClassVar[Literal[23]]
def __init__(self, name: str, data: str, files: Iterable[str] = ..., dirs: Iterable[str] = ...) -> None: ...
def __init__(self, name: str, data: str, files: Iterable[str] = (), dirs: Iterable[str] = ()) -> None: ...
def __call__(self) -> None: ...

class _Helper:
Expand Down
5 changes: 4 additions & 1 deletion mypy/typeshed/stdlib/_winapi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ if sys.platform == "win32":
HIGH_PRIORITY_CLASS: Literal[0x80]
INFINITE: Literal[0xFFFFFFFF]
if sys.version_info >= (3, 8):
INVALID_HANDLE_VALUE: Literal[0xFFFFFFFFFFFFFFFF]
# Ignore the flake8 error -- flake8-pyi assumes
# most numbers this long will be implementation details,
# but here we can see that it's a power of 2
INVALID_HANDLE_VALUE: Literal[0xFFFFFFFFFFFFFFFF] # noqa: Y054
IDLE_PRIORITY_CLASS: Literal[0x40]
NORMAL_PRIORITY_CLASS: Literal[0x20]
REALTIME_PRIORITY_CLASS: Literal[0x100]
Expand Down
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/argparse.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
usage: str | None = None,
description: str | None = None,
epilog: str | None = None,
parents: Sequence[ArgumentParser] = ...,
parents: Sequence[ArgumentParser] = [],
formatter_class: _FormatterClass = ...,
prefix_chars: str = "-",
fromfile_prefix_chars: str | None = None,
Expand All @@ -152,7 +152,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
usage: str | None = None,
description: str | None = None,
epilog: str | None = None,
parents: Sequence[ArgumentParser] = ...,
parents: Sequence[ArgumentParser] = [],
formatter_class: _FormatterClass = ...,
prefix_chars: str = "-",
fromfile_prefix_chars: str | None = None,
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/asyncio/windows_utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if sys.platform == "win32":
BUFSIZE: Literal[8192]
PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT
def pipe(*, duplex: bool = False, overlapped: tuple[bool, bool] = ..., bufsize: int = 8192) -> tuple[int, int]: ...
def pipe(*, duplex: bool = False, overlapped: tuple[bool, bool] = (True, True), bufsize: int = 8192) -> tuple[int, int]: ...

class PipeHandle:
def __init__(self, handle: int) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@ def __import__(
name: str,
globals: Mapping[str, object] | None = None,
locals: Mapping[str, object] | None = None,
fromlist: Sequence[str] = ...,
fromlist: Sequence[str] = (),
level: int = 0,
) -> types.ModuleType: ...
def __build_class__(__func: Callable[[], _Cell | Any], __name: str, *bases: Any, metaclass: Any = ..., **kwds: Any) -> Any: ...
Expand Down
10 changes: 5 additions & 5 deletions mypy/typeshed/stdlib/concurrent/futures/process.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ def _chain_from_iterable_of_lists(iterable: Iterable[MutableSequence[Any]]) -> A
class BrokenProcessPool(BrokenExecutor): ...

class ProcessPoolExecutor(Executor):
_mp_context: BaseContext | None = ...
_initializer: Callable[..., None] | None = ...
_initargs: tuple[Any, ...] = ...
_mp_context: BaseContext | None
_initializer: Callable[..., None] | None
_initargs: tuple[Any, ...]
_executor_manager_thread: _ThreadWakeup
_processes: MutableMapping[int, Process]
_shutdown_thread: bool
Expand All @@ -174,7 +174,7 @@ class ProcessPoolExecutor(Executor):
max_workers: int | None = None,
mp_context: BaseContext | None = None,
initializer: Callable[..., object] | None = None,
initargs: tuple[Any, ...] = ...,
initargs: tuple[Any, ...] = (),
*,
max_tasks_per_child: int | None = None,
) -> None: ...
Expand All @@ -184,7 +184,7 @@ class ProcessPoolExecutor(Executor):
max_workers: int | None = None,
mp_context: BaseContext | None = None,
initializer: Callable[..., object] | None = None,
initargs: tuple[Any, ...] = ...,
initargs: tuple[Any, ...] = (),
) -> None: ...
if sys.version_info >= (3, 9):
def _start_executor_manager_thread(self) -> None: ...
Expand Down
8 changes: 4 additions & 4 deletions mypy/typeshed/stdlib/concurrent/futures/thread.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ class ThreadPoolExecutor(Executor):
_broken: bool
_shutdown: bool
_shutdown_lock: Lock
_thread_name_prefix: str | None = ...
_initializer: Callable[..., None] | None = ...
_initargs: tuple[Any, ...] = ...
_thread_name_prefix: str | None
_initializer: Callable[..., None] | None
_initargs: tuple[Any, ...]
_work_queue: queue.SimpleQueue[_WorkItem[Any]]
def __init__(
self,
max_workers: int | None = None,
thread_name_prefix: str = "",
initializer: Callable[..., object] | None = None,
initargs: tuple[Any, ...] = ...,
initargs: tuple[Any, ...] = (),
) -> None: ...
def _adjust_thread_count(self) -> None: ...
def _initializer_failed(self) -> None: ...
12 changes: 6 additions & 6 deletions mypy/typeshed/stdlib/configparser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class RawConfigParser(_Parser):
dict_type: type[Mapping[str, str]] = ...,
*,
allow_no_value: Literal[True],
delimiters: Sequence[str] = ...,
comment_prefixes: Sequence[str] = ...,
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
Expand All @@ -85,8 +85,8 @@ class RawConfigParser(_Parser):
dict_type: type[Mapping[str, str]],
allow_no_value: Literal[True],
*,
delimiters: Sequence[str] = ...,
comment_prefixes: Sequence[str] = ...,
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
Expand All @@ -101,8 +101,8 @@ class RawConfigParser(_Parser):
dict_type: type[Mapping[str, str]] = ...,
allow_no_value: bool = False,
*,
delimiters: Sequence[str] = ...,
comment_prefixes: Sequence[str] = ...,
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/copy.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _T = TypeVar("_T")
PyStringMap: Any

# Note: memo and _nil are internal kwargs.
def deepcopy(x: _T, memo: dict[int, Any] | None = None, _nil: Any = ...) -> _T: ...
def deepcopy(x: _T, memo: dict[int, Any] | None = None, _nil: Any = []) -> _T: ...
def copy(x: _T) -> _T: ...

class Error(Exception): ...
Expand Down
6 changes: 3 additions & 3 deletions mypy/typeshed/stdlib/dataclasses.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ if sys.version_info >= (3, 11):
cls_name: str,
fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]],
*,
bases: tuple[type, ...] = ...,
bases: tuple[type, ...] = (),
namespace: dict[str, Any] | None = None,
init: bool = True,
repr: bool = True,
Expand All @@ -271,7 +271,7 @@ elif sys.version_info >= (3, 10):
cls_name: str,
fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]],
*,
bases: tuple[type, ...] = ...,
bases: tuple[type, ...] = (),
namespace: dict[str, Any] | None = None,
init: bool = True,
repr: bool = True,
Expand All @@ -289,7 +289,7 @@ else:
cls_name: str,
fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]],
*,
bases: tuple[type, ...] = ...,
bases: tuple[type, ...] = (),
namespace: dict[str, Any] | None = None,
init: bool = True,
repr: bool = True,
Expand Down
50 changes: 25 additions & 25 deletions mypy/typeshed/stdlib/datetime.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sys
from abc import abstractmethod
from time import struct_time
from typing import ClassVar, NamedTuple, NoReturn, TypeVar, overload
from typing_extensions import Literal, Self, TypeAlias, final
from typing_extensions import Literal, Self, SupportsIndex, TypeAlias, final

if sys.version_info >= (3, 11):
__all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR", "UTC")
Expand Down Expand Up @@ -49,7 +49,7 @@ class date:
min: ClassVar[date]
max: ClassVar[date]
resolution: ClassVar[timedelta]
def __new__(cls, year: int, month: int, day: int) -> Self: ...
def __new__(cls, year: SupportsIndex, month: SupportsIndex, day: SupportsIndex) -> Self: ...
@classmethod
def fromtimestamp(cls, __timestamp: float) -> Self: ...
@classmethod
Expand Down Expand Up @@ -81,7 +81,7 @@ class date:
def isoformat(self) -> str: ...
def timetuple(self) -> struct_time: ...
def toordinal(self) -> int: ...
def replace(self, year: int = ..., month: int = ..., day: int = ...) -> Self: ...
def replace(self, year: SupportsIndex = ..., month: SupportsIndex = ..., day: SupportsIndex = ...) -> Self: ...
def __le__(self, __value: date) -> bool: ...
def __lt__(self, __value: date) -> bool: ...
def __ge__(self, __value: date) -> bool: ...
Expand Down Expand Up @@ -119,10 +119,10 @@ class time:
resolution: ClassVar[timedelta]
def __new__(
cls,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
hour: SupportsIndex = ...,
minute: SupportsIndex = ...,
second: SupportsIndex = ...,
microsecond: SupportsIndex = ...,
tzinfo: _TzInfo | None = ...,
*,
fold: int = ...,
Expand Down Expand Up @@ -160,10 +160,10 @@ class time:
def dst(self) -> timedelta | None: ...
def replace(
self,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
hour: SupportsIndex = ...,
minute: SupportsIndex = ...,
second: SupportsIndex = ...,
microsecond: SupportsIndex = ...,
tzinfo: _TzInfo | None = ...,
*,
fold: int = ...,
Expand Down Expand Up @@ -223,13 +223,13 @@ class datetime(date):
max: ClassVar[datetime]
def __new__(
cls,
year: int,
month: int,
day: int,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
year: SupportsIndex,
month: SupportsIndex,
day: SupportsIndex,
hour: SupportsIndex = ...,
minute: SupportsIndex = ...,
second: SupportsIndex = ...,
microsecond: SupportsIndex = ...,
tzinfo: _TzInfo | None = ...,
*,
fold: int = ...,
Expand Down Expand Up @@ -280,13 +280,13 @@ class datetime(date):
def timetz(self) -> _Time: ...
def replace(
self,
year: int = ...,
month: int = ...,
day: int = ...,
hour: int = ...,
minute: int = ...,
second: int = ...,
microsecond: int = ...,
year: SupportsIndex = ...,
month: SupportsIndex = ...,
day: SupportsIndex = ...,
hour: SupportsIndex = ...,
minute: SupportsIndex = ...,
second: SupportsIndex = ...,
microsecond: SupportsIndex = ...,
tzinfo: _TzInfo | None = ...,
*,
fold: int = ...,
Expand Down
10 changes: 5 additions & 5 deletions mypy/typeshed/stdlib/dis.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ _HaveCodeType: TypeAlias = types.MethodType | types.FunctionType | types.CodeTyp

if sys.version_info >= (3, 11):
class Positions(NamedTuple):
lineno: int | None = ...
end_lineno: int | None = ...
col_offset: int | None = ...
end_col_offset: int | None = ...
lineno: int | None = None
end_lineno: int | None = None
col_offset: int | None = None
end_col_offset: int | None = None

if sys.version_info >= (3, 11):
class Instruction(NamedTuple):
Expand All @@ -54,7 +54,7 @@ if sys.version_info >= (3, 11):
offset: int
starts_line: int | None
is_jump_target: bool
positions: Positions | None = ...
positions: Positions | None = None

else:
class Instruction(NamedTuple):
Expand Down
1 change: 1 addition & 0 deletions mypy/typeshed/stdlib/distutils/cmd.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ from distutils.dist import Distribution
from typing import Any

class Command:
distribution: Distribution
sub_commands: list[tuple[str, Callable[[Command], bool] | None]]
def __init__(self, dist: Distribution) -> None: ...
@abstractmethod
Expand Down
6 changes: 3 additions & 3 deletions mypy/typeshed/stdlib/distutils/command/build_ext.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class build_ext(Command):
def build_extension(self, ext) -> None: ...
def swig_sources(self, sources, extension): ...
def find_swig(self): ...
def get_ext_fullpath(self, ext_name): ...
def get_ext_fullname(self, ext_name): ...
def get_ext_filename(self, ext_name): ...
def get_ext_fullpath(self, ext_name: str) -> str: ...
def get_ext_fullname(self, ext_name: str) -> str: ...
def get_ext_filename(self, ext_name: str) -> str: ...
def get_export_symbols(self, ext): ...
def get_libraries(self, ext): ...
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/distutils/command/config.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class config(Command):
library_dirs: Sequence[str] | None = None,
headers: Sequence[str] | None = None,
include_dirs: Sequence[str] | None = None,
other_libraries: list[str] = ...,
other_libraries: list[str] = [],
) -> bool: ...
def check_header(
self, header: str, include_dirs: Sequence[str] | None = None, library_dirs: Sequence[str] | None = None, lang: str = "c"
Expand Down
Loading