Autocomplete, Fediverse, Geography, Poll: Run Black

This commit is contained in:
Valentin Lorentz 2022-07-20 17:52:40 +02:00
parent 5d8f59bf80
commit d67fb2a8b2
6 changed files with 13 additions and 9 deletions

View File

@ -61,6 +61,7 @@ from . import config
from . import plugin
from importlib import reload
# In case we're being reloaded.
reload(config)
reload(plugin)

View File

@ -53,6 +53,7 @@ from . import config
from . import plugin
from importlib import reload
# In case we're being reloaded.
reload(config)
reload(plugin)

View File

@ -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

View File

@ -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):

View File

@ -137,7 +137,9 @@ def timezone_from_uri(location_uri):
"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:

View File

@ -53,6 +53,7 @@ from . import config
from . import plugin
from importlib import reload
# In case we're being reloaded.
reload(config)
reload(plugin)