Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review comments2 #7558

Merged
merged 7 commits into from
Dec 16, 2020
Merged

Review comments2 #7558

merged 7 commits into from
Dec 16, 2020

Conversation

wochinge
Copy link
Contributor

@wochinge wochinge commented Dec 15, 2020

Proposed changes:

  • force implementation of __eq__ for Events
  • add a helper class for Events without attributes to avoid duplicating their __eq__ implementation
  • mark Event class as abstract

Status (please check what you already did):

  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@wochinge wochinge requested review from a team, tmbo and Ghostvv and removed request for a team December 15, 2020 18:16
@wochinge wochinge requested a review from joejuzl December 16, 2020 09:22
rasa/shared/core/events.py Show resolved Hide resolved
rasa/shared/core/events.py Outdated Show resolved Hide resolved

def __str__(self) -> Text:
"""Returns text representation of event."""
return f"{self.__class__.__name__}()"


# noinspection PyProtectedMember
class EventWithoutExtraAttributes(Event, ABC):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this name is confusing and likely to form a grab bag. Maybe something along the lines of AlwaysEqualEventMixin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhm, it's not always equal. It's only equal if it has the same type 🤔 In my opinion it'd actually be ok if it ends up as grab bag, e.g. I see that most of this classes have as_story_string implemented with return self.type_name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I like your name suggestion, will go with it 👍🏻

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do see your point though! If we add more functionality to it we can change the name again to fit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep 👍🏻 Let's keep it narrow for now. We can't fix all problems in the e2e branch anyway

@wochinge wochinge requested a review from joejuzl December 16, 2020 10:31
Copy link
Contributor

@joejuzl joejuzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just one final point.

@@ -314,21 +317,30 @@ def apply_to(self, tracker: "DialogueStateTracker") -> None:

def __eq__(self, other: Any) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also make this an abstractmethod now right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually didn't know about this decorator. Added it 👍🏻

@rasabot rasabot merged commit 4dee6d6 into e2e Dec 16, 2020
@rasabot rasabot deleted the review-comments2 branch December 16, 2020 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants