Skip to content

Commit

Permalink
Add check for duplicate name in architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner-andrulis committed Apr 5, 2024
1 parent 67fc068 commit e653f85
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions timeloopfe/v4/arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ class ArchNode(Node):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

# Make sure all leaf names are unique
leaves = {}
for l in self.get_nodes_of_type(Leaf):
n = l.name
leaves.setdefault(n, l)
assert l is leaves[n], f"Duplicate name {n} found in architecture"

def name2leaf(self, name: str) -> "Leaf":
"""
Finds a leaf node with the given name.
Expand Down

0 comments on commit e653f85

Please sign in to comment.