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

Class DuplicateOptionError

Lib/configparser.py:224–248  ·  view source on GitHub ↗

Raised by strict parsers when an option is repeated in an input source. Current implementation raises this exception only when an option is found more than once in a single file, string or dictionary.

Source from the content-addressed store, hash-verified

222
223
224class DuplicateOptionError(Error):
225 """Raised by strict parsers when an option is repeated in an input source.
226
227 Current implementation raises this exception only when an option is found
228 more than once in a single file, string or dictionary.
229 """
230
231 def __init__(self, section, option, source=None, lineno=None):
232 msg = [repr(option), " in section ", repr(section),
233 " already exists"]
234 if source is not None:
235 message = ["While reading from ", repr(source)]
236 if lineno is not None:
237 message.append(" [line {0:2d}]".format(lineno))
238 message.append(": option ")
239 message.extend(msg)
240 msg = message
241 else:
242 msg.insert(0, "Option ")
243 Error.__init__(self, "".join(msg))
244 self.section = section
245 self.option = option
246 self.source = source
247 self.lineno = lineno
248 self.args = (section, option, source, lineno)
249
250
251class NoOptionError(Error):

Callers 2

read_dictMethod · 0.85
_handle_optionMethod · 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…