path_into should use destination port's ptype by default

This commit is contained in:
Jan Petykiewicz 2024-06-03 16:26:12 -07:00
parent b33c632569
commit 70a51ed8ef

View File

@ -437,7 +437,7 @@ class Pather(Builder):
portspec_dst: str, portspec_dst: str,
*, *,
tool_port_names: tuple[str, str] = ('A', 'B'), tool_port_names: tuple[str, str] = ('A', 'B'),
out_ptype: str = 'unk', out_ptype: str | None = None,
plug_destination: bool = True, plug_destination: bool = True,
**kwargs, **kwargs,
) -> Self: ) -> Self:
@ -448,6 +448,9 @@ class Pather(Builder):
port_src = self.pattern[portspec_src] port_src = self.pattern[portspec_src]
port_dst = self.pattern[portspec_dst] port_dst = self.pattern[portspec_dst]
if out_ptype is None:
out_ptype = port_dst.ptype
if port_src.rotation is None: if port_src.rotation is None:
raise PortError(f'Port {portspec_src} has no rotation and cannot be used for path_into()') raise PortError(f'Port {portspec_src} has no rotation and cannot be used for path_into()')
if port_dst.rotation is None: if port_dst.rotation is None: