aboutsummaryrefslogtreecommitdiffstats
path: root/config_file/yaml_parser.py
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-11-26 13:18:44 -0600
committerEugene Triguba <eugenetriguba@gmail.com>2020-11-26 13:18:44 -0600
commitd6832cd600a28c1396c67229245347c1cf9440ca (patch)
treee216eed48e9130be1bd63d4ad0ee3c8cad68d915 /config_file/yaml_parser.py
parentAdd python 3.9 to pyproject and update lockfile (diff)
downloadconfig-file-d6832cd600a28c1396c67229245347c1cf9440ca.zip
Move parsers to parsers directory
Diffstat (limited to 'config_file/yaml_parser.py')
-rw-r--r--config_file/yaml_parser.py31
1 files changed, 0 insertions, 31 deletions
diff --git a/config_file/yaml_parser.py b/config_file/yaml_parser.py
deleted file mode 100644
index fc4239a..0000000
--- a/config_file/yaml_parser.py
+++ /dev/null
@@ -1,31 +0,0 @@
-from typing import Type
-
-from .base_parser import BaseParser
-
-
-class YamlParser(BaseParser):
- def __init__(self, file_contents: str):
- try:
- super().__init__(file_contents)
- except ImportError:
- raise ImportError(
- "It doesn't appear `ruamel.yaml` is installed, but a yaml "
- "file was attempted to be used. Install the `yaml` "
- "extra first with `pip install config-file[yaml]`."
- )
-
- @property
- def decode_error(self) -> Type[Exception]:
- from ruamel.yaml import YAMLError
-
- return YAMLError
-
- def loads(self, contents: str) -> dict:
- from ruamel.yaml import round_trip_load
-
- return round_trip_load(contents)
-
- def dumps(self, loaded_contents: dict) -> str:
- from ruamel.yaml import round_trip_dump
-
- return round_trip_dump(loaded_contents)