diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-01-17 16:10:39 -0600 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-01-17 16:10:39 -0600 |
| commit | 993f92f03626adf583d8cedb01f52b18afe28c29 (patch) | |
| tree | 2ddef347ea4f13e5642da5f64ccb648cc7b64913 /config_file | |
| parent | Bump version: 0.2.0 → 0.3.0 (diff) | |
| download | config-file-993f92f03626adf583d8cedb01f52b18afe28c29.zip | |
Run pre-commit on all files
Diffstat (limited to 'config_file')
| -rw-r--r-- | config_file/config_file.py | 6 | ||||
| -rw-r--r-- | config_file/parsers/ini_parser.py | 4 |
2 files changed, 3 insertions, 7 deletions
diff --git a/config_file/config_file.py b/config_file/config_file.py index a95aa2d..a57e77f 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) @@ -66,6 +65,3 @@ class ConfigFile: it would only be checking if the section """ return self.parser.has(section_key) - - - diff --git a/config_file/parsers/ini_parser.py b/config_file/parsers/ini_parser.py index 9a69164..502ad54 100644 --- a/config_file/parsers/ini_parser.py +++ b/config_file/parsers/ini_parser.py @@ -6,7 +6,6 @@ from config_file.parsers.parse_value import parse_value class IniParser(BaseParser): - def __init__(self, file_contents: str): """Reads in the file contents into the parser.""" try: @@ -27,7 +26,8 @@ class IniParser(BaseParser): :param parse_type: Coerces the return value to its native type. :return: The value of the key, parsed to its native type if parse_type is True. - :raises ValueError: if the section_key given is not in a dot format. e.g. 'section1.key' + :raises ValueError: if the section_key given is not in a dot format. + e.g. 'section1.key' :raises ParsingError: if the specified `section.key` is not found, in an invalid format, or if we are unable to coerce the return value to value_type. """ |