-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Event consumer API simplification into develop #2566
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
Merged
jrobinAV
merged 24 commits into
develop
from
feature/#2306-event-consumer-simplification
May 7, 2025
Merged
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5ef135e
implement EventConsumer
jrobinAV 3c9ba97
Implement UTs for EventConsumer
jrobinAV 9b5abd9
fix imports
jrobinAV d85df90
Update __init__.py
jrobinAV eae31fe
Update __init__.py
jrobinAV 6a7e524
Decorate not implemented method with @abstractmethod
jrobinAV d094a4e
oups
jrobinAV 47b4bc4
Make mypy happy
jrobinAV 2f103e6
Merge branch 'develop' into feature/#2306-event-consumer-simplification
jrobinAV 09a14da
Make ruff happy
jrobinAV ab163db
Update codeql-analysis.yml
jrobinAV d14e692
fix UT
jrobinAV 2ba72a2
fix UT
jrobinAV cf4af84
Feedback from Eric and Florian: Systematically pass the gui as param
jrobinAV e2fc903
Merge branch 'develop' into feature/#2306-event-consumer-simplification
jrobinAV ec6dc93
Attempt to fix pipfile.lock
jrobinAV 28f679a
Revert "Attempt to fix pipfile.lock"
jrobinAV 52b5769
Merge branch 'develop' into feature/#2306-event-consumer-simplification
jrobinAV acaacae
#2597 Fix missing parent_ids
jrobinAV 6d886f6
Merge branch 'develop' into feature/#2306-event-consumer-simplification
jrobinAV 959cd8f
Yet another consumer API version
jrobinAV b6e195b
Linter + Giang's feedback
jrobinAV 1559358
Linter + Giang's feedback
jrobinAV 8a1fba2
Linter + Giang's feedback
jrobinAV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright 2021-2025 Avaiga Private Limited | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations under the License. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2021-2025 Avaiga Private Limited | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations under the License. | ||
from dataclasses import dataclass, field | ||
from typing import Callable, List, Optional | ||
|
||
from taipy.core.notification import Event | ||
|
||
|
||
@dataclass | ||
class _Callback: | ||
callback: Callable | ||
args: Optional[List] = field(default_factory=list) | ||
broadcast: Optional[bool] = False | ||
filter: Optional[Callable[[Event], bool]] = None | ||
|
||
def __hash__(self): | ||
return hash(self.callback) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright 2021-2025 Avaiga Private Limited | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations under the License. | ||
from taipy.core.notification import Event | ||
|
||
|
||
class _AbstractEventProcessor: | ||
"""Abstract base class for implementing an event processor.""" | ||
|
||
@classmethod | ||
def process_event(cls, event_consumer, event: Event): | ||
raise NotImplementedError("Subclasses must implement this method.") | ||
jrobinAV marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
class _EventProcessor(_AbstractEventProcessor): | ||
|
||
@classmethod | ||
def process_event(cls, event_consumer, event: Event): | ||
event_consumer._process_event(event) | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.