diff --git a/stdlib/configparser.pyi b/stdlib/configparser.pyi index 0a9223481..c278b82a6 100644 --- a/stdlib/configparser.pyi +++ b/stdlib/configparser.pyi @@ -1,23 +1,7 @@ import sys from _typeshed import StrOrBytesPath, StrPath, SupportsWrite -from typing import ( - AbstractSet, - Any, - Callable, - ClassVar, - Dict, - Iterable, - Iterator, - Mapping, - MutableMapping, - Optional, - Pattern, - Sequence, - Tuple, - Type, - TypeVar, - overload, -) +from collections.abc import Callable, ItemsView, Iterable, Iterator, Mapping, MutableMapping, Sequence +from typing import Any, ClassVar, Dict, Optional, Pattern, Tuple, Type, TypeVar, overload from typing_extensions import Literal # Internal type aliases @@ -143,9 +127,9 @@ class RawConfigParser(_parser): @overload def get(self, section: str, option: str, *, raw: bool = ..., vars: _section | None = ..., fallback: _T) -> str | _T: ... @overload - def items(self, *, raw: bool = ..., vars: _section | None = ...) -> AbstractSet[Tuple[str, SectionProxy]]: ... + def items(self, *, raw: bool = ..., vars: _section | None = ...) -> ItemsView[str, SectionProxy]: ... @overload - def items(self, section: str, raw: bool = ..., vars: _section | None = ...) -> list[Tuple[str, str]]: ... + def items(self, section: str, raw: bool = ..., vars: _section | None = ...) -> list[tuple[str, str]]: ... def set(self, section: str, option: str, value: str | None = ...) -> None: ... def write(self, fp: SupportsWrite[str], space_around_delimiters: bool = ...) -> None: ... def remove_option(self, section: str, option: str) -> bool: ... diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index c476899b8..d98d43708 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -435,7 +435,7 @@ class AsyncContextManager(Protocol[_T_co]): class Mapping(_Collection[_KT], Generic[_KT, _VT_co]): # TODO: We wish the key type could also be covariant, but that doesn't work, - # see discussion in https: //github.com/python/typing/pull/273. + # see discussion in https://github.com/python/typing/pull/273. @abstractmethod def __getitem__(self, k: _KT) -> _VT_co: ... # Mixin methods @@ -443,8 +443,8 @@ class Mapping(_Collection[_KT], Generic[_KT, _VT_co]): def get(self, key: _KT) -> _VT_co | None: ... @overload def get(self, key: _KT, default: _VT_co | _T) -> _VT_co | _T: ... - def items(self) -> AbstractSet[Tuple[_KT, _VT_co]]: ... - def keys(self) -> AbstractSet[_KT]: ... + def items(self) -> ItemsView[_KT, _VT_co]: ... + def keys(self) -> KeysView[_KT]: ... def values(self) -> ValuesView[_VT_co]: ... def __contains__(self, o: object) -> bool: ...