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

Method add_section

Lib/configparser.py:701–717  ·  view source on GitHub ↗

Create a new section in the configuration. Raise DuplicateSectionError if a section by the specified name already exists. Raise ValueError if name is DEFAULT.

(self, section)

Source from the content-addressed store, hash-verified

699 return list(self._sections.keys())
700
701 def add_section(self, section):
702 """Create a new section in the configuration.
703
704 Raise DuplicateSectionError if a section by the specified name
705 already exists. Raise ValueError if name is DEFAULT.
706 """
707 if section == self.default_section:
708 raise ValueError('Invalid section name: %r' % section)
709
710 if section is UNNAMED_SECTION:
711 if not self._allow_unnamed_section:
712 raise UnnamedSectionDisabledError
713
714 if section in self._sections:
715 raise DuplicateSectionError(section)
716 self._sections[section] = self._dict()
717 self._proxies[section] = SectionProxy(self, section)
718
719 def has_section(self, section):
720 """Indicate whether the named section is present in the configuration.

Callers 1

read_dictMethod · 0.95

Calls 2

SectionProxyClass · 0.85

Tested by

no test coverage detected