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

fix accept decorator bug #90

Merged
merged 3 commits into from
Mar 27, 2024
Merged

fix accept decorator bug #90

merged 3 commits into from
Mar 27, 2024

Conversation

corke2013
Copy link
Contributor

@corke2013 corke2013 commented Mar 27, 2024

This change fixes a bug in the accept decorator where using kwargs with the same parent key i.e. phq_labels=["label1", "label2", "label3"] and phq_labels__op="all" would result in a TypeError

Fix:

In [4]: for event in phq.events.search(phq_label=["agriculture-forestry-and-fisheries", "food-and-beverage"], phq_label__op="all").iter_all():
   ...:     print(event.phq_labels)
   ...:     break
   ...: 
[PHQLabels(label='food-and-beverage', weight=0.5), PHQLabels(label='hospitality-and-travel', weight=0.25), PHQLabels(label='agriculture-forestry-and-fisheries', weight=0.25)]

In [5]: for event in phq.events.search(phq_label=["agriculture-forestry-and-fisheries", "food-and-beverage"], phq_label__op="any").iter_all():
   ...:     print(event.phq_labels)
   ...:     break
   ...: 
[PHQLabels(label='nightlife', weight=0.354), PHQLabels(label='wellness', weight=0.335), PHQLabels(label='food-and-beverage', weight=0.311)]

@corke2013 corke2013 marked this pull request as ready for review March 27, 2024 02:03
Copy link
Member

@CockyAmoeba CockyAmoeba left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@lpouvreau lpouvreau left a comment

Choose a reason for hiding this comment

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

Awesome work @corke2013, thanks for fixing this 🙂

@corke2013 corke2013 merged commit c4e26a8 into master Mar 27, 2024
5 checks passed
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