Skip to content

Commit

Permalink
Revert "improved typing of FlowLink"
Browse files Browse the repository at this point in the history
This reverts commit 37d1b26.
  • Loading branch information
twerkmeister committed Sep 22, 2023
1 parent 76c8361 commit 9dc2712
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions rasa/shared/core/flows/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,12 +1130,17 @@ def as_json(self) -> Any:
return [link.as_json() for link in self.links]


@dataclass
class FlowLink:
class FlowLink(Protocol):
"""Represents a flow link."""

target: str
"""The id of the linked flow."""
@property
def target(self) -> Text:
"""Returns the target of the flow link.
Returns:
The target of the flow link.
"""
...

def as_json(self) -> Any:
"""Returns the flow link as a dictionary.
Expand All @@ -1159,9 +1164,11 @@ def from_json(link_config: Any) -> FlowLink:


@dataclass
class IfFlowLink(FlowLink):
class IfFlowLink:
"""Represents the configuration of an if flow link."""

target: Text
"""The id of the linked flow."""
condition: Optional[Text]
"""The condition of the linked flow."""

Expand Down Expand Up @@ -1190,9 +1197,12 @@ def as_json(self) -> Dict[Text, Any]:


@dataclass
class ElseFlowLink(FlowLink):
class ElseFlowLink:
"""Represents the configuration of an else flow link."""

target: Text
"""The id of the linked flow."""

@staticmethod
def from_json(link_config: Dict[Text, Any]) -> ElseFlowLink:
"""Used to read flow links from parsed YAML.
Expand All @@ -1215,9 +1225,12 @@ def as_json(self) -> Dict[Text, Any]:


@dataclass
class StaticFlowLink(FlowLink):
class StaticFlowLink:
"""Represents the configuration of a static flow link."""

target: Text
"""The id of the linked flow."""

@staticmethod
def from_json(link_config: Text) -> StaticFlowLink:
"""Used to read flow links from parsed YAML.
Expand Down

0 comments on commit 9dc2712

Please sign in to comment.