Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Pass through linkcls in connect functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-iteng committed Aug 30, 2024
1 parent 7464e3c commit 1b4fa76
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/faebryk/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,33 +321,35 @@ def get_param_tree(param: Parameter) -> list[tuple[Parameter, list]]:


def connect_interfaces_via_chain(
start: ModuleInterface, bridges: Iterable[Node], end: ModuleInterface
start: ModuleInterface, bridges: Iterable[Node], end: ModuleInterface, linkcls=None
):
from faebryk.library.can_bridge import can_bridge

last = start
for bridge in bridges:
last.connect(bridge.get_trait(can_bridge).get_in())
last.connect(bridge.get_trait(can_bridge).get_in(), linkcls=linkcls)
last = bridge.get_trait(can_bridge).get_out()
last.connect(end)
last.connect(end, linkcls=linkcls)


def connect_all_interfaces[MIF: ModuleInterface](interfaces: Iterable[MIF]):
def connect_all_interfaces[MIF: ModuleInterface](
interfaces: Iterable[MIF], linkcls=None
):
interfaces = list(interfaces)
if not interfaces:
return
return connect_to_all_interfaces(interfaces[0], interfaces[1:])
return connect_to_all_interfaces(interfaces[0], interfaces[1:], linkcls=linkcls)
# not needed with current connection implementation
# for i in interfaces:
# for j in interfaces:
# i.connect(j)


def connect_to_all_interfaces[MIF: ModuleInterface](
source: MIF, targets: Iterable[MIF]
source: MIF, targets: Iterable[MIF], linkcls=None
):
for i in targets:
source.connect(i)
source.connect(i, linkcls=linkcls)
return source


Expand Down

0 comments on commit 1b4fa76

Please sign in to comment.