From aa44fe7a60a4f3326cc47877b3e246b56d46d6ac Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Jun 2020 13:41:35 -0500 Subject: 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. --- config_file/exceptions.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 config_file/exceptions.py (limited to 'config_file/exceptions.py') diff --git a/config_file/exceptions.py b/config_file/exceptions.py new file mode 100644 index 0000000..cd7e236 --- /dev/null +++ b/config_file/exceptions.py @@ -0,0 +1,6 @@ +class ConfigFileError(Exception): + """A generic error from the package.""" + +class ParsingError(ConfigFileError): + """Unable to parse the configuration file.""" + \ No newline at end of file -- cgit v1.2.3 From b3fb6aae1201faca1238b3c79e5e95ba57282bf1 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Jun 2020 15:35:05 -0500 Subject: Add more type hints to ConfigFile and lint all files --- config_file/exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config_file/exceptions.py') diff --git a/config_file/exceptions.py b/config_file/exceptions.py index cd7e236..e1af755 100644 --- a/config_file/exceptions.py +++ b/config_file/exceptions.py @@ -1,6 +1,6 @@ class ConfigFileError(Exception): """A generic error from the package.""" + class ParsingError(ConfigFileError): """Unable to parse the configuration file.""" - \ No newline at end of file -- cgit v1.2.3 From 6eab76b24dfc831b8c41c445d98175c3276b20a5 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sun, 19 Jul 2020 20:28:40 -0500 Subject: Add UnrecognizedFileError and MissingDependencyError --- config_file/exceptions.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'config_file/exceptions.py') diff --git a/config_file/exceptions.py b/config_file/exceptions.py index e1af755..03ef052 100644 --- a/config_file/exceptions.py +++ b/config_file/exceptions.py @@ -4,3 +4,16 @@ class ConfigFileError(Exception): class ParsingError(ConfigFileError): """Unable to parse the configuration file.""" + + +class MissingDependencyError(ConfigFileError): + """ + PyYaml or toml is not installed, but the parsers + for them were attempted to be used. + """ + + +class UnrecognizedFileError(ConfigFileError): + """ + A missing file extension or a file type not supported. + """ -- cgit v1.2.3 From 92593a3895c8e045e059d6371027aa99e39a153f Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Mon, 20 Jul 2020 22:53:38 -0500 Subject: Add MissingKeyError --- config_file/exceptions.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'config_file/exceptions.py') diff --git a/config_file/exceptions.py b/config_file/exceptions.py index 03ef052..d11e373 100644 --- a/config_file/exceptions.py +++ b/config_file/exceptions.py @@ -2,10 +2,6 @@ class ConfigFileError(Exception): """A generic error from the package.""" -class ParsingError(ConfigFileError): - """Unable to parse the configuration file.""" - - class MissingDependencyError(ConfigFileError): """ PyYaml or toml is not installed, but the parsers @@ -17,3 +13,14 @@ class UnrecognizedFileError(ConfigFileError): """ A missing file extension or a file type not supported. """ + + +class ParsingError(ConfigFileError): + """Unable to parse the configuration file.""" + + +class MissingKeyError(ParsingError): + """ + A key that was specified (to retrieve, delete, etc.) + is not in the file. + """ -- cgit v1.2.3 From 3700e247d5b72f21c20c554c7f2a72d6c63b8eea Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Thu, 30 Jul 2020 20:34:27 -0500 Subject: Fix wording of docstring in missing dependency error --- config_file/exceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'config_file/exceptions.py') diff --git a/config_file/exceptions.py b/config_file/exceptions.py index d11e373..d1b466b 100644 --- a/config_file/exceptions.py +++ b/config_file/exceptions.py @@ -4,8 +4,8 @@ class ConfigFileError(Exception): class MissingDependencyError(ConfigFileError): """ - PyYaml or toml is not installed, but the parsers - for them were attempted to be used. + yaml or toml dependencies were not installed, + but the parsers for them were attempted to be used. """ -- cgit v1.2.3 From 59eeb1321fbad41dce7c971778e37ac1943fda3b Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Wed, 5 Aug 2020 20:39:28 -0500 Subject: Redo package to have a flat package structure By having a flat package structure like this, it'll avoid exposing packages and things we don't want to be exposed. --- config_file/exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config_file/exceptions.py') diff --git a/config_file/exceptions.py b/config_file/exceptions.py index d1b466b..22ee70c 100644 --- a/config_file/exceptions.py +++ b/config_file/exceptions.py @@ -9,7 +9,7 @@ class MissingDependencyError(ConfigFileError): """ -class UnrecognizedFileError(ConfigFileError): +class UnsupportedFileTypeError(ConfigFileError): """ A missing file extension or a file type not supported. """ -- cgit v1.2.3 From 19d23dc13636b30f6282e8b3f02b659bcdb2bb11 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Wed, 5 Aug 2020 21:48:08 -0500 Subject: Remove MissingDependencyError in favor of ImportError --- config_file/exceptions.py | 7 ------- 1 file changed, 7 deletions(-) (limited to 'config_file/exceptions.py') 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. -- cgit v1.2.3 From 08a0725f7d4c34ef073110c30117ae520d081a01 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Fri, 7 Aug 2020 08:50:06 -0500 Subject: Remove all custom exceptions except ParsingError --- config_file/exceptions.py | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'config_file/exceptions.py') diff --git a/config_file/exceptions.py b/config_file/exceptions.py index a8b8e5c..f68b7e8 100644 --- a/config_file/exceptions.py +++ b/config_file/exceptions.py @@ -1,19 +1,9 @@ -class ConfigFileError(Exception): - """A generic error from the package.""" - - -class UnsupportedFileTypeError(ConfigFileError): +class ParsingError(ValueError): """ - A missing file extension or a file type not supported. - """ - + Unable to parse the configuration file. -class ParsingError(ConfigFileError): - """Unable to parse the configuration file.""" - - -class MissingKeyError(ParsingError): - """ - A key that was specified (to retrieve, delete, etc.) - is not in the file. + Since every module that parses the different + files has it's own decode error, this standardizes + it for the package to only raise a ParsingError + if a error occurs in those instances. """ -- cgit v1.2.3