mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Make the signature of ConfigParser.get() polymorphic (#2406)
The documentation [explicitly specifies](https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.get) that `None` is a legitimate `fallback` value. Thanks to @wiml for suggesting this approach.
This commit is contained in:
committed by
Jelle Zijlstra
parent
e67961e387
commit
e7d7a44411
@@ -111,8 +111,11 @@ class RawConfigParser(_parser):
|
||||
def _get_conv(self, section: str, option: str, conv: Callable[[str], _T], *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> _T: ...
|
||||
|
||||
# This is incompatible with MutableMapping so we ignore the type
|
||||
def get(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: str = ...) -> str: # type: ignore
|
||||
...
|
||||
@overload # type: ignore
|
||||
def get(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> str: ...
|
||||
|
||||
@overload # type: ignore
|
||||
def get(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T) -> Union[str, _T]: ...
|
||||
|
||||
@overload
|
||||
def items(self, *, raw: bool = ..., vars: Optional[_section] = ...) -> AbstractSet[Tuple[str, SectionProxy]]: ...
|
||||
|
||||
Reference in New Issue
Block a user