@@ -5,7 +5,31 @@ from re import Pattern
55from typing import Any , ClassVar , Literal , TypeVar , overload
66from typing_extensions import TypeAlias
77
8- if sys .version_info >= (3 , 12 ):
8+ if sys .version_info >= (3 , 13 ):
9+ __all__ = (
10+ "NoSectionError" ,
11+ "DuplicateOptionError" ,
12+ "DuplicateSectionError" ,
13+ "NoOptionError" ,
14+ "InterpolationError" ,
15+ "InterpolationDepthError" ,
16+ "InterpolationMissingOptionError" ,
17+ "InterpolationSyntaxError" ,
18+ "ParsingError" ,
19+ "MissingSectionHeaderError" ,
20+ "ConfigParser" ,
21+ "RawConfigParser" ,
22+ "Interpolation" ,
23+ "BasicInterpolation" ,
24+ "ExtendedInterpolation" ,
25+ "SectionProxy" ,
26+ "ConverterMapping" ,
27+ "DEFAULTSECT" ,
28+ "MAX_INTERPOLATION_DEPTH" ,
29+ "UNNAMED_SECTION" ,
30+ "MultilineContinuationError" ,
31+ )
32+ elif sys .version_info >= (3 , 12 ):
933 __all__ = (
1034 "NoSectionError" ,
1135 "DuplicateOptionError" ,
@@ -71,8 +95,9 @@ class Interpolation:
7195class BasicInterpolation (Interpolation ): ...
7296class ExtendedInterpolation (Interpolation ): ...
7397
74- class LegacyInterpolation (Interpolation ):
75- def before_get (self , parser : _Parser , section : str , option : str , value : str , vars : _Section ) -> str : ...
98+ if sys .version_info < (3 , 13 ):
99+ class LegacyInterpolation (Interpolation ):
100+ def before_get (self , parser : _Parser , section : str , option : str , value : str , vars : _Section ) -> str : ...
76101
77102class RawConfigParser (_Parser ):
78103 _SECT_TMPL : ClassVar [str ] # undocumented
@@ -86,54 +111,108 @@ class RawConfigParser(_Parser):
86111
87112 BOOLEAN_STATES : ClassVar [Mapping [str , bool ]] # undocumented
88113 default_section : str
89- @overload
90- def __init__ (
91- self ,
92- defaults : Mapping [str , str | None ] | None = None ,
93- dict_type : type [Mapping [str , str ]] = ...,
94- * ,
95- allow_no_value : Literal [True ],
96- delimiters : Sequence [str ] = ("=" , ":" ),
97- comment_prefixes : Sequence [str ] = ("#" , ";" ),
98- inline_comment_prefixes : Sequence [str ] | None = None ,
99- strict : bool = True ,
100- empty_lines_in_values : bool = True ,
101- default_section : str = "DEFAULT" ,
102- interpolation : Interpolation | None = ...,
103- converters : _ConvertersMap = ...,
104- ) -> None : ...
105- @overload
106- def __init__ (
107- self ,
108- defaults : Mapping [str , str | None ] | None ,
109- dict_type : type [Mapping [str , str ]],
110- allow_no_value : Literal [True ],
111- * ,
112- delimiters : Sequence [str ] = ("=" , ":" ),
113- comment_prefixes : Sequence [str ] = ("#" , ";" ),
114- inline_comment_prefixes : Sequence [str ] | None = None ,
115- strict : bool = True ,
116- empty_lines_in_values : bool = True ,
117- default_section : str = "DEFAULT" ,
118- interpolation : Interpolation | None = ...,
119- converters : _ConvertersMap = ...,
120- ) -> None : ...
121- @overload
122- def __init__ (
123- self ,
124- defaults : _Section | None = None ,
125- dict_type : type [Mapping [str , str ]] = ...,
126- allow_no_value : bool = False ,
127- * ,
128- delimiters : Sequence [str ] = ("=" , ":" ),
129- comment_prefixes : Sequence [str ] = ("#" , ";" ),
130- inline_comment_prefixes : Sequence [str ] | None = None ,
131- strict : bool = True ,
132- empty_lines_in_values : bool = True ,
133- default_section : str = "DEFAULT" ,
134- interpolation : Interpolation | None = ...,
135- converters : _ConvertersMap = ...,
136- ) -> None : ...
114+ if sys .version_info >= (3 , 13 ):
115+ @overload
116+ def __init__ (
117+ self ,
118+ defaults : Mapping [str , str | None ] | None = None ,
119+ dict_type : type [Mapping [str , str ]] = ...,
120+ * ,
121+ allow_no_value : Literal [True ],
122+ delimiters : Sequence [str ] = ("=" , ":" ),
123+ comment_prefixes : Sequence [str ] = ("#" , ";" ),
124+ inline_comment_prefixes : Sequence [str ] | None = None ,
125+ strict : bool = True ,
126+ empty_lines_in_values : bool = True ,
127+ default_section : str = "DEFAULT" ,
128+ interpolation : Interpolation | None = ...,
129+ converters : _ConvertersMap = ...,
130+ allow_unnamed_section : bool = False ,
131+ ) -> None : ...
132+ @overload
133+ def __init__ (
134+ self ,
135+ defaults : Mapping [str , str | None ] | None ,
136+ dict_type : type [Mapping [str , str ]],
137+ allow_no_value : Literal [True ],
138+ * ,
139+ delimiters : Sequence [str ] = ("=" , ":" ),
140+ comment_prefixes : Sequence [str ] = ("#" , ";" ),
141+ inline_comment_prefixes : Sequence [str ] | None = None ,
142+ strict : bool = True ,
143+ empty_lines_in_values : bool = True ,
144+ default_section : str = "DEFAULT" ,
145+ interpolation : Interpolation | None = ...,
146+ converters : _ConvertersMap = ...,
147+ allow_unnamed_section : bool = False ,
148+ ) -> None : ...
149+ @overload
150+ def __init__ (
151+ self ,
152+ defaults : _Section | None = None ,
153+ dict_type : type [Mapping [str , str ]] = ...,
154+ allow_no_value : bool = False ,
155+ * ,
156+ delimiters : Sequence [str ] = ("=" , ":" ),
157+ comment_prefixes : Sequence [str ] = ("#" , ";" ),
158+ inline_comment_prefixes : Sequence [str ] | None = None ,
159+ strict : bool = True ,
160+ empty_lines_in_values : bool = True ,
161+ default_section : str = "DEFAULT" ,
162+ interpolation : Interpolation | None = ...,
163+ converters : _ConvertersMap = ...,
164+ allow_unnamed_section : bool = False ,
165+ ) -> None : ...
166+ else :
167+ @overload
168+ def __init__ (
169+ self ,
170+ defaults : Mapping [str , str | None ] | None = None ,
171+ dict_type : type [Mapping [str , str ]] = ...,
172+ * ,
173+ allow_no_value : Literal [True ],
174+ delimiters : Sequence [str ] = ("=" , ":" ),
175+ comment_prefixes : Sequence [str ] = ("#" , ";" ),
176+ inline_comment_prefixes : Sequence [str ] | None = None ,
177+ strict : bool = True ,
178+ empty_lines_in_values : bool = True ,
179+ default_section : str = "DEFAULT" ,
180+ interpolation : Interpolation | None = ...,
181+ converters : _ConvertersMap = ...,
182+ ) -> None : ...
183+ @overload
184+ def __init__ (
185+ self ,
186+ defaults : Mapping [str , str | None ] | None ,
187+ dict_type : type [Mapping [str , str ]],
188+ allow_no_value : Literal [True ],
189+ * ,
190+ delimiters : Sequence [str ] = ("=" , ":" ),
191+ comment_prefixes : Sequence [str ] = ("#" , ";" ),
192+ inline_comment_prefixes : Sequence [str ] | None = None ,
193+ strict : bool = True ,
194+ empty_lines_in_values : bool = True ,
195+ default_section : str = "DEFAULT" ,
196+ interpolation : Interpolation | None = ...,
197+ converters : _ConvertersMap = ...,
198+ ) -> None : ...
199+ @overload
200+ def __init__ (
201+ self ,
202+ defaults : _Section | None = None ,
203+ dict_type : type [Mapping [str , str ]] = ...,
204+ allow_no_value : bool = False ,
205+ * ,
206+ delimiters : Sequence [str ] = ("=" , ":" ),
207+ comment_prefixes : Sequence [str ] = ("#" , ";" ),
208+ inline_comment_prefixes : Sequence [str ] | None = None ,
209+ strict : bool = True ,
210+ empty_lines_in_values : bool = True ,
211+ default_section : str = "DEFAULT" ,
212+ interpolation : Interpolation | None = ...,
213+ converters : _ConvertersMap = ...,
214+ ) -> None : ...
215+
137216 def __len__ (self ) -> int : ...
138217 def __getitem__ (self , key : str ) -> SectionProxy : ...
139218 def __setitem__ (self , key : str , value : _Section ) -> None : ...
@@ -300,7 +379,10 @@ class InterpolationSyntaxError(InterpolationError): ...
300379class ParsingError (Error ):
301380 source : str
302381 errors : list [tuple [int , str ]]
303- if sys .version_info >= (3 , 12 ):
382+ if sys .version_info >= (3 , 13 ):
383+ def __init__ (self , source : str , * args : object ) -> None : ...
384+ def combine (self , others : Iterable [ParsingError ]) -> ParsingError : ...
385+ elif sys .version_info >= (3 , 12 ):
304386 def __init__ (self , source : str ) -> None : ...
305387 else :
306388 def __init__ (self , source : str | None = None , filename : str | None = None ) -> None : ...
@@ -311,3 +393,12 @@ class MissingSectionHeaderError(ParsingError):
311393 lineno : int
312394 line : str
313395 def __init__ (self , filename : str , lineno : int , line : str ) -> None : ...
396+
397+ if sys .version_info >= (3 , 13 ):
398+ class _UNNAMED_SECTION : ...
399+ UNNAMED_SECTION : _UNNAMED_SECTION
400+
401+ class MultilineContinuationError (ParsingError ):
402+ lineno : int
403+ line : str
404+ def __init__ (self , filename : str , lineno : int , line : str ) -> None : ...
0 commit comments