Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPDATED: Make Output Color Across The CLI Messages Consistent According To Convention #228

Merged
merged 17 commits into from
Dec 27, 2019
1 change: 1 addition & 0 deletions evalai/add_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ def set_token(auth_token):
LEN_OF_TOKEN
),
bold=True,
fg="red"
)
)
2 changes: 1 addition & 1 deletion evalai/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def create(team):
while not (
validators.url(team_url) or validators.domain(team_url)
):
echo("Sorry, please enter a valid link.")
echo(style("Sorry, please enter a valid link.", bold=True, fg="red"))
team_url = click.prompt("Team URL", type=str)

is_host = team == "host"
Expand Down
4 changes: 2 additions & 2 deletions evalai/utils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_user_auth_token():
try:
data = TokenObj.read()
except (OSError, IOError) as e:
echo(e)
echo(style(e, bold=True, fg="red"))
data = json.loads(data)
token = data["token"]
return token
Expand Down Expand Up @@ -97,4 +97,4 @@ def get_host_url():
data = fr.read()
return str(data)
except (OSError, IOError) as e:
echo(e)
echo(style(e, bold=True, fg="red"))
14 changes: 7 additions & 7 deletions evalai/utils/challenges.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def display_challenges(url):
if len(challenges) != 0:
pretty_print_challenge_data(challenges)
else:
echo("Sorry, no challenges found.")
echo(style("Sorry, no challenges found.", bold=True, fg="red"))


def display_all_challenge_list():
Expand Down Expand Up @@ -146,7 +146,7 @@ def display_ongoing_challenge_list():
if len(challenges) != 0:
pretty_print_challenge_data(challenges)
else:
echo("Sorry, no challenges found.")
echo(style("Sorry, no challenges found.", bold=True, fg="red"))


def display_future_challenge_list():
Expand Down Expand Up @@ -241,7 +241,7 @@ def display_participated_or_hosted_challenges(
if len(challenges) != 0:
pretty_print_challenge_data(challenges)
else:
echo("Sorry, no challenges found.")
echo(style("Sorry, no challenges found.", bold=True, fg="red"))

if is_participant:
team_url = "{}{}".format(get_host_url(), URLS.participant_teams.value)
Expand Down Expand Up @@ -272,9 +272,9 @@ def display_participated_or_hosted_challenges(
echo(style("\nParticipated Challenges\n", bold=True))
pretty_print_challenge_data(challenges)
else:
echo("Sorry, no challenges found.")
echo(style("Sorry, no challenges found.", bold=True, fg="red"))
else:
echo("Sorry, no challenges found.")
echo(style("Sorry, no challenges found.", bold=True, fg="red"))


def pretty_print_challenge_details(challenge):
Expand Down Expand Up @@ -600,7 +600,7 @@ def display_challenge_phase_split_list(challenge_id):
if len(phase_splits) != 0:
pretty_print_challenge_phase_split_data(phase_splits)
else:
echo("Sorry, no Challenge Phase Splits found.")
echo(style("Sorry, no Challenge Phase Splits found.", bold=True, fg="red"))


def pretty_print_leaderboard_data(attributes, results):
Expand Down Expand Up @@ -666,4 +666,4 @@ def display_leaderboard(challenge_id, phase_split_id):
attributes = results[0]["leaderboard__schema"]["labels"]
pretty_print_leaderboard_data(attributes, results)
else:
echo("Sorry, no Leaderboard results found.")
echo(style("Sorry, no Leaderboard results found.", bold=True, fg="red"))
1 change: 1 addition & 0 deletions evalai/utils/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def make_request(path, method, files=None, data=None):
response.get("id")
),
bold=True,
fg="white"
)
)
return response
Expand Down
6 changes: 4 additions & 2 deletions evalai/utils/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}):
response["id"]
),
bold=True,
fg="white"
)
)

Expand All @@ -103,6 +104,7 @@ def pretty_print_my_submissions_data(submissions, start_date, end_date):
style(
"\nSorry, you have not made any submissions to this challenge phase.\n",
bold=True,
fg="red"
)
)
sys.exit(1)
Expand Down Expand Up @@ -132,6 +134,7 @@ def pretty_print_my_submissions_data(submissions, start_date, end_date):
style(
"\nSorry, no submissions were made during this time period.\n",
bold=True,
fg="red"
)
)
sys.exit(1)
Expand Down Expand Up @@ -273,15 +276,14 @@ def display_submission_result(submission_id):
style(
"\nThe Submission is yet to be evaluated.\n",
bold=True,
fg="yellow",
fg="red",
)
)


def convert_bytes_to(byte, to, bsize=1024):
"""
Convert bytes to KB, MB, GB etc.

Arguments:
bytes {int} -- The bytes which is to be converted
to {str} -- To which unit it is to be converted
Expand Down
2 changes: 1 addition & 1 deletion evalai/utils/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def display_teams(is_host):
if len(teams) != 0:
pretty_print_team_data(teams, is_host)
else:
echo("Sorry, no teams found.")
echo(style("Sorry, no teams found.", bold=True, fg="red"))


def create_team(team_name, team_url, is_host):
Expand Down