Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WireGroup's get_names for different scopes #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions sootty/storage/wiregroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,17 @@ def find(self, name: str):
raise SoottyError(f"Wire '{name}' does not exist.")

def get_names(self):
"""Returns list of all wire names."""
names = set()
for wire in self.wires:
names.add(wire.name)
for group in self.groups:
names.update(group.get_names())
"""Returns a dictionary of all wire names of this wiregroup or a list if this wiregroup is the innermost one."""
if self.groups:
names = dict()
if self.wires:
names[self.name] = list()
for wire in self.wires:
names[self.name].append(wire.name)
for group in self.groups:
names[group.name] = group.get_names()
else:
names = list()
for wire in self.wires:
names.append(wire.name)
return names