in src/dubbo/utils.py [0:0]
def clear(event) -> bool:
"""
Attempt to clear the event object.
:param event: Event object, you can use threading.Event or any other object that supports the clear operation.
:type event: Any
:return: True if the event was cleared, False otherwise
(such as the event is invalid or does not support the clear operation).
:rtype: bool
"""
if not event:
return False
# If the event supports the clear operation, clear the event and return True
if hasattr(event, "clear"):
event.clear()
return True
# If the event is invalid or does not support the clear operation, return False
return False