MCPcopy Index your code
hub / github.com/python/cpython / DuplicateSectionError

Class DuplicateSectionError

Lib/configparser.py:198–221  ·  view source on GitHub ↗

Raised when a section is repeated in an input source. Possible repetitions that raise this exception are: multiple creation using the API or in strict parsers when a section is found more than once in a single input file, string or dictionary.

Source from the content-addressed store, hash-verified

196
197
198class DuplicateSectionError(Error):
199 """Raised when a section is repeated in an input source.
200
201 Possible repetitions that raise this exception are: multiple creation
202 using the API or in strict parsers when a section is found more than once
203 in a single input file, string or dictionary.
204 """
205
206 def __init__(self, section, source=None, lineno=None):
207 msg = [repr(section), " already exists"]
208 if source is not None:
209 message = ["While reading from ", repr(source)]
210 if lineno is not None:
211 message.append(" [line {0:2d}]".format(lineno))
212 message.append(": section ")
213 message.extend(msg)
214 msg = message
215 else:
216 msg.insert(0, "Section ")
217 Error.__init__(self, "".join(msg))
218 self.section = section
219 self.source = source
220 self.lineno = lineno
221 self.args = (section, source, lineno)
222
223
224class DuplicateOptionError(Error):

Callers 2

add_sectionMethod · 0.85
_handle_headerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…