fixup! [PortPather] generalize to multi-port functions where possible
This commit is contained in:
parent
24af43ff48
commit
6c6b1c16ff
@ -528,6 +528,25 @@ class PortPather:
|
||||
self.pather.mpath(self.ports, *args, **kwargs)
|
||||
return self
|
||||
|
||||
def path_into(self, *args, **kwargs) -> Self:
|
||||
""" Path_into, using the current port as the source """
|
||||
if len(self.ports) > 1:
|
||||
raise BuildError(f'Unable use implicit path_into() with {len(self.ports)} (>1) ports.')
|
||||
self.pather.path_into(self.ports[0], *args, **kwargs)
|
||||
if thru is not None:
|
||||
self.rename_from(thru)
|
||||
return self
|
||||
|
||||
def path_from(self, *args, **kwargs) -> Self:
|
||||
""" Path_into, using the current port as the destination """
|
||||
if len(self.ports) > 1:
|
||||
raise BuildError(f'Unable use implicit path_from() with {len(self.ports)} (>1) ports.')
|
||||
thru = kwargs.pop('thru', None)
|
||||
self.pather.path_into(args[0], self.ports[0], *args[1:], **kwargs)
|
||||
if thru is not None:
|
||||
self.rename_from(thru)
|
||||
return self
|
||||
|
||||
def plug(
|
||||
self,
|
||||
other: Abstract | str,
|
||||
@ -543,7 +562,7 @@ class PortPather:
|
||||
|
||||
def plugged(self, other_port: str) -> Self:
|
||||
if len(self.ports) > 1:
|
||||
raise BuildError(f'Unable use implicit plugged() with {len(self.ports)} ports.')
|
||||
raise BuildError(f'Unable use implicit plugged() with {len(self.ports)} (>1) ports.')
|
||||
self.pather.plugged({self.ports[0]: other_port})
|
||||
return self
|
||||
|
||||
@ -636,12 +655,10 @@ class PortPather:
|
||||
return self
|
||||
|
||||
@overload
|
||||
def delete(self, name: None) -> None:
|
||||
...
|
||||
def delete(self, name: None) -> None: ...
|
||||
|
||||
@overload
|
||||
def delete(self, name: str) -> Self:
|
||||
...
|
||||
def delete(self, name: str) -> Self: ...
|
||||
|
||||
def delete(self, name: str | None = None) -> Self | None:
|
||||
if name is None:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user