aboutsummaryrefslogtreecommitdiffstats
path: root/config_file/config_file.py
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-12-21 22:31:42 -0600
committerEugene Triguba <eugenetriguba@gmail.com>2023-11-05 15:31:22 -0500
commit3f874d1ba218a82ac354af748be73bbbf6e0d985 (patch)
tree132cf9a69e7e4f725ad9366424791e24b0ea7a84 /config_file/config_file.py
parentFix readme badge (diff)
downloadconfig-file-3f874d1ba218a82ac354af748be73bbbf6e0d985.zip
Remove depreciated stringify() method
Diffstat (limited to 'config_file/config_file.py')
-rw-r--r--config_file/config_file.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/config_file/config_file.py b/config_file/config_file.py
index f4979bb..079c903 100644
--- a/config_file/config_file.py
+++ b/config_file/config_file.py
@@ -47,10 +47,10 @@ class ConfigFile:
return self.has(key)
def __str__(self) -> str:
- return self.stringify()
+ return str(self.__parser)
def __repr__(self) -> str:
- return f"{self.path}\n\n{self.stringify()}"
+ return f"{self.path}\n\n{str(self.__parser)}"
def get(
self,
@@ -85,7 +85,7 @@ class ConfigFile:
key_value = self.__parser.get(key)
except KeyError as error:
if isinstance(default, Default) and default.value is None:
- raise KeyError(error)
+ raise error
else:
key_value = default
@@ -125,18 +125,6 @@ class ConfigFile:
"""
self.__parser.delete(key)
- def stringify(self) -> str:
- """Retrieves file contents as a string.
-
- Returns:
- The internal representation of the file
- that has been read in converted to a string.
-
- Depreciated:
- Use str() on the ConfigFile object instead.
- """
- return self.__parser.stringify()
-
def has(self, key: str, wild: bool = False) -> bool:
"""
Check if a section, sub-section, or key exists.
@@ -198,4 +186,4 @@ class ConfigFile:
object's constructor.
"""
with open(str(self.__path), "w") as config_file:
- config_file.write(self.stringify())
+ config_file.write(str(self))