From 3f874d1ba218a82ac354af748be73bbbf6e0d985 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Mon, 21 Dec 2020 22:31:42 -0600 Subject: Remove depreciated stringify() method --- config_file/config_file.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'config_file/config_file.py') 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)) -- cgit v1.2.3