Return ItemsView/KeysView from Mapping methods (#6014)

* Return ItemsView/KeysView from Mapping methods

* Make RawConfigParser compatible with Mapping
This commit is contained in:
Sebastian Rittau
2021-09-09 16:37:26 +02:00
committed by GitHub
parent b9e1d7d522
commit 2f3964e24b
2 changed files with 7 additions and 23 deletions

View File

@@ -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: ...