Skip to content

Commit 363f5dd

Browse files
author
Daniel Watkins
committed
Replicate RawConfigParser.get* methods in SectionProxy
These methods are partially applied (with the section that is being proxied in SectionProxy) at runtime, so will always be present. Fixes python#1543.
1 parent 24a7bfb commit 363f5dd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

stdlib/3/configparser.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ class RawConfigParser(_parser):
100100
def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]],
101101
source: str = ...) -> None: ...
102102

103+
# These get* methods are partially applied (with the same names) in
104+
# SectionProxy; the stubs should be kept updated together
103105
def getint(self, section: str, option: str, *, raw: bool = ..., vars: _section = ..., fallback: int = ...) -> int: ...
104106

105107
def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: _section = ..., fallback: float = ...) -> float: ...
@@ -160,6 +162,13 @@ class SectionProxy(MutableMapping[str, str]):
160162
@property
161163
def name(self) -> str: ...
162164
def get(self, option: str, fallback: Optional[str] = ..., *, raw: bool = ..., vars: Optional[_section] = ..., **kwargs: Any) -> str: ... # type: ignore
165+
166+
# These are partially-applied version of the methods with the same names in
167+
# RawConfigParser; the stubs should be kept updated together
168+
def getint(self, option: str, *, raw: bool = ..., vars: _section = ..., fallback: int = ...) -> int: ...
169+
def getfloat(self, option: str, *, raw: bool = ..., vars: _section = ..., fallback: float = ...) -> float: ...
170+
def getboolean(self, option: str, *, raw: bool = ..., vars: _section = ..., fallback: bool = ...) -> bool: ...
171+
163172
# SectionProxy can have arbitrary attributes when custon converters are used
164173
def __getattr__(self, key: str) -> Callable[..., Any]: ...
165174

0 commit comments

Comments
 (0)