aboutsummaryrefslogtreecommitdiffstats
path: root/config_file/parsers/ini_parser.py
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-06-20 13:41:35 -0500
committerEugene Triguba <eugenetriguba@gmail.com>2020-06-20 15:56:19 -0500
commitaa44fe7a60a4f3326cc47877b3e246b56d46d6ac (patch)
treec30961887bf720ba8c676250174318029f0ad786 /config_file/parsers/ini_parser.py
parentCreate python-package-ci.yml (diff)
downloadconfig-file-aa44fe7a60a4f3326cc47877b3e246b56d46d6ac.zip
Add python 3.5 support, ConfigFileError, and more type hints
Also, get_all, set_all, and delete_all in JsonParser have been renamed to just all.
Diffstat (limited to 'config_file/parsers/ini_parser.py')
-rw-r--r--config_file/parsers/ini_parser.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/config_file/parsers/ini_parser.py b/config_file/parsers/ini_parser.py
index 81f2d1b..31b0dcf 100644
--- a/config_file/parsers/ini_parser.py
+++ b/config_file/parsers/ini_parser.py
@@ -1,9 +1,10 @@
import configparser
from io import StringIO
-from config_file.parsers.base_parser import BaseParser, ParsingError
+from config_file.parsers.base_parser import BaseParser
from config_file.parsers.parse_value import parse_value
from config_file.utils import split_on_dot
+from config_file.exceptions import ParsingError
class IniParser(BaseParser):
@@ -95,7 +96,7 @@ class IniParser(BaseParser):
if "." not in section_key:
if not self.parsed_content.has_section(section_key):
raise ValueError(
- f"Cannot delete {section_key} because it is not in the config file."
+ "Cannot delete {} because it is not in the config file.".format(section_key)
)
self.parsed_content.remove_section(section_key)
@@ -104,7 +105,7 @@ class IniParser(BaseParser):
section, key = split_on_dot(section_key, only_last_dot=True)
if key not in self.parsed_content[section]:
raise ValueError(
- f"Cannot delete {section}.{key} because {key} is not in {section}."
+ "Cannot delete {section}.{key} because {key} is not in {section}.".format(section = section, key = key)
)
self.parsed_content.remove_option(section, key)