You can not 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.2KB

  1. from typing import Callable, Iterator, Mapping, Optional, Tuple, TypeVar, Union
  2. from typing_extensions import Final
  3. _D = TypeVar('_D')
  4. _T = TypeVar('_T')
  5. class ParseError(Exception):
  6. # Private __init__.
  7. path: Final[str]
  8. lineno: Final[int]
  9. msg: Final[str]
  10. class SectionWrapper:
  11. # Private __init__.
  12. config: Final[IniConfig]
  13. name: Final[str]
  14. def __getitem__(self, key: str) -> str: ...
  15. def __iter__(self) -> Iterator[str]: ...
  16. def get(self, key: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
  17. def items(self) -> Iterator[Tuple[str, str]]: ...
  18. def lineof(self, name: str) -> Optional[int]: ...
  19. class IniConfig:
  20. path: Final[str]
  21. sections: Final[Mapping[str, Mapping[str, str]]]
  22. def __init__(self, path: str, data: Optional[str] = None): ...
  23. def __contains__(self, arg: str) -> bool: ...
  24. def __getitem__(self, name: str) -> SectionWrapper: ...
  25. def __iter__(self) -> Iterator[SectionWrapper]: ...
  26. def get(self, section: str, name: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
  27. def lineof(self, section: str, name: Optional[str] = ...) -> Optional[int]: ...