From b7062ddd6a2312f8aa87da664249a60ad18fffc5 Mon Sep 17 00:00:00 2001 From: rhijjawi <18570300+rhijjawi@users.noreply.github.com> Date: Mon, 19 Jul 2021 01:11:43 -0700 Subject: [PATCH 1/4] Update core.py --- PyDictionary/core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/PyDictionary/core.py b/PyDictionary/core.py index 1eb7298..5265f22 100644 --- a/PyDictionary/core.py +++ b/PyDictionary/core.py @@ -136,6 +136,7 @@ def meaning(term, disable_errors=False): except Exception as e: if disable_errors == False: print("Error: The Following Error occured: %s" % e) + raise e if __name__ == '__main__': d = PyDictionary('honest','happy') From e944aca5f9391a7f11018573568a28e7c6e456fd Mon Sep 17 00:00:00 2001 From: rhijjawi <18570300+rhijjawi@users.noreply.github.com> Date: Mon, 19 Jul 2021 01:17:18 -0700 Subject: [PATCH 2/4] Update core.py --- PyDictionary/core.py | 1 - 1 file changed, 1 deletion(-) diff --git a/PyDictionary/core.py b/PyDictionary/core.py index 5265f22..6a69d28 100644 --- a/PyDictionary/core.py +++ b/PyDictionary/core.py @@ -135,7 +135,6 @@ def meaning(term, disable_errors=False): return out except Exception as e: if disable_errors == False: - print("Error: The Following Error occured: %s" % e) raise e if __name__ == '__main__': From 64f4249bdf2b3d8faad1a1f7abfd65c40ae1fa69 Mon Sep 17 00:00:00 2001 From: rhijjawi <18570300+rhijjawi@users.noreply.github.com> Date: Fri, 30 Jul 2021 02:08:18 +0300 Subject: [PATCH 3/4] Update core.py --- PyDictionary/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PyDictionary/core.py b/PyDictionary/core.py index 6a69d28..8171bad 100644 --- a/PyDictionary/core.py +++ b/PyDictionary/core.py @@ -60,7 +60,7 @@ def translate(self, term, language): word = gs.translate(term, language) return word except: - print("Invalid Word") + raise InvalidWord def getSynonyms(self, formatted=True): return [self.synonym(term, formatted) for term in self.args] @@ -97,7 +97,7 @@ def synonym(term, formatted=False): @staticmethod def antonym(term, formatted=False): if len(term.split()) > 1: - print("Error: A Term must be only a single word") + raise TooManyWords else: try: data = _get_soup_object("https://www.synonym.com/synonyms/{0}".format(term)) @@ -108,12 +108,12 @@ def antonym(term, formatted=False): return {term: antonyms} return antonyms except: - print("{0} has no Antonyms in the API".format(term)) + raise NoResults @staticmethod def meaning(term, disable_errors=False): if len(term.split()) > 1: - print("Error: A Term must be only a single word") + raise TooManyWords else: try: html = _get_soup_object("http://wordnetweb.princeton.edu/perl/webwn?s={0}".format( From e37030ced2304772b2f6fdaea76c690005b90fc8 Mon Sep 17 00:00:00 2001 From: rhijjawi <18570300+rhijjawi@users.noreply.github.com> Date: Tue, 14 Sep 2021 21:48:29 +0300 Subject: [PATCH 4/4] Update core.py --- PyDictionary/core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PyDictionary/core.py b/PyDictionary/core.py index 8171bad..e682fee 100644 --- a/PyDictionary/core.py +++ b/PyDictionary/core.py @@ -54,6 +54,7 @@ def translateTo(self, language): def translate(self, term, language): if len(term.split()) > 1: print("Error: A Term must be only a single word") + raise OneWordOnly else: try: gs = goslate.Goslate() @@ -80,7 +81,7 @@ def getAntonyms(self, formatted=True): @staticmethod def synonym(term, formatted=False): if len(term.split()) > 1: - print("Error: A Term must be only a single word") + raise OneWordOnly else: try: data = _get_soup_object("https://www.synonym.com/synonyms/{0}".format(term)) @@ -91,7 +92,7 @@ def synonym(term, formatted=False): return {term: synonyms} return synonyms except: - print("{0} has no Synonyms in the API".format(term)) + raise NoSynonyms @staticmethod