diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-01-17 20:33:59 -0600 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-01-17 20:33:59 -0600 |
| commit | 73992f40045bf57dee8e0e171e3a65d4693a1362 (patch) | |
| tree | e0c9fdaf302afc5de1452c33a047ee816b4b84ae /config_file/parsers/base_parser.py | |
| parent | Bump version: 0.3.0 → 0.3.1 (diff) | |
| parent | Remove _split_on_dot from base parser and add it to utils (diff) | |
| download | config-file-73992f40045bf57dee8e0e171e3a65d4693a1362.zip | |
Merge branch 'json'
Diffstat (limited to 'config_file/parsers/base_parser.py')
| -rw-r--r-- | config_file/parsers/base_parser.py | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/config_file/parsers/base_parser.py b/config_file/parsers/base_parser.py index 38e8859..22e286a 100644 --- a/config_file/parsers/base_parser.py +++ b/config_file/parsers/base_parser.py @@ -22,7 +22,7 @@ class BaseParser(ABC): the parser and save the file when they are done using stringify(). """ self.contents = file_contents - self.parse(self.contents) + self.parsed_content = self.parse(self.contents) @abstractmethod def get(self, key, parse_type=True): @@ -74,25 +74,6 @@ class BaseParser(ABC): """ raise NotImplementedError - @staticmethod - def _split_on_dot(line: str, all_dots=False): - """ - Split a string on the first dot (.). - - :param line: The line ot split on. - :param all_dots: If the line should be split on all the dots. Defaults to - False and only splits on the first occurrence of one. - - :raises ValueError: if the line does not have a dot. - """ - if "." not in line: - raise ValueError( - "section_key must contain the section and key separated by a dot. " - + "e.g. 'section.key'" - ) - - return line.split(".") if all_dots else line.rsplit(".", 1) - class ParsingError(Exception): """Unable to parse the configuration file""" |