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

Method _write_section

Lib/configparser.py:979–992  ·  view source on GitHub ↗

Write a single section to the specified 'fp'.

(self, fp, section_name, section_items, delimiter, unnamed=False)

Source from the content-addressed store, hash-verified

977 self._sections[section].items(), d)
978
979 def _write_section(self, fp, section_name, section_items, delimiter, unnamed=False):
980 """Write a single section to the specified 'fp'."""
981 if not unnamed:
982 fp.write("[{}]\n".format(section_name))
983 for key, value in section_items:
984 self._validate_key_contents(key)
985 value = self._interpolation.before_write(self, section_name, key,
986 value)
987 if value is not None or not self._allow_no_value:
988 value = delimiter + str(value).replace('\n', '\n\t')
989 else:
990 value = ""
991 fp.write("{}{}\n".format(key, value))
992 fp.write("\n")
993
994 def remove_option(self, section, option):
995 """Remove an option."""

Callers 1

writeMethod · 0.95

Calls 6

strFunction · 0.85
before_writeMethod · 0.80
writeMethod · 0.45
formatMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected