(self, st, line, fpname)
| 1142 | st.optname = None |
| 1143 | |
| 1144 | def _handle_option(self, st, line, fpname): |
| 1145 | # an option line? |
| 1146 | st.indent_level = st.cur_indent_level |
| 1147 | |
| 1148 | mo = self._optcre.match(line.clean) |
| 1149 | if not mo: |
| 1150 | # a non-fatal parsing error occurred. set up the |
| 1151 | # exception but keep going. the exception will be |
| 1152 | # raised at the end of the file and will contain a |
| 1153 | # list of all bogus lines |
| 1154 | st.errors.append(ParsingError(fpname, st.lineno, line)) |
| 1155 | return |
| 1156 | |
| 1157 | st.optname, vi, optval = mo.group('option', 'vi', 'value') |
| 1158 | if not st.optname: |
| 1159 | st.errors.append(ParsingError(fpname, st.lineno, line)) |
| 1160 | st.optname = self.optionxform(st.optname.rstrip()) |
| 1161 | if (self._strict and |
| 1162 | (st.sectname, st.optname) in st.elements_added): |
| 1163 | raise DuplicateOptionError(st.sectname, st.optname, |
| 1164 | fpname, st.lineno) |
| 1165 | st.elements_added.add((st.sectname, st.optname)) |
| 1166 | # This check is fine because the OPTCRE cannot |
| 1167 | # match if it would set optval to None |
| 1168 | if optval is not None: |
| 1169 | optval = optval.strip() |
| 1170 | st.cursect[st.optname] = [optval] |
| 1171 | else: |
| 1172 | # valueless option handling |
| 1173 | st.cursect[st.optname] = None |
| 1174 | |
| 1175 | def _join_multiline_values(self): |
| 1176 | defaults = self.default_section, self._defaults |
no test coverage detected