aboutsummaryrefslogtreecommitdiffstats
path: root/config_file/parsers/base_parser.py
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-08-01 11:53:56 -0500
committerEugene Triguba <eugenetriguba@gmail.com>2020-08-01 11:53:56 -0500
commitb1c23487c33fc2ad5503b6340b17980a326918c8 (patch)
treedb8fa8f1147ddcdd0df072431cfdb37e24976a1c /config_file/parsers/base_parser.py
parentAdd '-E yaml -E toml' to install instructions (diff)
downloadconfig-file-b1c23487c33fc2ad5503b6340b17980a326918c8.zip
Lint files
Diffstat (limited to 'config_file/parsers/base_parser.py')
-rw-r--r--config_file/parsers/base_parser.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/config_file/parsers/base_parser.py b/config_file/parsers/base_parser.py
index 546450c..c2a7d71 100644
--- a/config_file/parsers/base_parser.py
+++ b/config_file/parsers/base_parser.py
@@ -1,5 +1,5 @@
-from typing import Any
from types import ModuleType
+from typing import Any
from config_file.exceptions import MissingKeyError, ParsingError
from config_file.nested_lookup import get_occurrence_of_key
@@ -9,9 +9,7 @@ from .abstract_parser import AbstractParser
class BaseParser(AbstractParser):
- def __init__(
- self, file_contents: str, module: ModuleType, decode_error: Exception
- ):
+ def __init__(self, file_contents: str, module: ModuleType, decode_error: Exception):
super().__init__(file_contents)
self.__module = module
self.__decode_error = decode_error
@@ -92,10 +90,9 @@ class BaseParser(AbstractParser):
def has(self, search_key: str, wild: bool = False) -> bool:
if wild:
return get_occurrence_of_key(self.parsed_content, key=search_key) > 0
-
+
try:
self.get(search_key)
return True
except (KeyError, ParsingError):
return False
-