OpenHands/openhands/utils/tenacity_stop.py
Graham Neubig 9d3a0a02b8
fix: Add missing type annotations in utils/ directory (#6687)
Co-authored-by: openhands <openhands@all-hands.dev>
2025-02-21 08:27:57 -05:00

12 lines
317 B
Python

from tenacity import RetryCallState
from tenacity.stop import stop_base
from openhands.utils.shutdown_listener import should_exit
class stop_if_should_exit(stop_base):
"""Stop if the should_exit flag is set."""
def __call__(self, retry_state: 'RetryCallState') -> bool:
return bool(should_exit())