diff --git a/main.py b/main.py index fcb0b12..cb3a6c8 100755 --- a/main.py +++ b/main.py @@ -62,11 +62,11 @@ def display_full(data): ) wind_speed = infos["data"]["instant"]["details"]["wind_speed"] - + wind_direction = diplay_wind_direction( infos["data"]["instant"]["details"]["wind_from_direction"] ) - + cur_humidity = infos["data"]["instant"]["details"]["relative_humidity"] print(f" {time} : {temperature}° / {cur_humidity}% / {wind_direction} {wind_speed} m/s") @@ -74,49 +74,49 @@ def display_full(data): def diplay_wind_direction(degrees: float) -> str: """ Retourne une fleche indicant la direction du vent""" if 22.5 <= degrees < 67.5: - return '↗' - - if 67.5 <= degrees < 112.5: - return '→' - - if 112.5 <= degrees < 157.5: - return '↘' - - if 157.5 <= degrees < 202.5: - return '↓' - - if 202.5 <= degrees < 247.5: return '↙' - if 247.5 <= degrees < 292.5: + if 67.5 <= degrees < 112.5: return '←' - - if 292.5 <= degrees < 337.5: + + if 112.5 <= degrees < 157.5: return '↖' - return '↑' + if 157.5 <= degrees < 202.5: + return '↑' + + if 202.5 <= degrees < 247.5: + return '↗' + + if 247.5 <= degrees < 292.5: + return '→' + + if 292.5 <= degrees < 337.5: + return '↘' + + return '↓' def coloring_temperature(temperature: float) -> str: - """ A partir de la température retourne une chaine de caractères colorisée """ + """ A partir de la température retourne une chaine de caractères colorisée """ if temperature >= 40.0: return fg.magenta + str(temperature) + fg.rs - + if temperature >= 30.0: return fg.red + str(temperature) + fg.rs - + if temperature >= 25.0: return fg(255, 150, 50) + str(temperature) + fg.rs - + if temperature >= 20.0: return fg.yellow + str(temperature) + fg.rs - + if temperature >= 10.0: return str(temperature) - + if temperature >= 0.0: return fg.cyan + str(temperature) + fg.rs - + return fg.blue + str(cur_temp) + fg.rs @@ -125,7 +125,7 @@ def main(): args = load_args() config_file = Path(args["config"]) - + if not config_file.is_file(): print(f"{config_file} n'est pas un fichier.") os._exit(1)