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

Sopel 8 preparations #47

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
requests
sopel
sopel>=7.1
pytz
11 changes: 5 additions & 6 deletions sopel_modules/weather/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

import pytz

from sopel.config.types import NO_DEFAULT, ChoiceAttribute, StaticSection, ValidatedAttribute
from sopel.module import commands, example, NOLIMIT
from sopel.modules.units import c_to_f
from sopel.config.types import NO_DEFAULT, BooleanAttribute, ChoiceAttribute, StaticSection, ValidatedAttribute
from sopel.plugin import commands, example, NOLIMIT
from sopel.tools import Identifier
from sopel.tools.time import format_time

Expand Down Expand Up @@ -43,8 +42,8 @@ class WeatherSection(StaticSection):
geocoords_api_key = ValidatedAttribute('geocoords_api_key', str, default='')
weather_provider = ChoiceAttribute('weather_provider', WEATHER_PROVIDERS, default=NO_DEFAULT)
weather_api_key = ValidatedAttribute('weather_api_key', str, default='')
sunrise_sunset = ValidatedAttribute('sunrise_sunset', bool, default=False)
nick_lookup = ValidatedAttribute('nick_lookup', bool, default=True)
sunrise_sunset = BooleanAttribute('sunrise_sunset', default=False)
nick_lookup = BooleanAttribute('nick_lookup', default=True)


def setup(bot):
Expand Down Expand Up @@ -91,7 +90,7 @@ def get_temp(temp):
temp = float(temp)
except (KeyError, TypeError, ValueError):
return 'unknown'
return u'%d\u00B0C (%d\u00B0F)' % (round(temp), round(c_to_f(temp)))
return u'%d\u00B0C (%d\u00B0F)' % (round(temp), round(1.8 * temp + 32))


def get_humidity(humidity):
Expand Down
Loading