Skip to content
Snippets Groups Projects

Add port name

Merged Oscar Gustafsson requested to merge portname into master
4 files
+ 147
361
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 13
8
@@ -49,8 +49,7 @@ class Port(ABC):
@@ -49,8 +49,7 @@ class Port(ABC):
@latency_offset.setter
@latency_offset.setter
@abstractmethod
@abstractmethod
def latency_offset(self, latency_offset: int) -> None:
def latency_offset(self, latency_offset: int) -> None:
"""Set the latency_offset of the port to the integer specified value.
"""Set the latency_offset of the port to the integer specified value."""
"""
raise NotImplementedError
raise NotImplementedError
@property
@property
@@ -94,6 +93,12 @@ class Port(ABC):
@@ -94,6 +93,12 @@ class Port(ABC):
"""Removes all connected signals from the Port."""
"""Removes all connected signals from the Port."""
raise NotImplementedError
raise NotImplementedError
 
@property
 
@abstractmethod
 
def name(self) -> str:
 
"""Return a name consisting of *graph_id* of the related operation and the port number.
 
"""
 
class AbstractPort(Port):
class AbstractPort(Port):
"""
"""
@@ -134,6 +139,10 @@ class AbstractPort(Port):
@@ -134,6 +139,10 @@ class AbstractPort(Port):
def latency_offset(self, latency_offset: Optional[int]):
def latency_offset(self, latency_offset: Optional[int]):
self._latency_offset = latency_offset
self._latency_offset = latency_offset
 
@property
 
def name(self):
 
return f"{self.operation.graph_id}.{self.index}"
 
class SignalSourceProvider(ABC):
class SignalSourceProvider(ABC):
"""
"""
@@ -196,13 +205,9 @@ class InputPort(AbstractPort):
@@ -196,13 +205,9 @@ class InputPort(AbstractPort):
Get the output port that is currently connected to this input port,
Get the output port that is currently connected to this input port,
or None if it is unconnected.
or None if it is unconnected.
"""
"""
return (
return None if self._source_signal is None else self._source_signal.source
None if self._source_signal is None else self._source_signal.source
)
def connect(
def connect(self, src: SignalSourceProvider, name: Name = Name("")) -> Signal:
self, src: SignalSourceProvider, name: Name = Name("")
) -> Signal:
"""
"""
Connect the provided signal source to this input port by creating a new signal.
Connect the provided signal source to this input port by creating a new signal.
Returns the new signal.
Returns the new signal.
Loading