mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Allow deriving from SmartModule without being registered (#1189)
This commit is contained in:
parent
a88b677776
commit
51958d8078
@ -76,9 +76,11 @@ class SmartModule(Module):
|
||||
self._error_count = 0
|
||||
|
||||
def __init_subclass__(cls, **kwargs):
|
||||
name = getattr(cls, "NAME", cls.__name__)
|
||||
_LOGGER.debug("Registering %s", cls)
|
||||
cls.REGISTERED_MODULES[name] = cls
|
||||
# We only want to register submodules in a modules package so that
|
||||
# other classes can inherit from smartmodule and not be registered
|
||||
if cls.__module__.split(".")[-2] == "modules":
|
||||
_LOGGER.debug("Registering %s", cls)
|
||||
cls.REGISTERED_MODULES[cls.__name__] = cls
|
||||
|
||||
def _set_error(self, err: Exception | None):
|
||||
if err is None:
|
||||
|
Loading…
Reference in New Issue
Block a user