feat: add automation context implementation

This commit is contained in:
Gergő Jedlicska
2023-09-18 13:31:53 +02:00
parent 7d7d6666d0
commit 08c189d247
10 changed files with 1230 additions and 435 deletions
+5 -1
View File
@@ -1,8 +1,12 @@
from typing import Iterable
"""Helper module for a simple speckle object tree flattening."""
from collections.abc import Iterable
from specklepy.objects import Base
def flatten_base(base: Base) -> Iterable[Base]:
"""Take a base and flatten it to an iterable of bases."""
if hasattr(base, "elements"):
for element in base["elements"]:
yield from flatten_base(element)