make stubs for configparser.getint()/float/bool accept a generically-typed fallback (#3684)

Closes #3681
This commit is contained in:
Brian Maissy
2020-01-29 15:43:46 +02:00
committed by GitHub
parent 95cafc0b7c
commit e5999ac76b

View File

@@ -104,11 +104,19 @@ class RawConfigParser(_parser):
# These get* methods are partially applied (with the same names) in
# SectionProxy; the stubs should be kept updated together
def getint(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: int = ...) -> int: ...
def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: float = ...) -> float: ...
def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: bool = ...) -> bool: ...
@overload
def getint(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> int: ...
@overload
def getint(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> Union[int, _T]: ...
@overload
def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> float: ...
@overload
def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> Union[float, _T]: ...
@overload
def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> bool: ...
@overload
def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> Union[bool, _T]: ...
def _get_conv(self, section: str, option: str, conv: Callable[[str], _T], *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> _T: ...