diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-05 21:48:08 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-08-05 21:48:08 -0500 |
| commit | 19d23dc13636b30f6282e8b3f02b659bcdb2bb11 (patch) | |
| tree | 52216c50ee455571d3734e936eb0aec93e87305c | |
| parent | Add docstrings to AbstractParser tests (diff) | |
| download | config-file-19d23dc13636b30f6282e8b3f02b659bcdb2bb11.zip | |
Remove MissingDependencyError in favor of ImportError
| -rw-r--r-- | config_file/config_file_path.py | 2 | ||||
| -rw-r--r-- | config_file/exceptions.py | 7 | ||||
| -rw-r--r-- | config_file/toml_parser.py | 3 | ||||
| -rw-r--r-- | config_file/yaml_parser.py | 3 |
4 files changed, 3 insertions, 12 deletions
diff --git a/config_file/config_file_path.py b/config_file/config_file_path.py index 9f2b87d..42466d9 100644 --- a/config_file/config_file_path.py +++ b/config_file/config_file_path.py @@ -102,7 +102,7 @@ class ConfigFilePath(_Path_): ValueError: If the path leads to a directory. Returns: - This ConfigFilePath object + A ConfigFilePath object with any ~'s expanded. """ if len(self.parts) >= 1 and self.parts[0] == "~": self = ConfigFilePath(self.expanduser()) diff --git a/config_file/exceptions.py b/config_file/exceptions.py index 22ee70c..a8b8e5c 100644 --- a/config_file/exceptions.py +++ b/config_file/exceptions.py @@ -2,13 +2,6 @@ class ConfigFileError(Exception): """A generic error from the package.""" -class MissingDependencyError(ConfigFileError): - """ - yaml or toml dependencies were not installed, - but the parsers for them were attempted to be used. - """ - - class UnsupportedFileTypeError(ConfigFileError): """ A missing file extension or a file type not supported. diff --git a/config_file/toml_parser.py b/config_file/toml_parser.py index 1c7f8a7..fc12ab3 100644 --- a/config_file/toml_parser.py +++ b/config_file/toml_parser.py @@ -5,7 +5,6 @@ try: except ImportError: TOML_AVAILABLE = False -from config_file.exceptions import MissingDependencyError from .base_parser import BaseParser @@ -13,7 +12,7 @@ from .base_parser import BaseParser class TomlParser(BaseParser): def __init__(self, file_contents: str): if not TOML_AVAILABLE: - raise MissingDependencyError( + 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]`." diff --git a/config_file/yaml_parser.py b/config_file/yaml_parser.py index fb42e08..938b0d7 100644 --- a/config_file/yaml_parser.py +++ b/config_file/yaml_parser.py @@ -6,13 +6,12 @@ except ImportError: YAML_AVAILABLE = False from .base_parser import BaseParser -from .exceptions import MissingDependencyError class YamlParser(BaseParser): def __init__(self, file_contents: str): if not YAML_AVAILABLE: - raise MissingDependencyError( + 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]`." |