Do not expose child modules on parent devices (#964)

Removes the logic to expose child modules on parent devices,
which could cause complications with downstream consumers unknowingly duplicating things.
This commit is contained in:
Steven B
2024-06-10 05:59:37 +01:00
committed by GitHub
parent b094e334ca
commit fe0bbf1b98
6 changed files with 34 additions and 38 deletions

View File

@@ -434,3 +434,16 @@ async def dev(request) -> AsyncGenerator[Device, None]:
yield dev
await dev.disconnect()
def get_parent_and_child_modules(device: Device, module_name):
"""Return iterator of module if exists on parent and children.
Useful for testing devices that have components listed on the parent that are only
supported on the children, i.e. ks240.
"""
if module_name in device.modules:
yield device.modules[module_name]
for child in device.children:
if module_name in child.modules:
yield child.modules[module_name]