Apply ruff format

This commit is contained in:
Varun Singh
2026-05-01 13:14:20 +03:00
parent 5ceed1e615
commit 8d4dbd4ac0
2 changed files with 5 additions and 15 deletions

View File

@@ -227,9 +227,7 @@ class DeepgramTTSService(WebsocketTTSService):
params.append(f"encoding={self._encoding}")
params.append(f"sample_rate={self.sample_rate}")
if is_given(self._settings.mip_opt_out) and self._settings.mip_opt_out is not None:
params.append(
f"mip_opt_out={'true' if self._settings.mip_opt_out else 'false'}"
)
params.append(f"mip_opt_out={'true' if self._settings.mip_opt_out else 'false'}")
url = f"{self._base_url}/v1/speak?{'&'.join(params)}"

View File

@@ -13,9 +13,7 @@ from pipecat.services.deepgram.tts import DeepgramHttpTTSService, DeepgramTTSSer
def _make_ws_service(**settings_kwargs) -> DeepgramTTSService:
settings = (
DeepgramTTSService.Settings(**settings_kwargs) if settings_kwargs else None
)
settings = DeepgramTTSService.Settings(**settings_kwargs) if settings_kwargs else None
service = DeepgramTTSService(api_key="test-key", settings=settings)
# Bypass start() lifecycle: sample_rate is the only field _connect_websocket reads.
service._sample_rate = 16000
@@ -76,9 +74,7 @@ async def test_ws_mip_opt_out_default_absent():
@pytest.mark.asyncio
async def test_ws_explicit_empty_settings_omits_mip_opt_out():
"""Explicit Settings() with no kwargs must not leak the NOT_GIVEN sentinel."""
service = DeepgramTTSService(
api_key="test-key", settings=DeepgramTTSService.Settings()
)
service = DeepgramTTSService(api_key="test-key", settings=DeepgramTTSService.Settings())
# Bypass start() lifecycle: sample_rate is the only field _connect_websocket reads.
service._sample_rate = 16000
@@ -114,13 +110,9 @@ class _FakeResponse:
def _make_http_service(**settings_kwargs) -> DeepgramHttpTTSService:
settings = (
DeepgramHttpTTSService.Settings(**settings_kwargs) if settings_kwargs else None
)
settings = DeepgramHttpTTSService.Settings(**settings_kwargs) if settings_kwargs else None
session = MagicMock(spec=aiohttp.ClientSession)
service = DeepgramHttpTTSService(
api_key="test-key", aiohttp_session=session, settings=settings
)
service = DeepgramHttpTTSService(api_key="test-key", aiohttp_session=session, settings=settings)
# Bypass start() lifecycle: sample_rate is the only field run_tts reads.
service._sample_rate = 16000
service._session.post = MagicMock(return_value=_FakeResponse())