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

Method remove_option

Lib/configparser.py:994–1007  ·  view source on GitHub ↗

Remove an option.

(self, section, option)

Source from the content-addressed store, hash-verified

992 fp.write("\n")
993
994 def remove_option(self, section, option):
995 """Remove an option."""
996 if not section or section == self.default_section:
997 sectdict = self._defaults
998 else:
999 try:
1000 sectdict = self._sections[section]
1001 except KeyError:
1002 raise NoSectionError(section) from None
1003 option = self.optionxform(option)
1004 existed = option in sectdict
1005 if existed:
1006 del sectdict[option]
1007 return existed
1008
1009 def remove_section(self, section):
1010 """Remove a file section."""

Callers 1

__delitem__Method · 0.45

Calls 2

optionxformMethod · 0.95
NoSectionErrorClass · 0.85

Tested by

no test coverage detected