You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
2 years ago
|
from typing import Callable, Iterator, Mapping, Optional, Tuple, TypeVar, Union
|
||
|
from typing_extensions import Final
|
||
|
|
||
|
_D = TypeVar('_D')
|
||
|
_T = TypeVar('_T')
|
||
|
|
||
|
class ParseError(Exception):
|
||
|
# Private __init__.
|
||
|
path: Final[str]
|
||
|
lineno: Final[int]
|
||
|
msg: Final[str]
|
||
|
|
||
|
class SectionWrapper:
|
||
|
# Private __init__.
|
||
|
config: Final[IniConfig]
|
||
|
name: Final[str]
|
||
|
def __getitem__(self, key: str) -> str: ...
|
||
|
def __iter__(self) -> Iterator[str]: ...
|
||
|
def get(self, key: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
|
||
|
def items(self) -> Iterator[Tuple[str, str]]: ...
|
||
|
def lineof(self, name: str) -> Optional[int]: ...
|
||
|
|
||
|
class IniConfig:
|
||
|
path: Final[str]
|
||
|
sections: Final[Mapping[str, Mapping[str, str]]]
|
||
|
def __init__(self, path: str, data: Optional[str] = None): ...
|
||
|
def __contains__(self, arg: str) -> bool: ...
|
||
|
def __getitem__(self, name: str) -> SectionWrapper: ...
|
||
|
def __iter__(self) -> Iterator[SectionWrapper]: ...
|
||
|
def get(self, section: str, name: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
|
||
|
def lineof(self, section: str, name: Optional[str] = ...) -> Optional[int]: ...
|