Skip to content

Commit

Permalink
Fix code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorLamego committed Sep 11, 2022
1 parent de86277 commit eb19a38
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
35 changes: 16 additions & 19 deletions rasa/core/actions/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,25 +658,22 @@ async def is_done(
# We explicitly check only the last occurrences for each possible termination
# event instead of doing `return event in events_so_far` to make it possible
# to override termination events which were returned earlier.
return (
next(
(
event
for event in reversed(events_so_far)
if isinstance(event, SlotSet) and event.key == REQUESTED_SLOT
),
None,
)
== SlotSet(REQUESTED_SLOT, None)
or next(
(
event
for event in reversed(events_so_far)
if isinstance(event, ActiveLoop)
),
None,
)
== ActiveLoop(None)
return next(
(
event
for event in reversed(events_so_far)
if isinstance(event, SlotSet) and event.key == REQUESTED_SLOT
),
None,
) == SlotSet(REQUESTED_SLOT, None) or next(
(
event
for event in reversed(events_so_far)
if isinstance(event, ActiveLoop)
),
None,
) == ActiveLoop(
None
)

async def deactivate(self, *args: Any, **kwargs: Any) -> List[Event]:
Expand Down
1 change: 1 addition & 0 deletions rasa/nlu/extractors/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ class EntityExtractorMixin(EntityExtractor):
EntityExtractorMixin was renamed to EntityExtractor in 3.3.
This class will be removed in 4.0
"""

def __init_subclass__(cls, **kwargs):
super().__init_subclass__(**kwargs)
rasa.shared.utils.io.raise_deprecation_warning(
Expand Down
1 change: 1 addition & 0 deletions tests/nlu/extractors/test_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ def test_check_correct_entity_annotations(

def test_entity_extractor_mixin_raises_deprecation_warning():
with pytest.warns(FutureWarning) as record:

class DeprecatedEntityExtractorMixin(GraphComponent, EntityExtractorMixin):
@classmethod
def create(
Expand Down

0 comments on commit eb19a38

Please sign in to comment.