diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-01-17 20:14:02 -0600 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-01-17 20:14:02 -0600 |
| commit | dde9ff6fa4ad8f3ff00d30a34b670a267ec96884 (patch) | |
| tree | 7392cc96cfe2e46a6f0dc2b32426ce7e39472a91 | |
| parent | Bump version: 0.2.0 → 0.3.0 (diff) | |
| download | config-file-dde9ff6fa4ad8f3ff00d30a34b670a267ec96884.zip | |
Fix bug with isinstance use in config file
| -rw-r--r-- | CHANGELOG.md | 6 | ||||
| -rw-r--r-- | config_file/config_file.py | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ad1669f..b76d2d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +Fixed + +- `isinstance` call for `BaseParser` to be correctly used. + ## 0.3.0 - 2020-01-17 Added diff --git a/config_file/config_file.py b/config_file/config_file.py index a95aa2d..c47def2 100644 --- a/config_file/config_file.py +++ b/config_file/config_file.py @@ -1,11 +1,10 @@ from pathlib import Path -from config_file.parsers.ini_parser import IniParser from config_file.parsers.base_parser import BaseParser +from config_file.parsers.ini_parser import IniParser class ConfigFile: - def __init__(self, file_path: str, parser=None): self.path = self.__create_config_path(file_path) @@ -22,7 +21,7 @@ class ConfigFile: return Path(file_path) def __determine_parser(self, file_path: str, parser): - if isinstance(BaseParser, parser): + if isinstance(parser, BaseParser): return parser(self.contents) file_type = self._split_on_dot(file_path, all_dots=True)[-1] @@ -66,6 +65,3 @@ class ConfigFile: it would only be checking if the section """ return self.parser.has(section_key) - - - |