Skip to content

Commit

Permalink
prevent duplicated gui hooks during registration (#1624)
Browse files Browse the repository at this point in the history
* prevent duplicated gui hooks during registration

* per Fred
  • Loading branch information
dinhlongviolin1 authored Aug 1, 2024
1 parent e4542b3 commit 7cd2633
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions taipy/gui/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ def __init__(self):
self.__hooks: t.List[Hook] = []

Check failure on line 14 in taipy/gui/hook.py

View workflow job for this annotation

GitHub Actions / partial-tests / linter

By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]

def _register_hook(self, hook: Hook):
# Prevent duplicated hooks
for h in self.__hooks:
if type(hook) is type(h):
_TaipyLogger._get_logger().info(f"Failed to register duplicated hook of type '{type(h)}'")
return
self.__hooks.append(hook)

def __getattr__(self, name: str):
Expand Down

0 comments on commit 7cd2633

Please sign in to comment.