stdlib: add argument default values (#9501)

This commit is contained in:
Jelle Zijlstra
2023-01-18 00:37:34 -08:00
committed by GitHub
parent 6cb934291f
commit ddfaca3200
272 changed files with 2529 additions and 2467 deletions

View File

@@ -106,11 +106,11 @@ class RawConfigParser(_Parser):
def has_section(self, section: str) -> bool: ...
def options(self, section: str) -> list[str]: ...
def has_option(self, section: str, option: str) -> bool: ...
def read(self, filenames: StrOrBytesPath | Iterable[StrOrBytesPath], encoding: str | None = ...) -> list[str]: ...
def read_file(self, f: Iterable[str], source: str | None = ...) -> None: ...
def read_string(self, string: str, source: str = ...) -> None: ...
def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = ...) -> None: ...
def readfp(self, fp: Iterable[str], filename: str | None = ...) -> None: ...
def read(self, filenames: StrOrBytesPath | Iterable[StrOrBytesPath], encoding: str | None = None) -> list[str]: ...
def read_file(self, f: Iterable[str], source: str | None = None) -> None: ...
def read_string(self, string: str, source: str = "<string>") -> None: ...
def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = "<dict>") -> None: ...
def readfp(self, fp: Iterable[str], filename: str | None = None) -> None: ...
# These get* methods are partially applied (with the same names) in
# SectionProxy; the stubs should be kept updated together
@overload
@@ -137,8 +137,8 @@ class RawConfigParser(_Parser):
option: str,
conv: Callable[[str], _T],
*,
raw: bool = ...,
vars: _Section | None = ...,
raw: bool = False,
vars: _Section | None = None,
fallback: _T = ...,
) -> _T: ...
# This is incompatible with MutableMapping so we ignore the type
@@ -150,8 +150,8 @@ class RawConfigParser(_Parser):
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 set(self, section: str, option: str, value: str | None = ...) -> None: ...
def write(self, fp: SupportsWrite[str], space_around_delimiters: bool = ...) -> None: ...
def set(self, section: str, option: str, value: str | None = None) -> None: ...
def write(self, fp: SupportsWrite[str], space_around_delimiters: bool = True) -> None: ...
def remove_option(self, section: str, option: str) -> bool: ...
def remove_section(self, section: str) -> bool: ...
def optionxform(self, optionstr: str) -> str: ...
@@ -181,11 +181,11 @@ class SectionProxy(MutableMapping[str, str]):
def get( # type: ignore[override]
self,
option: str,
fallback: str | None = ...,
fallback: str | None = None,
*,
raw: bool = ...,
vars: _Section | None = ...,
_impl: Any | None = ...,
raw: bool = False,
vars: _Section | None = None,
_impl: Any | None = None,
**kwargs: Any,
) -> str | Any: ... # can be None in RawConfigParser's sections
# These are partially-applied version of the methods with the same names in
@@ -216,7 +216,7 @@ class ConverterMapping(MutableMapping[str, _ConverterCallback | None]):
class Error(Exception):
message: str
def __init__(self, msg: str = ...) -> None: ...
def __init__(self, msg: str = "") -> None: ...
class NoSectionError(Error):
section: str
@@ -226,14 +226,14 @@ class DuplicateSectionError(Error):
section: str
source: str | None
lineno: int | None
def __init__(self, section: str, source: str | None = ..., lineno: int | None = ...) -> None: ...
def __init__(self, section: str, source: str | None = None, lineno: int | None = None) -> None: ...
class DuplicateOptionError(Error):
section: str
option: str
source: str | None
lineno: int | None
def __init__(self, section: str, option: str, source: str | None = ..., lineno: int | None = ...) -> None: ...
def __init__(self, section: str, option: str, source: str | None = None, lineno: int | None = None) -> None: ...
class NoOptionError(Error):
section: str
@@ -257,7 +257,7 @@ class InterpolationSyntaxError(InterpolationError): ...
class ParsingError(Error):
source: str
errors: list[tuple[int, str]]
def __init__(self, source: str | None = ..., filename: str | None = ...) -> None: ...
def __init__(self, source: str | None = None, filename: str | None = None) -> None: ...
def append(self, lineno: int, line: str) -> None: ...
class MissingSectionHeaderError(ParsingError):