diff --git a/misc/typeshed_patches/0001-Revert-datetime-generic-tzinfo-change.patch b/misc/typeshed_patches/0001-Revert-datetime-generic-tzinfo-change.patch new file mode 100644 index 000000000000..9edb9625f717 --- /dev/null +++ b/misc/typeshed_patches/0001-Revert-datetime-generic-tzinfo-change.patch @@ -0,0 +1,302 @@ +From cecd8a28f320ae88ea25387ed3d23c8b3b189486 Mon Sep 17 00:00:00 2001 +From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> +Date: Thu, 5 Nov 2026 13:08:55 +0100 +Subject: [PATCH] Revert datetime generic tzinfo change + +--- + mypy/typeshed/stdlib/datetime.pyi | 213 ++++-------------------------- + 1 file changed, 25 insertions(+), 188 deletions(-) + +diff --git a/mypy/typeshed/stdlib/datetime.pyi b/mypy/typeshed/stdlib/datetime.pyi +index 5272e3850..0a21f72b0 100644 +--- a/mypy/typeshed/stdlib/datetime.pyi ++++ b/mypy/typeshed/stdlib/datetime.pyi +@@ -1,7 +1,7 @@ + import sys + from abc import abstractmethod + from time import struct_time +-from typing import Any, ClassVar, Final, Generic, SupportsIndex, TypeAlias, TypeVar, final, overload, type_check_only ++from typing import ClassVar, Final, SupportsIndex, TypeAlias, final, overload, type_check_only + from typing_extensions import CapsuleType, Never, Self, deprecated, disjoint_base + + if sys.version_info >= (3, 11): +@@ -266,28 +266,10 @@ class timedelta: + def __bool__(self) -> bool: ... + def __hash__(self) -> int: ... + +-_TzInfoT = TypeVar("_TzInfoT", bound=tzinfo | None, default=Any) +- + @disjoint_base +-class datetime(date, Generic[_TzInfoT]): +- min: ClassVar[datetime[None]] +- max: ClassVar[datetime[None]] +- +- @overload +- def __new__( +- cls, +- year: SupportsIndex, +- month: SupportsIndex, +- day: SupportsIndex, +- hour: SupportsIndex = 0, +- minute: SupportsIndex = 0, +- second: SupportsIndex = 0, +- microsecond: SupportsIndex = 0, +- tzinfo: None = None, +- *, +- fold: int = 0, +- ) -> datetime[None]: ... +- @overload ++class datetime(date): ++ min: ClassVar[datetime] ++ max: ClassVar[datetime] + def __new__( + cls, + year: SupportsIndex, +@@ -297,25 +279,10 @@ class datetime(date, Generic[_TzInfoT]): + minute: SupportsIndex = 0, + second: SupportsIndex = 0, + microsecond: SupportsIndex = 0, +- *, +- tzinfo: _TzInfo, +- fold: int = 0, +- ) -> datetime[_TzInfo]: ... +- @overload +- def __new__( +- cls, +- year: SupportsIndex, +- month: SupportsIndex, +- day: SupportsIndex, +- hour: SupportsIndex, +- minute: SupportsIndex, +- second: SupportsIndex, +- microsecond: SupportsIndex, +- tzinfo: _TzInfo, ++ tzinfo: _TzInfo | None = None, + *, + fold: int = 0, +- ) -> datetime[_TzInfo]: ... +- ++ ) -> Self: ... + @property + def hour(self) -> int: ... + @property +@@ -325,64 +292,32 @@ class datetime(date, Generic[_TzInfoT]): + @property + def microsecond(self) -> int: ... + @property +- def tzinfo(self) -> _TzInfoT: ... ++ def tzinfo(self) -> _TzInfo | None: ... + @property + def fold(self) -> int: ... + # On <3.12, the name of the first parameter in the pure-Python implementation + # didn't match the name in the C implementation, + # meaning it is only *safe* to pass it as a keyword argument on 3.12+ + if sys.version_info >= (3, 12): +- @overload # type: ignore[override] +- @classmethod +- def fromtimestamp(cls, timestamp: float, tz: None = None) -> datetime[None]: ... +- @overload + @classmethod +- def fromtimestamp(cls, timestamp: float, tz: _TzInfo) -> datetime[_TzInfo]: ... +- @overload +- @classmethod +- def fromtimestamp(cls, timestamp: float, tz: _TzInfo | None) -> datetime[_TzInfo] | datetime[None]: ... +- else: +- @overload # type: ignore[override] +- @classmethod +- def fromtimestamp(cls, timestamp: float, /, tz: None = None) -> datetime[None]: ... +- @overload +- @classmethod +- def fromtimestamp(cls, timestamp: float, /, tz: _TzInfo) -> datetime[_TzInfo]: ... +- @overload +- @classmethod +- def fromtimestamp(cls, timestamp: float, /, tz: _TzInfo | None) -> datetime[_TzInfo] | datetime[None]: ... +- +- # fromisoformat returns Self, but we can't specialize "Self" +- if sys.version_info >= (3, 15): +- @classmethod +- def fromisoformat(cls, string: str, /) -> datetime[_TzInfo] | datetime[None]: ... # type: ignore[override] ++ def fromtimestamp(cls, timestamp: float, tz: _TzInfo | None = None) -> Self: ... + else: + @classmethod +- def fromisoformat(cls, date_string: str, /) -> datetime[_TzInfo] | datetime[None]: ... # type: ignore[override] +- +- @classmethod +- @deprecated("Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.UTC)") +- def utcfromtimestamp(cls, t: float, /) -> datetime[None]: ... +- +- @overload +- @classmethod +- def now(cls, tz: None = None) -> datetime[None]: ... +- @overload +- @classmethod +- def now(cls, tz: _TzInfo) -> datetime[_TzInfo]: ... ++ def fromtimestamp(cls, timestamp: float, /, tz: _TzInfo | None = None) -> Self: ... + + @classmethod +- def today(cls) -> datetime[None]: ... # type: ignore[override] ++ @deprecated("Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.timezone.utc)") ++ def utcfromtimestamp(cls, t: float, /) -> Self: ... + @classmethod +- @deprecated("Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.UTC)") +- def utcnow(cls) -> datetime[None]: ... +- +- @overload ++ def now(cls, tz: _TzInfo | None = None) -> Self: ... + @classmethod +- def combine(cls, date: _Date, time: _Time, tzinfo: None = None) -> datetime[None]: ... +- @overload ++ @deprecated("Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)") ++ def utcnow(cls) -> Self: ... + @classmethod +- def combine(cls, date: _Date, time: _Time, tzinfo: _TzInfo) -> datetime[_TzInfo]: ... ++ def combine(cls, date: _Date, time: _Time, tzinfo: _TzInfo | None = ...) -> Self: ... ++ if sys.version_info >= (3, 15): ++ @classmethod ++ def fromisoformat(cls, string: str, /) -> Self: ... + + def timestamp(self) -> float: ... + def utctimetuple(self) -> struct_time: ... +@@ -405,7 +340,6 @@ class datetime(date, Generic[_TzInfoT]): + fold: int = ..., + ) -> Self: ... + +- @overload + def replace( + self, + year: SupportsIndex = ..., +@@ -415,67 +349,11 @@ class datetime(date, Generic[_TzInfoT]): + minute: SupportsIndex = ..., + second: SupportsIndex = ..., + microsecond: SupportsIndex = ..., ++ tzinfo: _TzInfo | None = ..., + *, + fold: int = ..., + ) -> Self: ... +- @overload +- def replace( +- self, +- year: SupportsIndex, +- month: SupportsIndex, +- day: SupportsIndex, +- hour: SupportsIndex, +- minute: SupportsIndex, +- second: SupportsIndex, +- microsecond: SupportsIndex, +- tzinfo: _TzInfo, +- *, +- fold: int = ..., +- ) -> datetime[_TzInfo]: ... +- @overload +- def replace( +- self, +- year: SupportsIndex = ..., +- month: SupportsIndex = ..., +- day: SupportsIndex = ..., +- hour: SupportsIndex = ..., +- minute: SupportsIndex = ..., +- second: SupportsIndex = ..., +- microsecond: SupportsIndex = ..., +- *, +- tzinfo: _TzInfo, +- fold: int = ..., +- ) -> datetime[_TzInfo]: ... +- @overload +- def replace( +- self, +- year: SupportsIndex, +- month: SupportsIndex, +- day: SupportsIndex, +- hour: SupportsIndex, +- minute: SupportsIndex, +- second: SupportsIndex, +- microsecond: SupportsIndex, +- tzinfo: None, +- *, +- fold: int = ..., +- ) -> datetime[None]: ... +- @overload +- def replace( +- self, +- year: SupportsIndex = ..., +- month: SupportsIndex = ..., +- day: SupportsIndex = ..., +- hour: SupportsIndex = ..., +- minute: SupportsIndex = ..., +- second: SupportsIndex = ..., +- microsecond: SupportsIndex = ..., +- *, +- tzinfo: None, +- fold: int = ..., +- ) -> datetime[None]: ... +- +- def astimezone(self, tz: _TzInfo | None = None) -> datetime[_TzInfo]: ... ++ def astimezone(self, tz: _TzInfo | None = None) -> Self: ... + def isoformat(self, sep: str = "T", timespec: str = "auto") -> str: ... + + if sys.version_info >= (3, 15): +@@ -488,56 +366,15 @@ class datetime(date, Generic[_TzInfoT]): + def utcoffset(self) -> timedelta | None: ... + def tzname(self) -> str | None: ... + def dst(self) -> timedelta | None: ... +- +- @overload # type: ignore[override] +- def __le__( # type: ignore[overload-overlap] +- self: datetime[_TzInfo] | datetime[_TzInfo | None], value: datetime[_TzInfo] | datetime[_TzInfo | None], / +- ) -> bool: ... # type: ignore[misc] +- @overload +- def __le__(self: datetime[None] | datetime[_TzInfo | None], value: datetime[None] | datetime[_TzInfo | None], /) -> bool: ... # type: ignore[misc] +- @overload +- def __le__(self: datetime[Any], value: datetime[Any], /) -> Never: ... +- +- @overload # type: ignore[override] +- def __lt__( # type: ignore[overload-overlap] +- self: datetime[_TzInfo] | datetime[_TzInfo | None], value: datetime[_TzInfo] | datetime[_TzInfo | None], / +- ) -> bool: ... # type: ignore[misc] +- @overload +- def __lt__(self: datetime[None] | datetime[_TzInfo | None], value: datetime[None] | datetime[_TzInfo | None], /) -> bool: ... # type: ignore[misc] +- @overload +- def __lt__(self: datetime[Any], value: datetime[Any], /) -> Never: ... +- +- @overload # type: ignore[override] +- def __ge__( # type: ignore[overload-overlap] +- self: datetime[_TzInfo] | datetime[_TzInfo | None], value: datetime[_TzInfo] | datetime[_TzInfo | None], / +- ) -> bool: ... # type: ignore[misc] +- @overload +- def __ge__(self: datetime[None] | datetime[_TzInfo | None], value: datetime[None] | datetime[_TzInfo | None], /) -> bool: ... # type: ignore[misc] +- @overload +- def __ge__(self: datetime[Any], value: datetime[Any], /) -> Never: ... +- +- @overload # type: ignore[override] +- def __gt__( # type: ignore[overload-overlap] +- self: datetime[_TzInfo] | datetime[_TzInfo | None], value: datetime[_TzInfo] | datetime[_TzInfo | None], / +- ) -> bool: ... # type: ignore[misc] +- @overload +- def __gt__(self: datetime[None] | datetime[_TzInfo | None], value: datetime[None] | datetime[_TzInfo | None], /) -> bool: ... # type: ignore[misc] +- @overload +- def __gt__(self: datetime[Any], value: datetime[Any], /) -> Never: ... +- ++ def __le__(self, value: datetime, /) -> bool: ... # type: ignore[override] ++ def __lt__(self, value: datetime, /) -> bool: ... # type: ignore[override] ++ def __ge__(self, value: datetime, /) -> bool: ... # type: ignore[override] ++ def __gt__(self, value: datetime, /) -> bool: ... # type: ignore[override] + def __eq__(self, value: object, /) -> bool: ... + def __hash__(self) -> int: ... + + @overload # type: ignore[override] +- def __sub__( # type: ignore[overload-overlap] +- self: datetime[_TzInfo] | datetime[_TzInfo | None], value: datetime[_TzInfo] | datetime[_TzInfo | None], / +- ) -> timedelta: ... +- @overload +- def __sub__( # type: ignore[overload-overlap] +- self: datetime[None] | datetime[_TzInfo | None], value: datetime[None] | datetime[_TzInfo | None], / +- ) -> timedelta: ... +- @overload +- def __sub__(self: datetime[Any], value: datetime[Any], /) -> Never: ... ++ def __sub__(self, value: Self, /) -> timedelta: ... + @overload + def __sub__(self, value: timedelta, /) -> Self: ... + +-- +2.56.0 + diff --git a/mypy/typeshed/stdlib/VERSIONS b/mypy/typeshed/stdlib/VERSIONS index 96eb98131db6..4d110df06657 100644 --- a/mypy/typeshed/stdlib/VERSIONS +++ b/mypy/typeshed/stdlib/VERSIONS @@ -26,6 +26,7 @@ _blake2: 3.6- _bz2: 3.3- _codecs: 3.0- _collections_abc: 3.3- +_colorize: 3.13- _compat_pickle: 3.1- _compression: 3.5-3.13 _contextvars: 3.7- diff --git a/mypy/typeshed/stdlib/_colorize.pyi b/mypy/typeshed/stdlib/_colorize.pyi new file mode 100644 index 000000000000..56914f97223d --- /dev/null +++ b/mypy/typeshed/stdlib/_colorize.pyi @@ -0,0 +1,418 @@ +import builtins +import sys +from collections.abc import Iterator, Mapping +from dataclasses import dataclass +from typing import Any, Final, Literal, TypeAlias +from typing_extensions import Self + +# A protocol with an optional `fileno(self) -> int: ...` member. +_MaySupportFileno: TypeAlias = Any + +COLORIZE: bool + +if sys.version_info >= (3, 14): + _theme: Theme # undocumented + +if sys.version_info >= (3, 15): + BackgroundStyle: TypeAlias = Literal["dark", "light"] + +class ANSIColors: + RESET: Final = "\x1b[0m" + BLACK: Final = "\x1b[30m" + BLUE: Final = "\x1b[34m" + CYAN: Final = "\x1b[36m" + GREEN: Final = "\x1b[32m" + if sys.version_info >= (3, 14): + GREY: Final = "\x1b[90m" + MAGENTA: Final = "\x1b[35m" + RED: Final = "\x1b[31m" + WHITE: Final = "\x1b[37m" + YELLOW: Final = "\x1b[33m" + + if sys.version_info >= (3, 14): + BOLD: Final = "\x1b[1m" + BOLD_BLACK: Final = "\x1b[1;30m" + BOLD_BLUE: Final = "\x1b[1;34m" + BOLD_CYAN: Final = "\x1b[1;36m" + BOLD_GREEN: Final = "\x1b[1;32m" + BOLD_MAGENTA: Final = "\x1b[1;35m" + BOLD_RED: Final = "\x1b[1;31m" + BOLD_WHITE: Final = "\x1b[1;37m" + BOLD_YELLOW: Final = "\x1b[1;33m" + + INTENSE_BLACK: Final = "\x1b[90m" + INTENSE_BLUE: Final = "\x1b[94m" + INTENSE_CYAN: Final = "\x1b[96m" + INTENSE_GREEN: Final = "\x1b[92m" + INTENSE_MAGENTA: Final = "\x1b[95m" + INTENSE_RED: Final = "\x1b[91m" + INTENSE_WHITE: Final = "\x1b[97m" + INTENSE_YELLOW: Final = "\x1b[93m" + + BACKGROUND_BLACK: Final = "\x1b[40m" + BACKGROUND_BLUE: Final = "\x1b[44m" + BACKGROUND_CYAN: Final = "\x1b[46m" + BACKGROUND_GREEN: Final = "\x1b[42m" + BACKGROUND_MAGENTA: Final = "\x1b[45m" + BACKGROUND_RED: Final = "\x1b[41m" + BACKGROUND_WHITE: Final = "\x1b[47m" + BACKGROUND_YELLOW: Final = "\x1b[43m" + + INTENSE_BACKGROUND_BLACK: Final = "\x1b[100m" + INTENSE_BACKGROUND_BLUE: Final = "\x1b[104m" + INTENSE_BACKGROUND_CYAN: Final = "\x1b[106m" + INTENSE_BACKGROUND_GREEN: Final = "\x1b[102m" + INTENSE_BACKGROUND_MAGENTA: Final = "\x1b[105m" + INTENSE_BACKGROUND_RED: Final = "\x1b[101m" + INTENSE_BACKGROUND_WHITE: Final = "\x1b[107m" + INTENSE_BACKGROUND_YELLOW: Final = "\x1b[103m" + +if sys.version_info >= (3, 14): + ColorCodes: Final[set[str]] + +NoColors: Final[ANSIColors] + +if sys.version_info >= (3, 15): + class CursesColors: + BLACK: Final = 0 + RED: Final = 1 + GREEN: Final = 2 + YELLOW: Final = 3 + BLUE: Final = 4 + MAGENTA: Final = 5 + CYAN: Final = 6 + WHITE: Final = 7 + DEFAULT: Final = -1 + +if sys.version_info >= (3, 14): + class ThemeSection(Mapping[str, str]): + def __post_init__(self) -> None: ... + def copy_with(self, **kwargs: str) -> Self: ... + @classmethod + def no_colors(cls) -> Self: ... + def __getitem__(self, key: str) -> str: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[str]: ... + +if sys.version_info >= (3, 15): + @dataclass(frozen=True, kw_only=True) + class Argparse(ThemeSection): + usage: str = ... + prog: str = ... + prog_extra: str = ... + heading: str = ... + summary_long_option: str = ... + summary_short_option: str = ... + summary_label: str = ... + summary_action: str = ... + long_option: str = ... + short_option: str = ... + label: str = ... + action: str = ... + default: str = ... + interpolated_value: str = ... + reset: str = ... + error: str = ... + warning: str = ... + message: str = ... + + @dataclass(frozen=True, kw_only=True) + class Ast(ThemeSection): + node: str = ... + field: str = ... + attribute: str = ... + string: str = ... + number: str = ... + keyword: str = ... + reset: str = ... + + @dataclass(frozen=True, kw_only=True) + class Calendar(ThemeSection): + header: str = ... + highlight: str = ... + weekday: str = ... + reset: str = ... + + @dataclass(frozen=True, kw_only=True) + class Difflib(ThemeSection): + added: str = ... + context: str = ... + header: str = ... + hunk: str = ... + removed: str = ... + reset: str = ... + + @dataclass(frozen=True, kw_only=True) + class FancyCompleter(ThemeSection): + function: builtins.str = ... + builtin_function_or_method: builtins.str = ... + method: builtins.str = ... + method_wrapper: builtins.str = ... + wrapper_descriptor: builtins.str = ... + method_descriptor: builtins.str = ... + int: builtins.str = ... + float: builtins.str = ... + complex: builtins.str = ... + bool: builtins.str = ... + type: builtins.str = ... + module: builtins.str = ... + NoneType: builtins.str = ... + bytes: builtins.str = ... + str: builtins.str = ... + + @dataclass(frozen=True, kw_only=True) + class HttpServer(ThemeSection): + error: str = ... + path: str = ... + serving: str = ... + size: str = ... + status_informational: str = ... + status_ok: str = ... + status_redirect: str = ... + status_client_error: str = ... + status_server_error: str = ... + timestamp: str = ... + url: str = ... + reset: str = ... + + @dataclass(frozen=True, kw_only=True) + class LiveProfiler(ThemeSection): + title_fg: int = ... + title_bg: int = ... + pid_fg: int = ... + uptime_fg: int = ... + time_fg: int = ... + interval_fg: int = ... + thread_all_fg: int = ... + thread_single_fg: int = ... + bar_good_fg: int = ... + bar_bad_fg: int = ... + on_gil_fg: int = ... + off_gil_fg: int = ... + waiting_gil_fg: int = ... + gc_fg: int = ... + func_total_fg: int = ... + func_exec_fg: int = ... + func_stack_fg: int = ... + func_shown_fg: int = ... + sorted_header_fg: int = ... + sorted_header_bg: int = ... + normal_header_fg: int = ... + normal_header_bg: int = ... + samples_fg: int = ... + file_fg: int = ... + func_fg: int = ... + trend_up_fg: int = ... + trend_down_fg: int = ... + medal_gold_fg: int = ... + medal_silver_fg: int = ... + medal_bronze_fg: int = ... + background_style: BackgroundStyle = "dark" + + LiveProfilerLight: Final[LiveProfiler] + + @dataclass(frozen=True, kw_only=True) + class ProfilerDump(ThemeSection): + header: str = ... + interpreter: str = ... + thread: str = ... + status: str = ... + frame_index: str = ... + frame: str = ... + filename: str = ... + line_no: str = ... + source: str = ... + source_highlight: str = ... + opcode: str = ... + warning: str = ... + reset: str = ... + + @dataclass(frozen=True, kw_only=True) + class Pickletools(ThemeSection): + annotation: str = ... + arg_number: str = ... + arg_string: str = ... + mark: str = ... + op_call: str = ... + op_container: str = ... + op_memo: str = ... + op_meta: str = ... + op_stack: str = ... + opcode_code: str = ... + position: str = ... + proto: str = ... + reset: str = ... + + @dataclass(frozen=True, kw_only=True) + class Syntax(ThemeSection): + prompt: str = ... + keyword: str = ... + keyword_constant: str = ... + builtin: str = ... + comment: str = ... + string: str = ... + number: str = ... + op: str = ... + definition: str = ... + soft_keyword: str = ... + reset: str = ... + + @dataclass(frozen=True, kw_only=True) + class Timeit(ThemeSection): + timing: str = ... + best: str = ... + per_loop: str = ... + punctuation: str = ... + warning: str = ... + warning_worst: str = ... + warning_best: str = ... + reset: str = ... + + @dataclass(frozen=True, kw_only=True) + class Tokenize(ThemeSection): + whitespace: str = ... + error: str = ... + position: str = ... + delimiter: str = ... + + @dataclass(frozen=True, kw_only=True) + class Traceback(ThemeSection): + type: str = ... + message: str = ... + note: str = ... + filename: str = ... + line_no: str = ... + frame: str = ... + error_highlight: str = ... + error_range: str = ... + reset: str = ... + + @dataclass(frozen=True, kw_only=True) + class Unittest(ThemeSection): + passed: str = ... + warn: str = ... + fail: str = ... + fail_info: str = ... + reset: str = ... + + @dataclass(frozen=True, kw_only=True) + class Theme: + argparse: Argparse = ... + ast: Ast = ... + calendar: Calendar = ... + difflib: Difflib = ... + fancycompleter: FancyCompleter = ... + http_server: HttpServer = ... + live_profiler: LiveProfiler = ... + pickletools: Pickletools = ... + profiler_dump: ProfilerDump = ... + syntax: Syntax = ... + timeit: Timeit = ... + tokenize: Tokenize = ... + traceback: Traceback = ... + unittest: Unittest = ... + def copy_with( + self, + *, + argparse: Argparse | None = None, + ast: Ast | None = None, + calendar: Calendar | None = None, + difflib: Difflib | None = None, + fancycompleter: FancyCompleter | None = None, + http_server: HttpServer | None = None, + live_profiler: LiveProfiler | None = None, + pickletools: Pickletools | None = None, + profiler_dump: ProfilerDump | None = None, + syntax: Syntax | None = None, + timeit: Timeit | None = None, + tokenize: Tokenize | None = None, + traceback: Traceback | None = None, + unittest: Unittest | None = None, + ) -> Self: ... + @classmethod + def no_colors(cls) -> Self: ... + +elif sys.version_info >= (3, 14): + @dataclass(frozen=True, kw_only=True) + class Argparse(ThemeSection): + usage: str = ... + prog: str = ... + prog_extra: str = ... + heading: str = ... + summary_long_option: str = ... + summary_short_option: str = ... + summary_label: str = ... + summary_action: str = ... + long_option: str = ... + short_option: str = ... + label: str = ... + action: str = ... + reset: str = ... + + @dataclass(frozen=True) + class Syntax(ThemeSection): + prompt: str = ... + keyword: str = ... + keyword_constant: str = ... + builtin: str = ... + comment: str = ... + string: str = ... + number: str = ... + op: str = ... + definition: str = ... + soft_keyword: str = ... + reset: str = ... + + @dataclass(frozen=True) + class Traceback(ThemeSection): + type: str = ... + message: str = ... + filename: str = ... + line_no: str = ... + frame: str = ... + error_highlight: str = ... + error_range: str = ... + reset: str = ... + + @dataclass(frozen=True) + class Unittest(ThemeSection): + passed: str = ... + warn: str = ... + fail: str = ... + fail_info: str = ... + reset: str = ... + + @dataclass(frozen=True) + class Theme: + argparse: Argparse = ... + syntax: Syntax = ... + traceback: Traceback = ... + unittest: Unittest = ... + def copy_with( + self, + *, + argparse: Argparse | None = None, + syntax: Syntax | None = None, + traceback: Traceback | None = None, + unittest: Unittest | None = None, + ) -> Self: ... + @classmethod + def no_colors(cls) -> Self: ... + +def get_colors(colorize: bool = False, *, file: _MaySupportFileno | None = None) -> ANSIColors: ... + +if sys.version_info >= (3, 14): + def decolor(text: str) -> str: ... + +def can_colorize(*, file: _MaySupportFileno | None = None) -> bool: ... + +if sys.version_info >= (3, 14): + default_theme: Final[Theme] + theme_no_color: Final[Theme] + if sys.version_info >= (3, 15): + light_profiler_theme: Final[Theme] + + def get_theme( + *, tty_file: _MaySupportFileno | None = None, force_color: bool = False, force_no_color: bool = False + ) -> Theme: ... + def set_theme(t: Theme) -> None: ... diff --git a/mypy/typeshed/stdlib/_io.pyi b/mypy/typeshed/stdlib/_io.pyi index 5e216123be98..e62fc51d0f46 100644 --- a/mypy/typeshed/stdlib/_io.pyi +++ b/mypy/typeshed/stdlib/_io.pyi @@ -2,7 +2,7 @@ import builtins import codecs import sys from _typeshed import FileDescriptorOrPath, MaybeNone, ReadableBuffer, WriteableBuffer -from collections.abc import Callable, Iterable, Iterator +from collections.abc import Iterable, Iterator from io import BufferedIOBase, RawIOBase, TextIOBase, UnsupportedOperation as UnsupportedOperation from os import _Opener from types import TracebackType @@ -36,14 +36,16 @@ if sys.version_info >= (3, 12): def flush(self) -> None: ... def isatty(self) -> bool: ... def readable(self) -> bool: ... - read: Callable[..., Any] + # Abstract method that doesn't exist at runtime, the exact return type depends on the sub-class + def read(self, size: int = ..., /) -> Any: ... def readlines(self, hint: int = -1, /) -> list[bytes]: ... def seek(self, offset: int, whence: int = 0, /) -> int: ... def seekable(self) -> bool: ... def tell(self) -> int: ... def truncate(self, size: int | None = None, /) -> int: ... def writable(self) -> bool: ... - write: Callable[..., Any] + # Abstract method that doesn't exist at runtime, the exact arguments and return type depend on the sub-class + def write(self, s: Any, /) -> Any: ... def writelines(self, lines: Iterable[ReadableBuffer], /) -> None: ... def readline(self, size: int | None = -1, /) -> bytes: ... def __del__(self) -> None: ... @@ -64,14 +66,16 @@ else: def flush(self) -> None: ... def isatty(self) -> bool: ... def readable(self) -> bool: ... - read: Callable[..., Any] + # Abstract method that doesn't exist at runtime, the exact arguments and return type depend on the sub-class + def read(self) -> Any: ... def readlines(self, hint: int = -1, /) -> list[bytes]: ... def seek(self, offset: int, whence: int = 0, /) -> int: ... def seekable(self) -> bool: ... def tell(self) -> int: ... def truncate(self, size: int | None = None, /) -> int: ... def writable(self) -> bool: ... - write: Callable[..., Any] + # Abstract method that doesn't exist at runtime, the exact arguments and return type depend on the sub-class + def write(self, s: Any, /) -> Any: ... def writelines(self, lines: Iterable[ReadableBuffer], /) -> None: ... def readline(self, size: int | None = -1, /) -> bytes: ... def __del__(self) -> None: ... diff --git a/mypy/typeshed/stdlib/_remote_debugging.pyi b/mypy/typeshed/stdlib/_remote_debugging.pyi index 5c150442c5e3..1e9f411dd130 100644 --- a/mypy/typeshed/stdlib/_remote_debugging.pyi +++ b/mypy/typeshed/stdlib/_remote_debugging.pyi @@ -156,6 +156,9 @@ class BinaryWriter: ) -> None: ... @property def total_samples(self) -> int: ... + # Added in Python 3.15.1. + @property + def limit_reached(self) -> bool: ... def write_sample(self, stack_frames: list[InterpreterInfo], timestamp_us: int) -> None: ... def set_stats( self, /, duration_sec: float, sample_rate: float, error_rate: float | None = None, missed_samples: float | None = None diff --git a/mypy/typeshed/stdlib/_socket.pyi b/mypy/typeshed/stdlib/_socket.pyi index 759fd8265387..40f76715e394 100644 --- a/mypy/typeshed/stdlib/_socket.pyi +++ b/mypy/typeshed/stdlib/_socket.pyi @@ -98,6 +98,8 @@ if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "lin SO_SETFIB: Final[int] if sys.platform == "linux" and sys.version_info >= (3, 13): SO_BINDTOIFINDEX: Final[int] +if sys.platform == "linux" and sys.version_info >= (3, 15): + SO_PASSRIGHTS: Final[int] SOMAXCONN: Final[int] diff --git a/mypy/typeshed/stdlib/builtins.pyi b/mypy/typeshed/stdlib/builtins.pyi index d75600d1a3b8..e5890b5025ef 100644 --- a/mypy/typeshed/stdlib/builtins.pyi +++ b/mypy/typeshed/stdlib/builtins.pyi @@ -78,6 +78,7 @@ _T_contra = TypeVar("_T_contra", contravariant=True) _R_co = TypeVar("_R_co", covariant=True) _KT = TypeVar("_KT") _VT = TypeVar("_VT") +_VT_co = TypeVar("_VT_co", covariant=True) _S = TypeVar("_S") _T1 = TypeVar("_T1") _T2 = TypeVar("_T2") @@ -1252,7 +1253,7 @@ class dict(MutableMapping[_KT, _VT]): if sys.version_info >= (3, 15): @disjoint_base - class frozendict(Mapping[_KT, _VT]): + class frozendict(Mapping[_KT, _VT_co]): @overload def __new__(cls, /) -> frozendict[Any, Any]: ... @overload @@ -1270,7 +1271,7 @@ if sys.version_info >= (3, 15): cls: type[frozendict[str, _VT]], iterable: Iterable[tuple[str, _VT]], /, **kwargs: _VT ) -> frozendict[str, _VT]: ... - def copy(self) -> frozendict[_KT, _VT]: ... + def copy(self) -> frozendict[_KT, _VT_co]: ... @overload @classmethod @@ -1280,27 +1281,27 @@ if sys.version_info >= (3, 15): def fromkeys(cls, iterable: Iterable[_T], value: _S, /) -> frozendict[_T, _S]: ... @overload # type: ignore[override] - def get(self, key: _KT, default: None = None, /) -> _VT | None: ... + def get(self, key: _KT, default: None = None, /) -> _VT_co | None: ... @overload - def get(self, key: _KT, default: _VT, /) -> _VT: ... + def get(self, key: _KT, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter # pyrefly: ignore [invalid-variance] @overload - def get(self, key: _KT, default: _T, /) -> _VT | _T: ... + def get(self, key: _KT, default: _T, /) -> _VT_co | _T: ... - def keys(self) -> dict_keys[_KT, _VT]: ... - def values(self) -> dict_values[_KT, _VT]: ... - def items(self) -> dict_items[_KT, _VT]: ... + def keys(self) -> dict_keys[_KT, _VT_co]: ... + def values(self) -> dict_values[_KT, _VT_co]: ... + def items(self) -> dict_items[_KT, _VT_co]: ... def __len__(self) -> int: ... - def __getitem__(self, key: _KT, /) -> _VT: ... + def __getitem__(self, key: _KT, /) -> _VT_co: ... def __reversed__(self) -> Iterator[_KT]: ... def __iter__(self) -> Iterator[_KT]: ... def __hash__(self) -> int: ... def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... - def __or__(self, value: dict[_T1, _T2] | frozendict[_T1, _T2], /) -> frozendict[_KT | _T1, _VT | _T2]: ... + def __or__(self, value: dict[_T1, _T2] | frozendict[_T1, _T2], /) -> frozendict[_KT | _T1, _VT_co | _T2]: ... @overload - def __ror__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ... + def __ror__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]: ... @overload - def __ror__(self, value: frozendict[_T1, _T2], /) -> frozendict[_KT | _T1, _VT | _T2]: ... + def __ror__(self, value: frozendict[_T1, _T2], /) -> frozendict[_KT | _T1, _VT_co | _T2]: ... @disjoint_base class set(MutableSet[_T]): @@ -1351,10 +1352,10 @@ class set(MutableSet[_T]): @overload def __rsub__(self, value: frozenset[_S], /) -> frozenset[_S]: ... - def __xor__(self, value: AbstractSet[_S], /) -> set[_T | _S]: ... + def __xor__(self, value: set[_S] | frozenset[_S], /) -> set[_T | _S]: ... # type: ignore[override] def __ixor__(self, value: AbstractSet[_T], /) -> Self: ... # type: ignore[override,misc] - @overload + @overload # type: ignore[override] def __rxor__(self, value: set[_S], /) -> set[_T | _S]: ... @overload def __rxor__(self, value: frozenset[_S], /) -> frozenset[_T | _S]: ... @@ -1406,9 +1407,9 @@ class frozenset(AbstractSet[_T_co]): @overload def __rsub__(self, value: frozenset[_S], /) -> frozenset[_S]: ... - def __xor__(self, value: AbstractSet[_S], /) -> frozenset[_T_co | _S]: ... + def __xor__(self, value: set[_S] | frozenset[_S], /) -> frozenset[_T_co | _S]: ... # type: ignore[override] - @overload + @overload # type: ignore[override] def __rxor__(self, value: set[_S], /) -> set[_T_co | _S]: ... @overload def __rxor__(self, value: frozenset[_S], /) -> frozenset[_T_co | _S]: ... diff --git a/mypy/typeshed/stdlib/codecs.pyi b/mypy/typeshed/stdlib/codecs.pyi index ee1ab25bac47..acbf23b5992a 100644 --- a/mypy/typeshed/stdlib/codecs.pyi +++ b/mypy/typeshed/stdlib/codecs.pyi @@ -223,7 +223,7 @@ class Codec: # These are sort of @abstractmethod but sort of not. # The StreamReader and StreamWriter subclasses only implement one. def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder: errors: str diff --git a/mypy/typeshed/stdlib/email/_header_value_parser.pyi b/mypy/typeshed/stdlib/email/_header_value_parser.pyi index 019503cf8538..de974b9c37dd 100644 --- a/mypy/typeshed/stdlib/email/_header_value_parser.pyi +++ b/mypy/typeshed/stdlib/email/_header_value_parser.pyi @@ -47,6 +47,10 @@ class TokenList(list[TokenList | Terminal]): def as_ew_allowed(self) -> bool: ... @property def comments(self) -> list[str]: ... + if sys.version_info >= (3, 11): + # Added in Python 3.11.18, 3.12.16, 3.13.18, 3.14.9 and 3.15.1. + def contains_token_type(self, *token_types: str | None) -> bool: ... + def fold(self, *, policy: Policy) -> str: ... def pprint(self, indent: str = "") -> None: ... def ppstr(self, indent: str = "") -> str: ... @@ -339,6 +343,10 @@ class Terminal(str): def pop_trailing_ws(self) -> None: ... @property def comments(self) -> list[str]: ... + if sys.version_info >= (3, 11): + # Added in Python 3.11.18, 3.12.16, 3.13.18, 3.14.9 and 3.15.1. + def contains_token_type(self, *token_types: str | None) -> bool: ... + def __getnewargs__(self) -> tuple[str, str]: ... # type: ignore[override] class WhiteSpaceTerminal(Terminal): diff --git a/mypy/typeshed/stdlib/email/base64mime.pyi b/mypy/typeshed/stdlib/email/base64mime.pyi index 563cd7f669a2..f19cd92c2f12 100644 --- a/mypy/typeshed/stdlib/email/base64mime.pyi +++ b/mypy/typeshed/stdlib/email/base64mime.pyi @@ -2,11 +2,11 @@ __all__ = ["body_decode", "body_encode", "decode", "decodestring", "header_encod from _typeshed import ReadableBuffer -def header_length(bytearray: str | bytes | bytearray) -> int: ... +def header_length(bytearray: str | bytes | bytearray | memoryview) -> int: ... def header_encode(header_bytes: str | ReadableBuffer, charset: str = "iso-8859-1") -> str: ... # First argument should be a buffer that supports slicing and len(). -def body_encode(s: bytes | bytearray, maxlinelen: int = 76, eol: str = "\n") -> str: ... +def body_encode(s: bytes | bytearray | memoryview, maxlinelen: int = 76, eol: str = "\n") -> str: ... def decode(string: str | ReadableBuffer) -> bytes: ... body_decode = decode diff --git a/mypy/typeshed/stdlib/encodings/cp037.pyi b/mypy/typeshed/stdlib/encodings/cp037.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp037.pyi +++ b/mypy/typeshed/stdlib/encodings/cp037.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1006.pyi b/mypy/typeshed/stdlib/encodings/cp1006.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1006.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1006.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1026.pyi b/mypy/typeshed/stdlib/encodings/cp1026.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1026.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1026.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1125.pyi b/mypy/typeshed/stdlib/encodings/cp1125.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp1125.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1125.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1140.pyi b/mypy/typeshed/stdlib/encodings/cp1140.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1140.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1140.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1250.pyi b/mypy/typeshed/stdlib/encodings/cp1250.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1250.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1250.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1251.pyi b/mypy/typeshed/stdlib/encodings/cp1251.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1251.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1251.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1252.pyi b/mypy/typeshed/stdlib/encodings/cp1252.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1252.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1252.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1253.pyi b/mypy/typeshed/stdlib/encodings/cp1253.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1253.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1253.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1254.pyi b/mypy/typeshed/stdlib/encodings/cp1254.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1254.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1254.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1255.pyi b/mypy/typeshed/stdlib/encodings/cp1255.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1255.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1255.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1256.pyi b/mypy/typeshed/stdlib/encodings/cp1256.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1256.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1256.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1257.pyi b/mypy/typeshed/stdlib/encodings/cp1257.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1257.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1257.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp1258.pyi b/mypy/typeshed/stdlib/encodings/cp1258.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp1258.pyi +++ b/mypy/typeshed/stdlib/encodings/cp1258.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp273.pyi b/mypy/typeshed/stdlib/encodings/cp273.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp273.pyi +++ b/mypy/typeshed/stdlib/encodings/cp273.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp424.pyi b/mypy/typeshed/stdlib/encodings/cp424.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp424.pyi +++ b/mypy/typeshed/stdlib/encodings/cp424.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp437.pyi b/mypy/typeshed/stdlib/encodings/cp437.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp437.pyi +++ b/mypy/typeshed/stdlib/encodings/cp437.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp500.pyi b/mypy/typeshed/stdlib/encodings/cp500.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp500.pyi +++ b/mypy/typeshed/stdlib/encodings/cp500.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp720.pyi b/mypy/typeshed/stdlib/encodings/cp720.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp720.pyi +++ b/mypy/typeshed/stdlib/encodings/cp720.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp737.pyi b/mypy/typeshed/stdlib/encodings/cp737.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp737.pyi +++ b/mypy/typeshed/stdlib/encodings/cp737.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp775.pyi b/mypy/typeshed/stdlib/encodings/cp775.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp775.pyi +++ b/mypy/typeshed/stdlib/encodings/cp775.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp850.pyi b/mypy/typeshed/stdlib/encodings/cp850.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp850.pyi +++ b/mypy/typeshed/stdlib/encodings/cp850.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp852.pyi b/mypy/typeshed/stdlib/encodings/cp852.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp852.pyi +++ b/mypy/typeshed/stdlib/encodings/cp852.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp855.pyi b/mypy/typeshed/stdlib/encodings/cp855.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp855.pyi +++ b/mypy/typeshed/stdlib/encodings/cp855.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp856.pyi b/mypy/typeshed/stdlib/encodings/cp856.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp856.pyi +++ b/mypy/typeshed/stdlib/encodings/cp856.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp857.pyi b/mypy/typeshed/stdlib/encodings/cp857.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp857.pyi +++ b/mypy/typeshed/stdlib/encodings/cp857.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp858.pyi b/mypy/typeshed/stdlib/encodings/cp858.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp858.pyi +++ b/mypy/typeshed/stdlib/encodings/cp858.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp860.pyi b/mypy/typeshed/stdlib/encodings/cp860.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp860.pyi +++ b/mypy/typeshed/stdlib/encodings/cp860.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp861.pyi b/mypy/typeshed/stdlib/encodings/cp861.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp861.pyi +++ b/mypy/typeshed/stdlib/encodings/cp861.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp862.pyi b/mypy/typeshed/stdlib/encodings/cp862.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp862.pyi +++ b/mypy/typeshed/stdlib/encodings/cp862.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp863.pyi b/mypy/typeshed/stdlib/encodings/cp863.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp863.pyi +++ b/mypy/typeshed/stdlib/encodings/cp863.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp864.pyi b/mypy/typeshed/stdlib/encodings/cp864.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp864.pyi +++ b/mypy/typeshed/stdlib/encodings/cp864.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp865.pyi b/mypy/typeshed/stdlib/encodings/cp865.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp865.pyi +++ b/mypy/typeshed/stdlib/encodings/cp865.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp866.pyi b/mypy/typeshed/stdlib/encodings/cp866.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp866.pyi +++ b/mypy/typeshed/stdlib/encodings/cp866.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp869.pyi b/mypy/typeshed/stdlib/encodings/cp869.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/cp869.pyi +++ b/mypy/typeshed/stdlib/encodings/cp869.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp874.pyi b/mypy/typeshed/stdlib/encodings/cp874.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp874.pyi +++ b/mypy/typeshed/stdlib/encodings/cp874.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/cp875.pyi b/mypy/typeshed/stdlib/encodings/cp875.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/cp875.pyi +++ b/mypy/typeshed/stdlib/encodings/cp875.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/hp_roman8.pyi b/mypy/typeshed/stdlib/encodings/hp_roman8.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/hp_roman8.pyi +++ b/mypy/typeshed/stdlib/encodings/hp_roman8.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_1.pyi b/mypy/typeshed/stdlib/encodings/iso8859_1.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_1.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_1.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_10.pyi b/mypy/typeshed/stdlib/encodings/iso8859_10.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_10.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_10.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_11.pyi b/mypy/typeshed/stdlib/encodings/iso8859_11.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_11.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_11.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_13.pyi b/mypy/typeshed/stdlib/encodings/iso8859_13.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_13.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_13.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_14.pyi b/mypy/typeshed/stdlib/encodings/iso8859_14.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_14.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_14.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_15.pyi b/mypy/typeshed/stdlib/encodings/iso8859_15.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_15.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_15.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_16.pyi b/mypy/typeshed/stdlib/encodings/iso8859_16.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_16.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_16.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_2.pyi b/mypy/typeshed/stdlib/encodings/iso8859_2.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_2.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_2.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_3.pyi b/mypy/typeshed/stdlib/encodings/iso8859_3.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_3.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_3.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_4.pyi b/mypy/typeshed/stdlib/encodings/iso8859_4.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_4.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_4.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_5.pyi b/mypy/typeshed/stdlib/encodings/iso8859_5.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_5.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_5.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_6.pyi b/mypy/typeshed/stdlib/encodings/iso8859_6.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_6.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_6.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_7.pyi b/mypy/typeshed/stdlib/encodings/iso8859_7.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_7.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_7.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_8.pyi b/mypy/typeshed/stdlib/encodings/iso8859_8.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_8.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_8.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/iso8859_9.pyi b/mypy/typeshed/stdlib/encodings/iso8859_9.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/iso8859_9.pyi +++ b/mypy/typeshed/stdlib/encodings/iso8859_9.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/koi8_r.pyi b/mypy/typeshed/stdlib/encodings/koi8_r.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/koi8_r.pyi +++ b/mypy/typeshed/stdlib/encodings/koi8_r.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/koi8_t.pyi b/mypy/typeshed/stdlib/encodings/koi8_t.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/koi8_t.pyi +++ b/mypy/typeshed/stdlib/encodings/koi8_t.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/koi8_u.pyi b/mypy/typeshed/stdlib/encodings/koi8_u.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/koi8_u.pyi +++ b/mypy/typeshed/stdlib/encodings/koi8_u.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/kz1048.pyi b/mypy/typeshed/stdlib/encodings/kz1048.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/kz1048.pyi +++ b/mypy/typeshed/stdlib/encodings/kz1048.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/mac_arabic.pyi b/mypy/typeshed/stdlib/encodings/mac_arabic.pyi index 42781b489298..d2aa4e779744 100644 --- a/mypy/typeshed/stdlib/encodings/mac_arabic.pyi +++ b/mypy/typeshed/stdlib/encodings/mac_arabic.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/mac_croatian.pyi b/mypy/typeshed/stdlib/encodings/mac_croatian.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/mac_croatian.pyi +++ b/mypy/typeshed/stdlib/encodings/mac_croatian.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/mac_cyrillic.pyi b/mypy/typeshed/stdlib/encodings/mac_cyrillic.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/mac_cyrillic.pyi +++ b/mypy/typeshed/stdlib/encodings/mac_cyrillic.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/mac_farsi.pyi b/mypy/typeshed/stdlib/encodings/mac_farsi.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/mac_farsi.pyi +++ b/mypy/typeshed/stdlib/encodings/mac_farsi.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/mac_greek.pyi b/mypy/typeshed/stdlib/encodings/mac_greek.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/mac_greek.pyi +++ b/mypy/typeshed/stdlib/encodings/mac_greek.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/mac_iceland.pyi b/mypy/typeshed/stdlib/encodings/mac_iceland.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/mac_iceland.pyi +++ b/mypy/typeshed/stdlib/encodings/mac_iceland.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/mac_latin2.pyi b/mypy/typeshed/stdlib/encodings/mac_latin2.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/mac_latin2.pyi +++ b/mypy/typeshed/stdlib/encodings/mac_latin2.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/mac_roman.pyi b/mypy/typeshed/stdlib/encodings/mac_roman.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/mac_roman.pyi +++ b/mypy/typeshed/stdlib/encodings/mac_roman.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/mac_romanian.pyi b/mypy/typeshed/stdlib/encodings/mac_romanian.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/mac_romanian.pyi +++ b/mypy/typeshed/stdlib/encodings/mac_romanian.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/mac_turkish.pyi b/mypy/typeshed/stdlib/encodings/mac_turkish.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/mac_turkish.pyi +++ b/mypy/typeshed/stdlib/encodings/mac_turkish.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/palmos.pyi b/mypy/typeshed/stdlib/encodings/palmos.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/palmos.pyi +++ b/mypy/typeshed/stdlib/encodings/palmos.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/ptcp154.pyi b/mypy/typeshed/stdlib/encodings/ptcp154.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/ptcp154.pyi +++ b/mypy/typeshed/stdlib/encodings/ptcp154.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/encodings/punycode.pyi b/mypy/typeshed/stdlib/encodings/punycode.pyi index eb99e667b416..7612464f7d56 100644 --- a/mypy/typeshed/stdlib/encodings/punycode.pyi +++ b/mypy/typeshed/stdlib/encodings/punycode.pyi @@ -1,4 +1,5 @@ import codecs +from _typeshed import ReadableBuffer from typing import Literal def segregate(str: str) -> tuple[bytes, list[int]]: ... @@ -19,13 +20,13 @@ def punycode_decode(text: memoryview | bytes | bytearray | str, errors: str) -> class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: memoryview | bytes | bytearray | str, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: str | ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input: memoryview | bytes | bytearray | str, final: bool = False) -> str: ... # type: ignore[override] + def decode(self, input: str | ReadableBuffer, final: bool = False) -> str: ... class StreamWriter(Codec, codecs.StreamWriter): ... class StreamReader(Codec, codecs.StreamReader): ... diff --git a/mypy/typeshed/stdlib/encodings/tis_620.pyi b/mypy/typeshed/stdlib/encodings/tis_620.pyi index f62195662ce9..2924e73c3543 100644 --- a/mypy/typeshed/stdlib/encodings/tis_620.pyi +++ b/mypy/typeshed/stdlib/encodings/tis_620.pyi @@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer class Codec(codecs.Codec): def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... diff --git a/mypy/typeshed/stdlib/functools.pyi b/mypy/typeshed/stdlib/functools.pyi index 23260ab90855..42041befd999 100644 --- a/mypy/typeshed/stdlib/functools.pyi +++ b/mypy/typeshed/stdlib/functools.pyi @@ -46,6 +46,7 @@ _PWrapper = ParamSpec("_PWrapper") _RWrapper = TypeVar("_RWrapper") _WrapperSelfT = TypeVar("_WrapperSelfT") _PBound = ParamSpec("_PBound") +_CacheArgT_contra = TypeVar("_CacheArgT_contra", contravariant=True, default=Hashable) if sys.version_info >= (3, 14): @overload @@ -65,23 +66,27 @@ class _CacheInfo(NamedTuple): @type_check_only class _CacheParameters(TypedDict): - maxsize: int + maxsize: int | None typed: bool @final -class _lru_cache_wrapper(Generic[_T_co]): +class _lru_cache_wrapper(Generic[_T_co, _CacheArgT_contra]): __wrapped__: Callable[..., _T_co] - def __call__(self, *args: Hashable, **kwargs: Hashable) -> _T_co: ... + def __call__(self, /, *args: _CacheArgT_contra, **kwargs: _CacheArgT_contra) -> _T_co: ... def cache_info(self) -> _CacheInfo: ... def cache_clear(self) -> None: ... def cache_parameters(self) -> _CacheParameters: ... - def __copy__(self) -> _lru_cache_wrapper[_T_co]: ... - def __deepcopy__(self, memo: Any, /) -> _lru_cache_wrapper[_T_co]: ... + def __copy__(self) -> Self: ... + def __deepcopy__(self, memo: Any, /) -> Self: ... # as with ``Callable``, we'll assume that these attributes exist __name__: str __qualname__: str +@overload +def lru_cache( + maxsize: Literal[0, False], typed: bool = False +) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T, object]]: ... @overload def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ... @overload diff --git a/mypy/typeshed/stdlib/multiprocessing/context.pyi b/mypy/typeshed/stdlib/multiprocessing/context.pyi index 13fd967515d0..925f364f1826 100644 --- a/mypy/typeshed/stdlib/multiprocessing/context.pyi +++ b/mypy/typeshed/stdlib/multiprocessing/context.pyi @@ -169,7 +169,12 @@ class Process(BaseProcess): class DefaultContext(BaseContext): Process: ClassVar[type[Process]] - def __init__(self, context: BaseContext) -> None: ... + if sys.version_info >= (3, 14): + # The context parameter became optional in Python 3.14.9 and 3.15.1. + def __init__(self, context: BaseContext | None = None) -> None: ... + else: + def __init__(self, context: BaseContext) -> None: ... + def get_start_method(self, allow_none: bool = False) -> str: ... def get_all_start_methods(self) -> list[str]: ... diff --git a/mypy/typeshed/stdlib/multiprocessing/managers.pyi b/mypy/typeshed/stdlib/multiprocessing/managers.pyi index 0f1d4e87b0dc..0727f60f1080 100644 --- a/mypy/typeshed/stdlib/multiprocessing/managers.pyi +++ b/mypy/typeshed/stdlib/multiprocessing/managers.pyi @@ -195,7 +195,7 @@ if sys.version_info >= (3, 14): def __rand__(self, value: AbstractSet[object], /) -> set[_T]: ... def __ror__(self, value: AbstractSet[_S], /) -> set[_T | _S]: ... # type: ignore[misc] def __rsub__(self, value: AbstractSet[_T], /) -> set[_T]: ... - def __rxor__(self, value: AbstractSet[_S], /) -> set[_T | _S]: ... # type: ignore[misc] + def __rxor__(self, value: AbstractSet[_S], /) -> set[_T | _S]: ... # type: ignore[override,misc] def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... class SetProxy(_BaseSetProxy[_T]): ... diff --git a/mypy/typeshed/stdlib/os/__init__.pyi b/mypy/typeshed/stdlib/os/__init__.pyi index 89b9bd866420..008a8d607211 100644 --- a/mypy/typeshed/stdlib/os/__init__.pyi +++ b/mypy/typeshed/stdlib/os/__init__.pyi @@ -234,12 +234,15 @@ if sys.platform == "linux" and sys.version_info >= (3, 15): "AT_STATX_DONT_SYNC", "AT_STATX_FORCE_SYNC", "AT_STATX_SYNC_AS_STAT", + "RWF_ATOMIC", + "RWF_DONTCACHE", "STATX_ATIME", "STATX_BASIC_STATS", "STATX_BLOCKS", "STATX_BTIME", "STATX_CTIME", "STATX_DIOALIGN", + "STATX_DIO_READ_ALIGN", "STATX_GID", "STATX_INO", "STATX_MNT_ID", @@ -248,8 +251,10 @@ if sys.platform == "linux" and sys.version_info >= (3, 15): "STATX_MTIME", "STATX_NLINK", "STATX_SIZE", + "STATX_SUBVOL", "STATX_TYPE", "STATX_UID", + "STATX_WRITE_ATOMIC", "statx", "statx_result", ] @@ -703,12 +708,15 @@ if sys.platform == "linux" and sys.version_info >= (3, 15): AT_STATX_DONT_SYNC: Final[int] AT_STATX_FORCE_SYNC: Final[int] AT_STATX_SYNC_AS_STAT: Final[int] + RWF_ATOMIC: Final[int] + RWF_DONTCACHE: Final[int] STATX_ATIME: Final[int] STATX_BASIC_STATS: Final[int] STATX_BLOCKS: Final[int] STATX_BTIME: Final[int] STATX_CTIME: Final[int] STATX_DIOALIGN: Final[int] + STATX_DIO_READ_ALIGN: Final[int] STATX_GID: Final[int] STATX_INO: Final[int] STATX_MNT_ID: Final[int] @@ -717,8 +725,10 @@ if sys.platform == "linux" and sys.version_info >= (3, 15): STATX_MTIME: Final[int] STATX_NLINK: Final[int] STATX_SIZE: Final[int] + STATX_SUBVOL: Final[int] STATX_TYPE: Final[int] STATX_UID: Final[int] + STATX_WRITE_ATOMIC: Final[int] if sys.platform != "win32": O_FSYNC: Final[int] @@ -1408,6 +1418,18 @@ if sys.platform == "linux" and sys.version_info >= (3, 15): def stx_dio_mem_align(self) -> int | None: ... @property def stx_dio_offset_align(self) -> int | None: ... + @property + def stx_subvol(self) -> int | None: ... + @property + def stx_atomic_write_unit_min(self) -> int | None: ... + @property + def stx_atomic_write_unit_max(self) -> int | None: ... + @property + def stx_atomic_write_segments_max(self) -> int | None: ... + @property + def stx_dio_read_offset_align(self) -> int | None: ... + @property + def stx_atomic_write_unit_max_opt(self) -> int | None: ... def statx( path: FileDescriptorOrPath, mask: int, *, flags: int = 0, dir_fd: int | None = None, follow_symlinks: bool = True diff --git a/mypy/typeshed/stdlib/posix.pyi b/mypy/typeshed/stdlib/posix.pyi index 36bb5be18e88..c8bbc098b0b0 100644 --- a/mypy/typeshed/stdlib/posix.pyi +++ b/mypy/typeshed/stdlib/posix.pyi @@ -272,11 +272,14 @@ if sys.platform != "win32": AT_STATX_DONT_SYNC as AT_STATX_DONT_SYNC, AT_STATX_FORCE_SYNC as AT_STATX_FORCE_SYNC, AT_STATX_SYNC_AS_STAT as AT_STATX_SYNC_AS_STAT, + RWF_ATOMIC as RWF_ATOMIC, + RWF_DONTCACHE as RWF_DONTCACHE, STATX_ATIME as STATX_ATIME, STATX_BASIC_STATS as STATX_BASIC_STATS, STATX_BLOCKS as STATX_BLOCKS, STATX_BTIME as STATX_BTIME, STATX_CTIME as STATX_CTIME, + STATX_DIO_READ_ALIGN as STATX_DIO_READ_ALIGN, STATX_DIOALIGN as STATX_DIOALIGN, STATX_GID as STATX_GID, STATX_INO as STATX_INO, @@ -286,8 +289,10 @@ if sys.platform != "win32": STATX_MTIME as STATX_MTIME, STATX_NLINK as STATX_NLINK, STATX_SIZE as STATX_SIZE, + STATX_SUBVOL as STATX_SUBVOL, STATX_TYPE as STATX_TYPE, STATX_UID as STATX_UID, + STATX_WRITE_ATOMIC as STATX_WRITE_ATOMIC, _clearenv as _clearenv, statx as statx, statx_result as statx_result, diff --git a/mypy/typeshed/stdlib/re.pyi b/mypy/typeshed/stdlib/re.pyi index f0a892c797e9..42eb751498c0 100644 --- a/mypy/typeshed/stdlib/re.pyi +++ b/mypy/typeshed/stdlib/re.pyi @@ -339,7 +339,11 @@ def subn( flags: _FlagsType = 0, ) -> tuple[bytes, int]: ... +@overload def escape(pattern: AnyStr) -> AnyStr: ... +@overload +def escape(pattern: ReadableBuffer) -> bytes: ... + def purge() -> None: ... if sys.version_info < (3, 13): diff --git a/mypy/typeshed/stdlib/socket.pyi b/mypy/typeshed/stdlib/socket.pyi index 4731aeab82c1..948092d3ce18 100644 --- a/mypy/typeshed/stdlib/socket.pyi +++ b/mypy/typeshed/stdlib/socket.pyi @@ -136,7 +136,7 @@ from _socket import ( from _typeshed import ReadableBuffer, Unused, WriteableBuffer from collections.abc import Iterable from enum import IntEnum, IntFlag -from io import BufferedReader, BufferedRWPair, BufferedWriter, IOBase, RawIOBase, TextIOWrapper +from io import BufferedReader, BufferedRWPair, BufferedWriter, RawIOBase, TextIOWrapper from typing import Any, Final, Literal, Protocol, SupportsIndex, TypeAlias, overload, type_check_only from typing_extensions import Self @@ -961,6 +961,11 @@ if sys.platform == "linux" and sys.version_info >= (3, 13): __all__ += ["NI_IDN", "SO_BINDTOIFINDEX"] +if sys.platform == "linux" and sys.version_info >= (3, 15): + from _socket import SO_PASSRIGHTS as SO_PASSRIGHTS + + __all__ += ["SO_PASSRIGHTS"] + if sys.version_info >= (3, 12): from _socket import ( IP_ADD_SOURCE_MEMBERSHIP as IP_ADD_SOURCE_MEMBERSHIP, @@ -1507,7 +1512,7 @@ class socket(_socket.socket): encoding: str | None = None, errors: str | None = None, newline: str | None = None, - ) -> IOBase: ... + ) -> SocketIO | BufferedRWPair | BufferedReader | BufferedWriter: ... @overload def makefile( self, diff --git a/mypy/typeshed/stdlib/tkinter/filedialog.pyi b/mypy/typeshed/stdlib/tkinter/filedialog.pyi index b6ef8f45d035..b1e4b27edb83 100644 --- a/mypy/typeshed/stdlib/tkinter/filedialog.pyi +++ b/mypy/typeshed/stdlib/tkinter/filedialog.pyi @@ -80,36 +80,40 @@ def asksaveasfilename( *, confirmoverwrite: bool | None = True, defaultextension: str | None = "", - filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., - initialdir: StrOrBytesPath | None = ..., - initialfile: StrOrBytesPath | None = ..., - parent: Misc | None = ..., - title: str | None = ..., - typevariable: StringVar | str | None = ..., -) -> str: ... # can be empty string + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, +) -> str | tuple[()]: ... # empty string or empty tuple if cancelled, depending on the Tk version def askopenfilename( *, defaultextension: str | None = "", - filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., - initialdir: StrOrBytesPath | None = ..., - initialfile: StrOrBytesPath | None = ..., - parent: Misc | None = ..., - title: str | None = ..., - typevariable: StringVar | str | None = ..., -) -> str: ... # can be empty string + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, +) -> str | tuple[()]: ... # empty string or empty tuple if cancelled, depending on the Tk version def askopenfilenames( *, defaultextension: str | None = "", - filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., - initialdir: StrOrBytesPath | None = ..., - initialfile: StrOrBytesPath | None = ..., - parent: Misc | None = ..., - title: str | None = ..., - typevariable: StringVar | str | None = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, ) -> Literal[""] | tuple[str, ...]: ... def askdirectory( - *, initialdir: StrOrBytesPath | None = ..., mustexist: bool | None = False, parent: Misc | None = ..., title: str | None = ... -) -> str: ... # can be empty string + *, + initialdir: StrOrBytesPath | None = None, + mustexist: bool | None = False, + parent: Misc | None = None, + title: str | None = None, +) -> str | tuple[()]: ... # empty string or empty tuple if cancelled, depending on the Tk version # TODO: If someone actually uses these, overload to have the actual return type of open(..., mode) def asksaveasfile( @@ -117,33 +121,33 @@ def asksaveasfile( *, confirmoverwrite: bool | None = True, defaultextension: str | None = "", - filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., - initialdir: StrOrBytesPath | None = ..., - initialfile: StrOrBytesPath | None = ..., - parent: Misc | None = ..., - title: str | None = ..., - typevariable: StringVar | str | None = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, ) -> IO[Incomplete] | None: ... def askopenfile( mode: str = "r", *, defaultextension: str | None = "", - filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., - initialdir: StrOrBytesPath | None = ..., - initialfile: StrOrBytesPath | None = ..., - parent: Misc | None = ..., - title: str | None = ..., - typevariable: StringVar | str | None = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, ) -> IO[Incomplete] | None: ... def askopenfiles( mode: str = "r", *, defaultextension: str | None = "", - filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., - initialdir: StrOrBytesPath | None = ..., - initialfile: StrOrBytesPath | None = ..., - parent: Misc | None = ..., - title: str | None = ..., - typevariable: StringVar | str | None = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, ) -> tuple[IO[Incomplete], ...]: ... # can be empty tuple def test() -> None: ... diff --git a/mypy/typeshed/stdlib/tkinter/ttk.pyi b/mypy/typeshed/stdlib/tkinter/ttk.pyi index bf184bc2e8f8..bb517d39e4e6 100644 --- a/mypy/typeshed/stdlib/tkinter/ttk.pyi +++ b/mypy/typeshed/stdlib/tkinter/ttk.pyi @@ -804,8 +804,12 @@ class Progressbar(Widget): self, master: tkinter.Misc | None = None, *, + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., # new in Tcl/Tk 9.0 class_: str = "", cursor: tkinter._Cursor = "", + font: _FontDescription = ..., # new in Tcl/Tk 9.0 + foreground: str = ..., # new in Tcl/Tk 9.0 + justify: Literal["left", "center", "right"] = ..., # new in Tcl/Tk 9.0 length: float | str = 100, maximum: float = 100, mode: Literal["determinate", "indeterminate"] = "determinate", @@ -814,8 +818,10 @@ class Progressbar(Widget): phase: int = 0, # docs say read-only but assigning int to this works style: str = "", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", + text: float | str = "", # new in Tcl/Tk 9.0 value: float = 0.0, variable: tkinter.IntVar | tkinter.DoubleVar = ..., + wraplength: float | str = ..., # new in Tcl/Tk 9.0 ) -> None: ... @overload @@ -823,7 +829,11 @@ class Progressbar(Widget): self, cnf: dict[str, Any] | None = None, *, + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., # new in Tcl/Tk 9.0 cursor: tkinter._Cursor = ..., + font: _FontDescription = ..., # new in Tcl/Tk 9.0 + foreground: str = ..., # new in Tcl/Tk 9.0 + justify: Literal["left", "center", "right"] = ..., # new in Tcl/Tk 9.0 length: float | str = ..., maximum: float = ..., mode: Literal["determinate", "indeterminate"] = ..., @@ -831,8 +841,10 @@ class Progressbar(Widget): phase: int = ..., style: str = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., + text: float | str = ..., # new in Tcl/Tk 9.0 value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., + wraplength: float | str = ..., # new in Tcl/Tk 9.0 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1414,7 +1426,7 @@ class OptionMenu(Menubutton): # rest of these are keyword-only because *args syntax used above style: str = "", direction: Literal["above", "below", "left", "right", "flush"] = "below", - command: Callable[[tkinter.StringVar], object] | None = None, + command: Callable[[str], object] | None = None, name: str | None = None, ) -> None: ... else: @@ -1427,7 +1439,7 @@ class OptionMenu(Menubutton): # rest of these are keyword-only because *args syntax used above style: str = "", direction: Literal["above", "below", "left", "right", "flush"] = "below", - command: Callable[[tkinter.StringVar], object] | None = None, + command: Callable[[str], object] | None = None, ) -> None: ... # configure, config, cget, destroy are inherited from Menubutton # destroy and __setitem__ are overridden, signature does not change diff --git a/mypy/typeshed/stdlib/typing.pyi b/mypy/typeshed/stdlib/typing.pyi index 10561b3271c5..0ea21c5dd7f1 100644 --- a/mypy/typeshed/stdlib/typing.pyi +++ b/mypy/typeshed/stdlib/typing.pyi @@ -741,6 +741,7 @@ class AbstractSet(Collection[_T_co]): def __or__(self, other: AbstractSet[_T], /) -> AbstractSet[_T_co | _T]: ... def __sub__(self, other: AbstractSet[Any], /) -> AbstractSet[_T_co]: ... def __xor__(self, other: AbstractSet[_T], /) -> AbstractSet[_T_co | _T]: ... + def __rxor__(self, other: Iterable[_T], /) -> AbstractSet[_T_co | _T]: ... def __eq__(self, other: object, /) -> bool: ... def isdisjoint(self, other: Iterable[Any], /) -> bool: ...