From 9bff29c0ce0591e696bae1f2dc605644ce7d48c7 Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sat, 28 Dec 2019 21:13:22 +0100 Subject: [PATCH 01/16] Fix submission error messages --- evalai/utils/submissions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index 8e7aae044..5414873af 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -43,7 +43,7 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): "\nError: {}\n" "\nUse `evalai challenges` to fetch the active challenges.\n" "\nUse `evalai challenge CHALLENGE phases` to fetch the " - "active phases.\n".format(response.json()["error"]), + "active phases.\n".format(err), fg="red", bold=True, ) From 3850da9455172040f31d248f137d99ba9fc08204 Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sat, 28 Dec 2019 21:20:25 +0100 Subject: [PATCH 02/16] fixed build --- evalai/utils/submissions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index 5414873af..8e7aae044 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -43,7 +43,7 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): "\nError: {}\n" "\nUse `evalai challenges` to fetch the active challenges.\n" "\nUse `evalai challenge CHALLENGE phases` to fetch the " - "active phases.\n".format(err), + "active phases.\n".format(response.json()["error"]), fg="red", bold=True, ) From 48e44c864f02de5b860a2959579dd11689282f19 Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sat, 28 Dec 2019 21:44:27 +0100 Subject: [PATCH 03/16] Fixed submission errors --- evalai/utils/submissions.py | 1 - 1 file changed, 1 deletion(-) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index 8e7aae044..296a31ee4 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -34,7 +34,6 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): response = requests.post( url, headers=headers, files=input_file, data=data ) - response.raise_for_status() except requests.exceptions.HTTPError as err: if response.status_code in EVALAI_ERROR_CODES: validate_token(response.json()) From 0ac68d5f0ee39cc070887cbc9bec727df97ba4a0 Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sat, 28 Dec 2019 21:46:56 +0100 Subject: [PATCH 04/16] Fixed submission errors --- evalai/utils/submissions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index 296a31ee4..8e7aae044 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -34,6 +34,7 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): response = requests.post( url, headers=headers, files=input_file, data=data ) + response.raise_for_status() except requests.exceptions.HTTPError as err: if response.status_code in EVALAI_ERROR_CODES: validate_token(response.json()) From b742c96027dee8aaca322d9588076dfc3e1dcba2 Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sat, 28 Dec 2019 21:49:32 +0100 Subject: [PATCH 05/16] Fixed error message --- evalai/utils/submissions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index 8e7aae044..7008f56c9 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -43,7 +43,7 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): "\nError: {}\n" "\nUse `evalai challenges` to fetch the active challenges.\n" "\nUse `evalai challenge CHALLENGE phases` to fetch the " - "active phases.\n".format(response.json()["error"]), + "active phases.\n".format(response.json().get("error"), fg="red", bold=True, ) From 6f4fa91cffefe0e17c3e71ec57aeaf179a207ff2 Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sat, 28 Dec 2019 22:21:33 +0100 Subject: [PATCH 06/16] Fixed submission errors --- evalai/utils/submissions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index 7008f56c9..8e7aae044 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -43,7 +43,7 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): "\nError: {}\n" "\nUse `evalai challenges` to fetch the active challenges.\n" "\nUse `evalai challenge CHALLENGE phases` to fetch the " - "active phases.\n".format(response.json().get("error"), + "active phases.\n".format(response.json()["error"]), fg="red", bold=True, ) From 548c322785bebeaf58cd199cf519201f2ef31d10 Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sun, 29 Dec 2019 11:53:21 +0100 Subject: [PATCH 07/16] fix error message --- evalai/utils/submissions.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index 8e7aae044..90918362c 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -38,16 +38,17 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): except requests.exceptions.HTTPError as err: if response.status_code in EVALAI_ERROR_CODES: validate_token(response.json()) - echo( - style( - "\nError: {}\n" - "\nUse `evalai challenges` to fetch the active challenges.\n" - "\nUse `evalai challenge CHALLENGE phases` to fetch the " - "active phases.\n".format(response.json()["error"]), - fg="red", - bold=True, + if response.json().get("error") in response.json(): + echo( + style( + "\nError: {}\n" + "\nUse `evalai challenges` to fetch the active challenges.\n" + "\nUse `evalai challenge CHALLENGE phases` to fetch the " + "active phases.\n".format(response.json().get("error")), + fg="red", + bold=True, + ) ) - ) else: echo(err) if "input_file" in response.json(): From 32d94f23a3e16b769c69152910b4543cc76a159b Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sun, 29 Dec 2019 11:59:07 +0100 Subject: [PATCH 08/16] fix error message --- evalai/utils/submissions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index 90918362c..a3856388f 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -38,7 +38,7 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): except requests.exceptions.HTTPError as err: if response.status_code in EVALAI_ERROR_CODES: validate_token(response.json()) - if response.json().get("error") in response.json(): + if "error" in response.json(): echo( style( "\nError: {}\n" From 8a267382812b087f7034289b0f931a5d2527d410 Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sun, 29 Dec 2019 12:00:28 +0100 Subject: [PATCH 09/16] fix error message --- evalai/utils/submissions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index a3856388f..ebb4e0666 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -49,6 +49,8 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): bold=True, ) ) + else: + echo(err) else: echo(err) if "input_file" in response.json(): From ef6210954701aa2c4c3e2aaa8bf1f1af2d4bd742 Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sun, 29 Dec 2019 12:11:36 +0100 Subject: [PATCH 10/16] fix error message --- evalai/utils/submissions.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index ebb4e0666..de2e95ca4 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -34,7 +34,6 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): response = requests.post( url, headers=headers, files=input_file, data=data ) - response.raise_for_status() except requests.exceptions.HTTPError as err: if response.status_code in EVALAI_ERROR_CODES: validate_token(response.json()) @@ -49,8 +48,6 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): bold=True, ) ) - else: - echo(err) else: echo(err) if "input_file" in response.json(): From 7fff968f5e762fe93911f90cfc235e765b2a1e5a Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sun, 29 Dec 2019 12:21:06 +0100 Subject: [PATCH 11/16] fix error message --- evalai/utils/submissions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index de2e95ca4..a3856388f 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -34,6 +34,7 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): response = requests.post( url, headers=headers, files=input_file, data=data ) + response.raise_for_status() except requests.exceptions.HTTPError as err: if response.status_code in EVALAI_ERROR_CODES: validate_token(response.json()) From 7deec79fce7fbf47228fb5e8faadff26aea1429a Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sun, 29 Dec 2019 19:48:05 +0100 Subject: [PATCH 12/16] Chamged message --- evalai/utils/submissions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index a3856388f..f5692099e 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -41,7 +41,7 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}): if "error" in response.json(): echo( style( - "\nError: {}\n" + "\nFailed to make submission with error: {}\n" "\nUse `evalai challenges` to fetch the active challenges.\n" "\nUse `evalai challenge CHALLENGE phases` to fetch the " "active phases.\n".format(response.json().get("error")), From a93c0eb3b5ed42a22ee098cbce647d38b6a4d8cd Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sun, 29 Dec 2019 20:01:42 +0100 Subject: [PATCH 13/16] fix build --- tests/test_requests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_requests.py b/tests/test_requests.py index 6baa9101d..1eea4a177 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -436,7 +436,7 @@ def setup(self): json=error_data, status=406, ) - self.expected = "Error: Sorry, the object does not exist." + self.expected = "\nFailed to make submission with error: Sorry, the object does not exist." @responses.activate def test_display_participant_team_for_object_does_not_exist(self): From 06f283d85119a152c176d1cd6c4d90af38400a32 Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sun, 29 Dec 2019 20:05:14 +0100 Subject: [PATCH 14/16] fix build --- tests/test_requests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_requests.py b/tests/test_requests.py index 1eea4a177..f13ab11ed 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -365,7 +365,7 @@ def setup(self): status=406, ) - self.expected = "Error: Sorry, the object does not exist." + self.expected = "\nFailed to make submission with error: {}\n: Sorry, the object does not exist." @responses.activate def test_display_submission_details_for_object_does_not_exist(self): @@ -436,7 +436,7 @@ def setup(self): json=error_data, status=406, ) - self.expected = "\nFailed to make submission with error: Sorry, the object does not exist." + self.expected = "Error: Sorry, the object does not exist." @responses.activate def test_display_participant_team_for_object_does_not_exist(self): From 018d50b49e0135691a3dd3c6d5ea078d5f9830fa Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sun, 29 Dec 2019 20:07:29 +0100 Subject: [PATCH 15/16] Chamged message --- tests/test_requests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_requests.py b/tests/test_requests.py index f13ab11ed..0bf7d2bf4 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -365,7 +365,7 @@ def setup(self): status=406, ) - self.expected = "\nFailed to make submission with error: {}\n: Sorry, the object does not exist." + self.expected = "Error: Sorry, the object does not exist." @responses.activate def test_display_submission_details_for_object_does_not_exist(self): @@ -394,7 +394,7 @@ def test_make_submission_for_object_does_not_exist(self): response = result.output.strip() expected = "Do you want to include the Submission Details? [y/N]: N\n\n{}".format( - self.expected + "\nFailed to make submission with error: {}\n: Sorry, the object does not exist." ) expected = "{}\n\n{}".format( expected, From 2d8063a8354d5f9398108e18924a5cea41167779 Mon Sep 17 00:00:00 2001 From: jayy <35180217+nsjcorps@users.noreply.github.com> Date: Sun, 29 Dec 2019 20:10:06 +0100 Subject: [PATCH 16/16] fix build --- tests/test_requests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_requests.py b/tests/test_requests.py index 0bf7d2bf4..b3b3771dc 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -394,7 +394,7 @@ def test_make_submission_for_object_does_not_exist(self): response = result.output.strip() expected = "Do you want to include the Submission Details? [y/N]: N\n\n{}".format( - "\nFailed to make submission with error: {}\n: Sorry, the object does not exist." + "Failed to make submission with error: Sorry, the object does not exist." ) expected = "{}\n\n{}".format( expected,