mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-22 18:39:31 +01:00
Autocomplete, Fediverse, Geography, Poll: Run Black
This commit is contained in:
parent
5d8f59bf80
commit
d67fb2a8b2
@ -61,6 +61,7 @@ from . import config
|
||||
from . import plugin
|
||||
|
||||
from importlib import reload
|
||||
|
||||
# In case we're being reloaded.
|
||||
reload(config)
|
||||
reload(plugin)
|
||||
|
@ -53,6 +53,7 @@ from . import config
|
||||
from . import plugin
|
||||
|
||||
from importlib import reload
|
||||
|
||||
# In case we're being reloaded.
|
||||
reload(config)
|
||||
reload(plugin)
|
||||
|
@ -150,7 +150,8 @@ class Geography(callbacks.Plugin):
|
||||
continue
|
||||
|
||||
offset_seconds = int(
|
||||
datetime.datetime.now(tz=timezone).utcoffset().total_seconds())
|
||||
datetime.datetime.now(tz=timezone).utcoffset().total_seconds()
|
||||
)
|
||||
offset = self._format_utc_offset(offset_seconds)
|
||||
|
||||
# Extract a human-friendly name, depending on the type of
|
||||
|
@ -83,7 +83,7 @@ class GeographyTimezoneTestCase(PluginTestCase):
|
||||
with patch.object(wikidata, "timezone_from_uri", return_value=tz):
|
||||
self.assertRegexp(
|
||||
"timezone Newfoundland",
|
||||
r"Canada/Newfoundland \(currently UTC-[23]:30\)"
|
||||
r"Canada/Newfoundland \(currently UTC-[23]:30\)",
|
||||
)
|
||||
|
||||
tz = pytz.timezone("Asia/Kolkata")
|
||||
@ -111,7 +111,7 @@ class GeographyTimezoneTestCase(PluginTestCase):
|
||||
with patch.object(wikidata, "timezone_from_uri", return_value=tz):
|
||||
self.assertRegexp(
|
||||
"timezone Newfoundland",
|
||||
r"Canada/Newfoundland \(currently UTC-[23]:30\)"
|
||||
r"Canada/Newfoundland \(currently UTC-[23]:30\)",
|
||||
)
|
||||
|
||||
tz = zoneinfo.ZoneInfo("Asia/Kolkata")
|
||||
@ -144,9 +144,7 @@ class GeographyTimezoneTestCase(PluginTestCase):
|
||||
self.assertRegexp(
|
||||
"timezone Delhi", r"Asia/Kolkata \(currently UTC\+5:30\)"
|
||||
)
|
||||
self.assertRegexp(
|
||||
"timezone Newfoundland", r"UTC-[23]:30"
|
||||
)
|
||||
self.assertRegexp("timezone Newfoundland", r"UTC-[23]:30")
|
||||
|
||||
|
||||
class GeographyLocaltimeTestCase(PluginTestCase):
|
||||
|
@ -134,10 +134,12 @@ def timezone_from_uri(location_uri):
|
||||
"""Returns a :class:datetime.tzinfo object, given a Wikidata Q-ID.
|
||||
eg. ``"Q60"`` for New York City."""
|
||||
for tztype in [
|
||||
"http://www.wikidata.org/entity/Q17272692", # IANA timezones first
|
||||
"http://www.wikidata.org/entity/Q12143", # any timezone as a fallback
|
||||
"http://www.wikidata.org/entity/Q17272692", # IANA timezones first
|
||||
"http://www.wikidata.org/entity/Q12143", # any timezone as a fallback
|
||||
]:
|
||||
data = _query_sparql(TIMEZONE_QUERY.substitute(subject=location_uri, tztype=tztype))
|
||||
data = _query_sparql(
|
||||
TIMEZONE_QUERY.substitute(subject=location_uri, tztype=tztype)
|
||||
)
|
||||
results = data["results"]["bindings"]
|
||||
for result in results:
|
||||
if "tzid" in result:
|
||||
|
@ -53,6 +53,7 @@ from . import config
|
||||
from . import plugin
|
||||
|
||||
from importlib import reload
|
||||
|
||||
# In case we're being reloaded.
|
||||
reload(config)
|
||||
reload(plugin)
|
||||
|
Loading…
Reference in New Issue
Block a user