From d6832cd600a28c1396c67229245347c1cf9440ca Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Thu, 26 Nov 2020 13:18:44 -0600 Subject: Move parsers to parsers directory --- config_file/toml_parser.py | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 config_file/toml_parser.py (limited to 'config_file/toml_parser.py') diff --git a/config_file/toml_parser.py b/config_file/toml_parser.py deleted file mode 100644 index de5226c..0000000 --- a/config_file/toml_parser.py +++ /dev/null @@ -1,31 +0,0 @@ -from typing import Type - -from .base_parser import BaseParser - - -class TomlParser(BaseParser): - def __init__(self, file_contents: str): - try: - super().__init__(file_contents) - except ImportError: - raise ImportError( - "It doesn't appear `tomlkit` is installed, but a toml " - "file was attempted to be used. Install the `toml` " - "extra first with `pip install config-file[toml]`." - ) - - @property - def decode_error(self) -> Type[Exception]: - from tomlkit.exceptions import ParseError - - return ParseError - - def loads(self, contents: str) -> dict: - import tomlkit - - return tomlkit.loads(contents) - - def dumps(self, loaded_contents: dict) -> str: - import tomlkit - - return tomlkit.dumps(loaded_contents) -- cgit v1.2.3