Ran publicip.py through black

This commit is contained in:
Tom Watson 2022-07-07 18:38:43 +07:00
parent 9a6e61173f
commit 284662a0ba

View file

@ -42,7 +42,7 @@ def update_publicip_information(module):
widget = module.widget()
__previous_default_route = None
__current_default_route = None
__interval = 5 # Interval between default route change checks
__interval = 5 # Interval between default route change checks
while True:
__current_default_route = netifaces.gateways()["default"][2]
@ -76,6 +76,7 @@ def update_publicip_information(module):
# Wait __interval seconds before checking for default route changes again
time.sleep(__interval)
class Module(core.module.Module):
@core.decorators.every(minutes=60)
def __init__(self, config, theme):
@ -91,12 +92,12 @@ class Module(core.module.Module):
def publicip(self, widget):
return self._format.format(
ip = widget.get("public_ip", "-"),
country_name = widget.get("country_name", "-"),
country_code = widget.get("country_code", "-"),
city_name = widget.get("city_name", "-"),
coordinates = widget.get("coordinates", "-")
)
ip=widget.get("public_ip", "-"),
country_name=widget.get("country_name", "-"),
country_code=widget.get("country_code", "-"),
city_name=widget.get("city_name", "-"),
coordinates=widget.get("coordinates", "-"),
)
def __click_update(self, event):
util.location.reset()
@ -104,7 +105,9 @@ class Module(core.module.Module):
def update(self):
if self.__thread is not None and self.__thread.is_alive():
return
self.__thread = threading.Thread(target=update_publicip_information, args=(self,))
self.__thread = threading.Thread(
target=update_publicip_information, args=(self,)
)
self.__thread.start()
def state(self, widget):