From e8164759810eda6adea0f88f7c2e8b68c556256d Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Tue, 27 May 2025 00:05:19 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8(summary)=20lint=20backend=20source?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run ruff format to fix linter warnings. --- src/summary/summary/core/celery_worker.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/summary/summary/core/celery_worker.py b/src/summary/summary/core/celery_worker.py index d6d13a34..bd6f6fd5 100644 --- a/src/summary/summary/core/celery_worker.py +++ b/src/summary/summary/core/celery_worker.py @@ -64,9 +64,9 @@ def format_segments(transcription_data): conversation with speaker labels. """ formatted_output = "" - if not transcription_data or not hasattr(transcription_data, 'segments'): - if isinstance(transcription_data, dict) and 'segments' in transcription_data: - segments = transcription_data['segments'] + if not transcription_data or not hasattr(transcription_data, "segments"): + if isinstance(transcription_data, dict) and "segments" in transcription_data: + segments = transcription_data["segments"] else: return "Error: Invalid transcription data format" else: @@ -75,8 +75,8 @@ def format_segments(transcription_data): previous_speaker = None for segment in segments: - speaker = segment.get('speaker', 'UNKNOWN_SPEAKER') - text = segment.get('text', '') + speaker = segment.get("speaker", "UNKNOWN_SPEAKER") + text = segment.get("text", "") if text: if speaker != previous_speaker: formatted_output += f"\n\n **{speaker}**: {text}" @@ -85,6 +85,7 @@ def format_segments(transcription_data): previous_speaker = speaker return formatted_output + def post_with_retries(url, data): """Send POST request with automatic retries.""" session = create_retry_session() @@ -236,5 +237,3 @@ def process_audio_transcribe_summarize_v2(filename: str, email: str, sub: str): logger.debug("Response body: %s", response.text) # TODO - integrate summarize the transcript and create a new document. - -