Support for nested/partial event hook filters #252
No reviewers
Labels
No labels
architecture
authentication
backend
bug
ci/cd
cleanup
documentation
duplicate
enhancement
good first issue
help wanted
in progress
invalid
media
mobile
new feature
notes
packaging
question
ui
upstream breaking change
voice
waiting user input
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: platypush/platypush#252
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "251-nested-filters-on-event-hooks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes: #251
_matches_argumentis actually only needed forSpeechRecognizedEvent. Other events don't need these features, and event hooks may be actually triggered unexpectedly in case of partial matches. Therefore, the "complex"_matches_argumenthas been moved as an override only forSpeechRecognizedEvent, and all the other events will perform simple key-value matching.- Support for nested attributes on event hook conditions. Things like these are now possible: ``` from platypush.event.hook import hook from platypush.message.event.entities import EntityUpdateEvent @hook(EntityUpdateEvent, entity={"external_id": "system:cpu"}) def on_cpu_update_event(event: EntityUpdateEvent, **_): print(event.args["entity"]["percent"]) ``` - The scoring/regex extraction/partial string match logic in `_matches_argument` is actually only needed for `SpeechRecognizedEvent`. Other events don't need these features, and event hooks may be actually triggered unexpectedly in case of partial matches. Therefore, the "complex" `_matches_argument` has been moved as an override only for `SpeechRecognizedEvent`, and all the other events will perform simple key-value matching.