Skip to content

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
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.

4 participants