Closed gilesknap closed 2 years ago
Resolved.
By declaring _devices as a Classvar
_devices: ClassVar[Dict[str, SwitchDevice]] = {}
We avoid it being in the schema.
This makes MaasConfig a singleton which is OK for our use of it. But not ideal since there is no checks on this and the tests will create multiple instances.
This is a pedantic issue to make the code look neater.
_devices cannot be declared in the dataclass MaasConfig or it corrupts the schema - hence all the lint ignore directives in function find_device.
Possible solutions: