Run black reformatter on code

This commit is contained in:
Griatch 2022-02-08 13:03:52 +01:00
parent 4582eb4085
commit bd3e31bf3c
178 changed files with 4511 additions and 3385 deletions

View file

@ -108,8 +108,8 @@ class MonitorHandler(object):
"""
# if this an Attribute with a category we should differentiate
fieldname = self._attr_category_fieldname(
fieldname, obj.db_category
if fieldname == "db_value" and hasattr(obj, "db_category") else None
fieldname,
obj.db_category if fieldname == "db_value" and hasattr(obj, "db_category") else None,
)
to_delete = []
@ -124,8 +124,7 @@ class MonitorHandler(object):
for (obj, fieldname, idstring) in to_delete:
del self.monitors[obj][fieldname][idstring]
def add(self, obj, fieldname, callback, idstring="", persistent=False,
category=None, **kwargs):
def add(self, obj, fieldname, callback, idstring="", persistent=False, category=None, **kwargs):
"""
Add monitoring to a given field or Attribute. A field must
be specified with the full db_* name or it will be assumed

View file

@ -49,10 +49,12 @@ class ScriptHandler(object):
except Exception:
next_repeat = "?"
string += _("\n '{key}' ({next_repeat}/{interval}, {repeats} repeats): {desc}").format(
key=script.key, next_repeat=next_repeat,
key=script.key,
next_repeat=next_repeat,
interval=interval,
repeats=repeats,
desc=script.desc)
desc=script.desc,
)
return string.strip()
def add(self, scriptclass, key=None, autostart=True):

View file

@ -85,5 +85,5 @@ class TestExtendedLoopingCall(TestCase):
loopcall.start(20, now=False, start_delay=10, count_start=1)
loopcall.__call__.assert_not_called()
self.assertEqual(loopcall.interval , 20)
self.assertEqual(loopcall.interval, 20)
loopcall._scheduleFrom.assert_called_with(121)

View file

@ -90,6 +90,7 @@ a text-game, and if you want to update some property, consider doing so
on-demand rather than using a ticker.
"""
class Ticker(object):
"""
Represents a repeatedly running task that calls