[formatting] reformat using "black -t py34"
getting rid of thinking about consistent formatting...
This commit is contained in:
parent
fa98bcbdd1
commit
30c1f712a6
119 changed files with 3961 additions and 3495 deletions
|
@ -23,13 +23,14 @@ import core.decorators
|
|||
|
||||
import util.location
|
||||
|
||||
|
||||
class Module(core.module.Module):
|
||||
@core.decorators.every(hours=1)
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.suntimes))
|
||||
|
||||
lat = self.parameter('lat', None)
|
||||
lon = self.parameter('lon', None)
|
||||
lat = self.parameter("lat", None)
|
||||
lon = self.parameter("lon", None)
|
||||
self.__sun = None
|
||||
|
||||
if not lat or not lon:
|
||||
|
@ -40,12 +41,13 @@ class Module(core.module.Module):
|
|||
def suntimes(self, _):
|
||||
if self.__sunset and self.__sunrise:
|
||||
if self.__isup:
|
||||
return u'\u21A7{} \u21A5{}'.format(
|
||||
self.__sunset.strftime('%H:%M'),
|
||||
self.__sunrise.strftime('%H:%M'))
|
||||
return u'\u21A5{} \u21A7{}'.format(self.__sunrise.strftime('%H:%M'),
|
||||
self.__sunset.strftime('%H:%M'))
|
||||
return 'n/a'
|
||||
return "\u21A7{} \u21A5{}".format(
|
||||
self.__sunset.strftime("%H:%M"), self.__sunrise.strftime("%H:%M")
|
||||
)
|
||||
return "\u21A5{} \u21A7{}".format(
|
||||
self.__sunrise.strftime("%H:%M"), self.__sunset.strftime("%H:%M")
|
||||
)
|
||||
return "n/a"
|
||||
|
||||
def __calculate_times(self):
|
||||
self.__isup = False
|
||||
|
@ -55,13 +57,13 @@ class Module(core.module.Module):
|
|||
try:
|
||||
self.__sunrise = self.__sun.get_local_sunrise_time()
|
||||
except SunTimeException:
|
||||
self.__sunrise = 'no sunrise'
|
||||
self.__sunrise = "no sunrise"
|
||||
order_matters = False
|
||||
|
||||
try:
|
||||
self.__sunset = self.__sun.get_local_sunset_time()
|
||||
except SunTimeException:
|
||||
self.__sunset = 'no sunset'
|
||||
self.__sunset = "no sunset"
|
||||
order_matters = False
|
||||
|
||||
if not order_matters:
|
||||
|
@ -74,19 +76,20 @@ class Module(core.module.Module):
|
|||
self.__sunrise = self.__sun.get_local_sunrise_time(tomorrow)
|
||||
self.__sunset = self.__sun.get_local_sunset_time(tomorrow)
|
||||
except SunTimeException:
|
||||
self.__sunrise = 'no sunrise'
|
||||
self.__sunset = 'no sunset'
|
||||
self.__sunrise = "no sunrise"
|
||||
self.__sunset = "no sunset"
|
||||
|
||||
elif now > self.__sunrise:
|
||||
tomorrow = (now + datetime.timedelta(days=1)).date()
|
||||
try:
|
||||
self.__sunrise = self.__sun.get_local_sunrise_time(tomorrow)
|
||||
except SunTimeException:
|
||||
self.__sunrise = 'no sunrise'
|
||||
self.__sunrise = "no sunrise"
|
||||
return
|
||||
self.__isup = True
|
||||
|
||||
def update(self):
|
||||
self.__calculate_times()
|
||||
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue