readability improvements

switched from string formatting to f-strings
removed some non-required validation
Standardised some logging outputs
better formatting of config inside tests
This commit is contained in:
Ace
2020-11-29 14:51:19 +01:00
parent 545a6207fb
commit 636172f157
12 changed files with 72 additions and 81 deletions

View File

@@ -44,9 +44,9 @@ class inkycal_module(metaclass=abc.ABCMeta):
self.fontsize = value
else:
setattr(self, key, value)
print("set '{}' to '{}'".format(key,value))
print(f"set '{key}' to '{value}'")
else:
print('{0} does not exist'.format(key))
print(f'{key} does not exist')
pass
# Check if validation has been implemented
@@ -70,12 +70,12 @@ class inkycal_module(metaclass=abc.ABCMeta):
if hasattr(cls, 'requires'):
for each in cls.requires:
if not "label" in cls.requires[each]:
raise Exception("no label found for {}".format(each))
raise Exception(f"no label found for {each}")
if hasattr(cls, 'optional'):
for each in cls.optional:
if not "label" in cls.optional[each]:
raise Exception("no label found for {}".format(each))
raise Exception(f"no label found for {each}")
conf = {
"name": cls.__name__,