WIP: feature/cleanup_programming_interface #40

Draft
Hazel wants to merge 35 commits from feature/cleanup_programming_interface into experimental
Showing only changes of commit 684c90a7b4 - Show all commits

View File

@ -177,7 +177,7 @@ class Node(Generator[P]):
):
self.value = value
self.depth = 0
self.same_level_index: int = 0
self.index: int = 0
self.children: List[Node[P]] = kwargs.get("children", [])
@ -196,7 +196,7 @@ class Node(Generator[P]):
def __iter__(self, **kwargs) -> Generator[Node[P], None, None]:
_level_index_map: Dict[int, int] = kwargs.get("level_index_map", defaultdict(lambda: 0))
self.same_level_index = _level_index_map[self.depth]
self.index = _level_index_map[self.depth]
yield self
_level_index_map[self.depth] += 1