ClassFinder:
Removed exclude argument, which is basically covered with
obj.__module__ == module.__name__ which ensures that no imported
classes are found, which was the only use case for exclude.
This didn't change the public "API" used by modules.
.core.io contains the IO classes, namely IOHandler, StandaloneIO and JSONIO
.core.util contains SettingsBase and ClassFinder
.core.exceptions contains all custom exceptions
This is 100pct. the same functionality as a complete module before :-)
But still, have to come up with some better way to manage these "templates".
And a place to stash them.
So I can have my old representation back... indeed you can
do pretty much anything now with it:
status.register(battery,
format="{consumption:.2f}W {percentage:.2f}% [{percentage_design:.2f}%] {remaining_hm}"
)
Mail checkers are not separate modules anymore; there is only one
mail checker module (called mail) that can make use of various backends
, which were formerly modules on their own.
This greatly simplifies code and reduces redundance.
This commit only contains the base classes for this.
You can now pass a module (the Python thing, e.g. modsde) into register
and it will just "do the right thing" (find a class derived from Module
in that module and instanciate it with any extra arguments)
Btw. nothing has changed for the config files. You can pass into
__init__ a dict as before, or you can use keyword arguments.
Either way, a module defines the settings that can be specified
and those which are required. __init__ basically checks that all
required options are set and that no invalid options are used.