Skip to content
Snippets Groups Projects

Implement InputSource and OutputSource equality and hash methods

Merged Moul requested to merge sources_equality_methods into dev

Here we are after moulte types errors!!


Implementation

In Silkaj, I need to check the equality of InputSource:

  • __eq__() implementation, to allow: inputsource1 == inputsource2

  • __hash__() methods should also be implemented. As I understood, it allows those classes stored into dict() and set() to continue working properly.

  • I also did it for OutputSource, as it’s pretty similar.


Readings


Types

I don’t if we can handle the type of the other argument. I tried, but I think it’s already checked with following block:

        if not isinstance(other, InputSource):
            return NotImplemented

In current code I found Any, and object.


One commit to change the return value within the equality method when it is not implemented between two different classes from False to NotImplemented.


Release

We can either wait for 0.54, or I can take care to release a 0.53.1.

Edited by Moul

Merge request reports

Pipeline #5238 passed

Pipeline passed for b418e8a7 on sources_equality_methods

Approval is optional

Merged by Vincent TexierVincent Texier 6 years ago (Apr 17, 2019 10:35am UTC)

Merge details

  • Changes merged into dev with c2e016a1.
  • Deleted the source branch.

Pipeline #5239 passed

Pipeline passed for c2e016a1 on dev

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading