mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Add definition for RawConfigParser._get_conv (#1542)
This allows subclasses that define get* methods to wrap _get_conv whilst still typechecking correctly.
This commit is contained in:
committed by
Łukasz Langa
parent
4ea6c1cffb
commit
6f848e8ed8
@@ -3,7 +3,8 @@
|
||||
|
||||
import sys
|
||||
from typing import (MutableMapping, Mapping, Dict, Sequence, List, Union,
|
||||
Iterable, Iterator, Callable, Any, IO, Optional, Pattern)
|
||||
Iterable, Iterator, Callable, Any, IO, overload, Optional,
|
||||
Pattern, TypeVar)
|
||||
# Types only used in type comments only
|
||||
from typing import Optional, Tuple # noqa
|
||||
|
||||
@@ -15,6 +16,7 @@ _section = Mapping[str, str]
|
||||
_parser = MutableMapping[str, _section]
|
||||
_converter = Callable[[str], Any]
|
||||
_converters = Dict[str, _converter]
|
||||
_T = TypeVar('_T')
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[str, PathLike[str]]
|
||||
@@ -104,6 +106,8 @@ class RawConfigParser(_parser):
|
||||
|
||||
def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: _section = ..., fallback: bool = ...) -> bool: ...
|
||||
|
||||
def _get_conv(self, section: str, option: str, conv: Callable[[str], _T], *, raw: bool = ..., vars: _section = ..., fallback: _T = ...) -> _T: ...
|
||||
|
||||
# This is incompatible with MutableMapping so we ignore the type
|
||||
def get(self, section: str, option: str, *, raw: bool = ..., vars: _section = ..., fallback: str = ...) -> str: # type: ignore
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user