aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/iniconfig/iniconfig/__init__.pyi
blob: b6284bec3f65439b5020702cf09fac412d1e4917 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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]: ...