Skip to content

Commit

Permalink
implement review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wochinge committed Nov 16, 2020
1 parent e58f572 commit 7bef722
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions rasa_sdk/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,20 +744,20 @@ async def _extract_slot(
domain: "DomainDict",
) -> List[EventType]:
method_name = f"extract_{slot_name.replace('-', '_')}"
also_mapped_in_domain = slot_name in self.slots_mapped_in_domain(domain)
slot_mapped_in_domain = slot_name in self.slots_mapped_in_domain(domain)
extract_method = getattr(self, method_name, None)

if not extract_method and not also_mapped_in_domain:
warnings.warn(
f"No method '{method_name}' found for slot "
f"'{slot_name}'. Skipping extraction for this slot."
)
return []

if not extract_method:
return []
if not slot_mapped_in_domain:
warnings.warn(
f"No method '{method_name}' found for slot "
f"'{slot_name}'. Skipping extraction for this slot."
)
return []
else:
return []

if also_mapped_in_domain:
if extract_method and slot_mapped_in_domain:
warnings.warn(
f"Slot '{slot_name}' is mapped in the domain and your custom "
f"action defines '{method_name}'. '{method_name}' will override any "
Expand Down

0 comments on commit 7bef722

Please sign in to comment.