OpenHands/openhands/cli/suppress_warnings.py
Xingyao Wang c2f46200c0
chore(lint): Apply comprehensive linting and formatting fixes (#10287)
Co-authored-by: openhands <openhands@all-hands.dev>
2025-08-13 21:13:19 +02:00

54 lines
1.6 KiB
Python

"""Module to suppress common warnings in CLI mode."""
import warnings
def suppress_cli_warnings():
"""Suppress common warnings that appear during CLI usage."""
# Suppress pydub warning about ffmpeg/avconv
warnings.filterwarnings(
'ignore',
message="Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work",
category=RuntimeWarning,
)
# Suppress Pydantic serialization warnings
warnings.filterwarnings(
'ignore',
message='.*Pydantic serializer warnings.*',
category=UserWarning,
)
# Suppress specific Pydantic serialization unexpected value warnings
warnings.filterwarnings(
'ignore',
message='.*PydanticSerializationUnexpectedValue.*',
category=UserWarning,
)
# Suppress general deprecation warnings from dependencies during CLI usage
# This catches the "Call to deprecated method get_events" warning
warnings.filterwarnings(
'ignore',
message='.*Call to deprecated method.*',
category=DeprecationWarning,
)
# Suppress other common dependency warnings that don't affect functionality
warnings.filterwarnings(
'ignore',
message='.*Expected .* fields but got .*',
category=UserWarning,
)
# Suppress LiteLLM close_litellm_async_clients was never awaited warning
warnings.filterwarnings(
'ignore',
message="coroutine 'close_litellm_async_clients' was never awaited",
category=RuntimeWarning,
)
# Apply warning suppressions when module is imported
suppress_cli_warnings()