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

Method _read

Lib/configparser.py:1052–1072  ·  view source on GitHub ↗

Parse a sectioned configuration file. Each section in a configuration file contains a header, indicated by a name in square brackets (`[]`), plus key/value options, indicated by `name` and `value` delimited with a specific substring (`=` or `:` by default).

(self, fp, fpname)

Source from the content-addressed store, hash-verified

1050 return itertools.chain((self.default_section,), self._sections.keys())
1051
1052 def _read(self, fp, fpname):
1053 """Parse a sectioned configuration file.
1054
1055 Each section in a configuration file contains a header, indicated by
1056 a name in square brackets (`[]`), plus key/value options, indicated by
1057 `name` and `value` delimited with a specific substring (`=` or `:` by
1058 default).
1059
1060 Values can span multiple lines, as long as they are indented deeper
1061 than the first line of the value. Depending on the parser's mode, blank
1062 lines may be treated as parts of multiline values or ignored.
1063
1064 Configuration files may include comments, prefixed by specific
1065 characters (`#` and `;` by default). Comments may appear on their own
1066 in an otherwise empty line or may be entered in lines holding values or
1067 section names. Please note that comments get stripped off when reading configuration files.
1068 """
1069 try:
1070 ParsingError._raise_all(self._read_inner(fp, fpname))
1071 finally:
1072 self._join_multiline_values()
1073
1074 def _read_inner(self, fp, fpname):
1075 st = _ReadState()

Callers 2

readMethod · 0.95
read_fileMethod · 0.95

Calls 3

_read_innerMethod · 0.95
_raise_allMethod · 0.80

Tested by

no test coverage detected