Replicate RawConfigParser.get* methods in SectionProxy (#1568)

These methods are partially applied (with the section that is being
proxied in SectionProxy) at runtime, so will always be present.

Fixes #1543.
This commit is contained in:
Daniel Watkins
2017-08-21 18:00:16 -04:00
committed by Łukasz Langa
parent 24a7bfb4bf
commit e8ece8ccce

View File

@@ -100,6 +100,8 @@ class RawConfigParser(_parser):
def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]],
source: str = ...) -> None: ...
# 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: _section = ..., fallback: int = ...) -> int: ...
def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: _section = ..., fallback: float = ...) -> float: ...
@@ -160,6 +162,13 @@ class SectionProxy(MutableMapping[str, str]):
@property
def name(self) -> str: ...
def get(self, option: str, fallback: Optional[str] = ..., *, raw: bool = ..., vars: Optional[_section] = ..., **kwargs: Any) -> str: ... # type: ignore
# These are partially-applied version of the methods with the same names in
# RawConfigParser; the stubs should be kept updated together
def getint(self, option: str, *, raw: bool = ..., vars: _section = ..., fallback: int = ...) -> int: ...
def getfloat(self, option: str, *, raw: bool = ..., vars: _section = ..., fallback: float = ...) -> float: ...
def getboolean(self, option: str, *, raw: bool = ..., vars: _section = ..., fallback: bool = ...) -> bool: ...
# SectionProxy can have arbitrary attributes when custon converters are used
def __getattr__(self, key: str) -> Callable[..., Any]: ...