massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 3 / configparser.pyi
1 # Based on http://docs.python.org/3.5/library/configparser.html and on\r
2 # reading configparser.py.\r
3 \r
4 import sys\r
5 from typing import (AbstractSet, MutableMapping, Mapping, Dict, Sequence, List,\r
6                     Union, Iterable, Iterator, Callable, Any, IO, overload,\r
7                     Optional, Pattern, Type, TypeVar)\r
8 # Types only used in type comments only\r
9 from typing import Optional, Tuple  # noqa\r
10 \r
11 if sys.version_info >= (3, 6):\r
12     from os import PathLike\r
13 \r
14 # Internal type aliases\r
15 _section = Mapping[str, str]\r
16 _parser = MutableMapping[str, _section]\r
17 _converter = Callable[[str], Any]\r
18 _converters = Dict[str, _converter]\r
19 _T = TypeVar('_T')\r
20 \r
21 if sys.version_info >= (3, 6):\r
22     _Path = Union[str, PathLike[str]]\r
23 else:\r
24     _Path = str\r
25 \r
26 DEFAULTSECT: str\r
27 MAX_INTERPOLATION_DEPTH: int\r
28 \r
29 class Interpolation:\r
30     def before_get(self, parser: _parser,\r
31                    section: str,\r
32                    option: str,\r
33                    value: str,\r
34                    defaults: _section) -> str: ...\r
35 \r
36     def before_set(self, parser: _parser,\r
37                    section: str,\r
38                    option: str,\r
39                    value: str) -> str: ...\r
40 \r
41     def before_read(self, parser: _parser,\r
42                     section: str,\r
43                     option: str,\r
44                     value: str) -> str: ...\r
45 \r
46     def before_write(self, parser: _parser,\r
47                      section: str,\r
48                      option: str,\r
49                      value: str) -> str: ...\r
50 \r
51 \r
52 class BasicInterpolation(Interpolation): ...\r
53 class ExtendedInterpolation(Interpolation): ...\r
54 class LegacyInterpolation(Interpolation): ...\r
55 \r
56 \r
57 class RawConfigParser(_parser):\r
58     def __init__(self,\r
59                  defaults: Optional[_section] = ...,\r
60                  dict_type: Type[Mapping[str, str]] = ...,\r
61                  allow_no_value: bool = ...,\r
62                  *,\r
63                  delimiters: Sequence[str] = ...,\r
64                  comment_prefixes: Sequence[str] = ...,\r
65                  inline_comment_prefixes: Optional[Sequence[str]] = ...,\r
66                  strict: bool = ...,\r
67                  empty_lines_in_values: bool = ...,\r
68                  default_section: str = ...,\r
69                  interpolation: Optional[Interpolation] = ...) -> None: ...\r
70 \r
71     def __len__(self) -> int: ...\r
72 \r
73     def __getitem__(self, section: str) -> SectionProxy: ...\r
74 \r
75     def __setitem__(self, section: str, options: _section) -> None: ...\r
76 \r
77     def __delitem__(self, section: str) -> None: ...\r
78 \r
79     def __iter__(self) -> Iterator[str]: ...\r
80 \r
81     def defaults(self) -> _section: ...\r
82 \r
83     def sections(self) -> List[str]: ...\r
84 \r
85     def add_section(self, section: str) -> None: ...\r
86 \r
87     def has_section(self, section: str) -> bool: ...\r
88 \r
89     def options(self, section: str) -> List[str]: ...\r
90 \r
91     def has_option(self, section: str, option: str) -> bool: ...\r
92 \r
93     def read(self, filenames: Union[_Path, Iterable[_Path]],\r
94              encoding: Optional[str] = ...) -> List[str]: ...\r
95 \r
96     def readfp(self, fp: IO[str], filename: Optional[str] = ...) -> None: ...\r
97 \r
98     def read_file(self, f: Iterable[str], source: Optional[str] = ...) -> None: ...\r
99 \r
100     def read_string(self, string: str, source: str = ...) -> None: ...\r
101 \r
102     def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]],\r
103                   source: str = ...) -> None: ...\r
104 \r
105     # These get* methods are partially applied (with the same names) in\r
106     # SectionProxy; the stubs should be kept updated together\r
107     def getint(self, section: str, option: str, *, raw: bool = ..., vars: _section = ..., fallback: int = ...) -> int: ...\r
108 \r
109     def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: _section = ..., fallback: float = ...) -> float: ...\r
110 \r
111     def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: _section = ..., fallback: bool = ...) -> bool: ...\r
112 \r
113     def _get_conv(self, section: str, option: str, conv: Callable[[str], _T], *, raw: bool = ..., vars: _section = ..., fallback: _T = ...) -> _T: ...\r
114 \r
115     # This is incompatible with MutableMapping so we ignore the type\r
116     def get(self, section: str, option: str, *, raw: bool = ..., vars: _section = ..., fallback: str = ...) -> str:  # type: ignore\r
117         ...\r
118 \r
119     @overload\r
120     def items(self, *, raw: bool = ..., vars: _section = ...) -> AbstractSet[Tuple[str, SectionProxy]]: ...\r
121 \r
122     @overload\r
123     def items(self, section: str, raw: bool = ..., vars: _section = ...) -> List[Tuple[str, str]]: ...\r
124 \r
125     def set(self, section: str, option: str, value: str) -> None: ...\r
126 \r
127     def write(self,\r
128               fileobject: IO[str],\r
129               space_around_delimiters: bool = ...) -> None: ...\r
130 \r
131     def remove_option(self, section: str, option: str) -> bool: ...\r
132 \r
133     def remove_section(self, section: str) -> bool: ...\r
134 \r
135     def optionxform(self, option: str) -> str: ...\r
136 \r
137 \r
138 class ConfigParser(RawConfigParser):\r
139     def __init__(self,\r
140                  defaults: Optional[_section] = ...,\r
141                  dict_type: Mapping[str, str] = ...,\r
142                  allow_no_value: bool = ...,\r
143                  delimiters: Sequence[str] = ...,\r
144                  comment_prefixes: Sequence[str] = ...,\r
145                  inline_comment_prefixes: Optional[Sequence[str]] = ...,\r
146                  strict: bool = ...,\r
147                  empty_lines_in_values: bool = ...,\r
148                  default_section: str = ...,\r
149                  interpolation: Optional[Interpolation] = ...,\r
150                  converters: _converters = ...) -> None: ...\r
151 \r
152 class SafeConfigParser(ConfigParser): ...\r
153 \r
154 class SectionProxy(MutableMapping[str, str]):\r
155     def __init__(self, parser: RawConfigParser, name: str) -> None: ...\r
156     def __getitem__(self, key: str) -> str: ...\r
157     def __setitem__(self, key: str, value: str) -> None: ...\r
158     def __delitem__(self, key: str) -> None: ...\r
159     def __contains__(self, key: object) -> bool: ...\r
160     def __len__(self) -> int: ...\r
161     def __iter__(self) -> Iterator[str]: ...\r
162     @property\r
163     def parser(self) -> RawConfigParser: ...\r
164     @property\r
165     def name(self) -> str: ...\r
166     def get(self, option: str, fallback: Optional[str] = ..., *, raw: bool = ..., vars: Optional[_section] = ..., **kwargs: Any) -> str: ...  # type: ignore\r
167 \r
168     # These are partially-applied version of the methods with the same names in\r
169     # RawConfigParser; the stubs should be kept updated together\r
170     def getint(self, option: str, *, raw: bool = ..., vars: _section = ..., fallback: int = ...) -> int: ...\r
171     def getfloat(self, option: str, *, raw: bool = ..., vars: _section = ..., fallback: float = ...) -> float: ...\r
172     def getboolean(self, option: str, *, raw: bool = ..., vars: _section = ..., fallback: bool = ...) -> bool: ...\r
173 \r
174     # SectionProxy can have arbitrary attributes when custon converters are used\r
175     def __getattr__(self, key: str) -> Callable[..., Any]: ...\r
176 \r
177 class ConverterMapping(MutableMapping[str, Optional[_converter]]):\r
178     GETTERCRE: Pattern\r
179     def __init__(self, parser: RawConfigParser) -> None: ...\r
180     def __getitem__(self, key: str) -> _converter: ...\r
181     def __setitem__(self, key: str, value: Optional[_converter]) -> None: ...\r
182     def __delitem__(self, key: str) -> None: ...\r
183     def __iter__(self) -> Iterator[str]: ...\r
184     def __len__(self) -> int: ...\r
185 \r
186 \r
187 class Error(Exception): ...\r
188 \r
189 \r
190 class NoSectionError(Error): ...\r
191 \r
192 \r
193 class DuplicateSectionError(Error):\r
194     section = ...  # type: str\r
195     source = ...   # type: Optional[str]\r
196     lineno = ...   # type: Optional[int]\r
197 \r
198 \r
199 class DuplicateOptionError(Error):\r
200     section = ...  # type: str\r
201     option = ...   # type: str\r
202     source = ...   # type: Optional[str]\r
203     lineno = ...   # type: Optional[int]\r
204 \r
205 \r
206 class NoOptionError(Error):\r
207     section = ...  # type: str\r
208     option = ...   # type: str\r
209 \r
210 \r
211 class InterpolationError(Error):\r
212     section = ...  # type: str\r
213     option = ...   # type: str\r
214 \r
215 \r
216 class InterpolationDepthError(InterpolationError): ...\r
217 \r
218 \r
219 class InterpolationMissingOptionError(InterpolationError):\r
220     reference = ...  # type: str\r
221 \r
222 \r
223 class InterpolationSyntaxError(InterpolationError): ...\r
224 \r
225 \r
226 class ParsingError(Error):\r
227     source = ...  # type: str\r
228     errors = ...  # type: Sequence[Tuple[int, str]]\r
229 \r
230 \r
231 class MissingSectionHeaderError(ParsingError):\r
232     lineno = ...  # type: int\r
233     line = ...    # type: str\r