diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-01-17 20:31:42 -0600 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-01-17 20:31:42 -0600 |
| commit | 0174602093dcb097e23f6493bfd4f5d1a9fe2e3c (patch) | |
| tree | ced5d54e2cb5e80008adc39cf0f9fdb2c53eadc8 /config_file/config_file.py | |
| parent | Fix bug with isinstance use in config file (diff) | |
| download | config-file-0174602093dcb097e23f6493bfd4f5d1a9fe2e3c.zip | |
Remove _split_on_dot from base parser and add it to utils
Also, change the default behavior to split on every dot and split on
only the last dot if specified
Diffstat (limited to 'config_file/config_file.py')
| -rw-r--r-- | config_file/config_file.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/config_file/config_file.py b/config_file/config_file.py index c47def2..5a2dbb5 100644 --- a/config_file/config_file.py +++ b/config_file/config_file.py @@ -1,7 +1,9 @@ +import inspect from pathlib import Path from config_file.parsers.base_parser import BaseParser from config_file.parsers.ini_parser import IniParser +from config_file.utils import split_on_dot class ConfigFile: @@ -21,10 +23,10 @@ class ConfigFile: return Path(file_path) def __determine_parser(self, file_path: str, parser): - if isinstance(parser, BaseParser): + if isinstance(parser, BaseParser) and not inspect.isabstract(parser): return parser(self.contents) - file_type = self._split_on_dot(file_path, all_dots=True)[-1] + file_type = split_on_dot(file_path)[-1] if file_type == "ini": return IniParser(self.contents) else: |