(self)
| 116 | raise ValueError('Unknown section type.') |
| 117 | |
| 118 | def parse(self): |
| 119 | for section in self._parser.sections(): |
| 120 | if ' ' in section: |
| 121 | section_type, name = section.split(' ', 1) |
| 122 | else: |
| 123 | section_type = name = section |
| 124 | |
| 125 | try: |
| 126 | self._parse_section( |
| 127 | section_type, name, |
| 128 | dict(_parse_options(self._parser.items(section), |
| 129 | section=section)) |
| 130 | ) |
| 131 | except ValueError as e: |
| 132 | raise exceptions.UserError( |
| 133 | 'Section "{}": {}'.format(section, str(e))) |
| 134 | |
| 135 | _validate_general_section(self._general) |
| 136 | if getattr(self._file, 'name', None): |
| 137 | self._general['status_path'] = os.path.join( |
| 138 | os.path.dirname(self._file.name), |
| 139 | expand_path(self._general['status_path']) |
| 140 | ) |
| 141 | |
| 142 | return self._general, self._pairs, self._storages |
| 143 | |
| 144 | |
| 145 | def _parse_options(items, section=None): |
no test coverage detected