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

Method _validate_key_contents

Lib/configparser.py:1220–1229  ·  view source on GitHub ↗

Raises an InvalidWriteError for any keys containing delimiters or that begins with the section header pattern

(self, key)

Source from the content-addressed store, hash-verified

1218 return self.BOOLEAN_STATES[value.lower()]
1219
1220 def _validate_key_contents(self, key):
1221 """Raises an InvalidWriteError for any keys containing
1222 delimiters or that begins with the section header pattern"""
1223 if re.match(self.SECTCRE, key):
1224 raise InvalidWriteError(
1225 f"Cannot write key {key}; begins with section pattern")
1226 for delim in self._delimiters:
1227 if delim in key:
1228 raise InvalidWriteError(
1229 f"Cannot write key {key}; contains delimiter {delim}")
1230
1231 def _validate_value_types(self, *, section="", option="", value=""):
1232 """Raises a TypeError for illegal non-string values.

Callers 1

_write_sectionMethod · 0.95

Calls 2

InvalidWriteErrorClass · 0.85
matchMethod · 0.45

Tested by

no test coverage detected