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

GitAuto: Example not working #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gitauto-ai[bot]
Copy link

@gitauto-ai gitauto-ai bot commented Dec 20, 2024

Resolves #1

Why the bug occurs

The ParallelEpisode class is unhashable because it does not implement the __hash__ and __eq__ methods. This causes a TypeError when attempting to add instances of ParallelEpisode to a set or use them as dictionary keys in the recognize_candidate_parallel function.

How to reproduce

  1. Use the WINEPI library on your own dataset.
  2. Call the methods w.discover_frequent_episodes() or w.generate_rules().
  3. Observe that empty arrays are returned.
  4. Alternatively, run the example code from the README.md, which triggers the following error:
TypeError: unhashable type: 'ParallelEpisode'

How to fix

Implement the __hash__ and __eq__ methods in the ParallelEpisode class to make its instances hashable. This allows instances to be added to sets and used as dictionary keys without raising a TypeError. Here's a step-by-step approach:

  1. Define __eq__ Method: Ensure that two ParallelEpisode instances are considered equal if their relevant attributes are equal.
  2. Define __hash__ Method: Compute a hash value based on the same attributes used in the __eq__ method.
  3. Update recognize_candidate_parallel Function: Ensure that the function correctly utilizes the hashable ParallelEpisode instances.

This fix will allow the WINEPI functions to work as expected without encountering hash-related errors.

Test these changes locally

git checkout -b gitauto/issue-1-20241220-000416
git pull origin gitauto/issue-1-20241220-000416

@gitauto-ai gitauto-ai bot mentioned this pull request Dec 20, 2024
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.

Example not working
0 participants