From 947b62c9d5aad8bca5451c406ae0945c02d577ae Mon Sep 17 00:00:00 2001 From: Vasilis Gerakaris Date: Thu, 20 Oct 2022 00:09:14 +0300 Subject: [PATCH] Fix floating point format in DDG weather humidity Fixes #1836 --- searx/engines/duckduckgo_weather.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/searx/engines/duckduckgo_weather.py b/searx/engines/duckduckgo_weather.py index d0f34d60f..0540cbcb5 100644 --- a/searx/engines/duckduckgo_weather.py +++ b/searx/engines/duckduckgo_weather.py @@ -39,12 +39,12 @@ def generate_condition_table(condition): res += ( f"{gettext('Wind')}{condition['windBearing']}° — " - f"{'%.2f' % (condition['windSpeed'] * 1.6093440006147)} km/h / {condition['windSpeed']} mph" + f"{(condition['windSpeed'] * 1.6093440006147):.2f} km/h / {condition['windSpeed']} mph" ) res += f"{gettext('Visibility')}{condition['visibility']} km" - res += f"{gettext('Humidity')}{condition['humidity'] * 100}%" + res += f"{gettext('Humidity')}{(condition['humidity'] * 100):.1f}%" return res