iniconfig.pyi 1.2 KB

12345678910111213141516171819202122232425262728293031
  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]: ...