mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
style: use ruff for linting and formatting (#524)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from unittest.mock import patch
|
||||
from tempfile import NamedTemporaryFile
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -178,14 +178,16 @@ def fake_mp3_upload():
|
||||
|
||||
@pytest.fixture
|
||||
async def fake_transcript_with_topics(tmpdir):
|
||||
from reflector.settings import settings
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from httpx import AsyncClient
|
||||
|
||||
from reflector.app import app
|
||||
from reflector.views.transcripts import transcripts_controller
|
||||
from reflector.db.transcripts import TranscriptTopic
|
||||
from reflector.processors.types import Word
|
||||
from pathlib import Path
|
||||
from httpx import AsyncClient
|
||||
import shutil
|
||||
from reflector.settings import settings
|
||||
from reflector.views.transcripts import transcripts_controller
|
||||
|
||||
settings.DATA_DIR = Path(tmpdir)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import pytest
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"name,diarization,expected",
|
||||
@@ -87,10 +88,10 @@ from unittest import mock
|
||||
async def test_processors_audio_diarization(name, diarization, expected):
|
||||
from reflector.processors.audio_diarization import AudioDiarizationProcessor
|
||||
from reflector.processors.types import (
|
||||
AudioDiarizationInput,
|
||||
TitleSummaryWithId,
|
||||
Transcript,
|
||||
Word,
|
||||
AudioDiarizationInput,
|
||||
)
|
||||
|
||||
# create fake topic
|
||||
|
||||
@@ -3,7 +3,7 @@ import pytest
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_processor_broadcast(nltk):
|
||||
from reflector.processors.base import Processor, BroadcastProcessor, Pipeline
|
||||
from reflector.processors.base import BroadcastProcessor, Pipeline, Processor
|
||||
|
||||
class TestProcessor(Processor):
|
||||
INPUT_TYPE = str
|
||||
|
||||
@@ -11,10 +11,11 @@ async def test_basic_process(
|
||||
):
|
||||
# goal is to start the server, and send rtc audio to it
|
||||
# validate the events received
|
||||
from reflector.tools.process import process_audio_file
|
||||
from reflector.settings import settings
|
||||
from pathlib import Path
|
||||
|
||||
from reflector.settings import settings
|
||||
from reflector.tools.process import process_audio_file
|
||||
|
||||
# use an LLM test backend
|
||||
settings.LLM_BACKEND = "test"
|
||||
settings.TRANSCRIPT_BACKEND = "whisper"
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
Tests for S3 temporary file context manager.
|
||||
"""
|
||||
|
||||
from unittest.mock import AsyncMock, Mock
|
||||
|
||||
import pytest
|
||||
from unittest.mock import Mock, AsyncMock
|
||||
|
||||
from reflector.utils.s3_temp_file import S3TemporaryFile
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import pytest
|
||||
import shutil
|
||||
from httpx import AsyncClient
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from httpx import AsyncClient
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def fake_transcript(tmpdir):
|
||||
from reflector.settings import settings
|
||||
from reflector.app import app
|
||||
from reflector.settings import settings
|
||||
from reflector.views.transcripts import transcripts_controller
|
||||
|
||||
settings.DATA_DIR = Path(tmpdir)
|
||||
|
||||
@@ -33,8 +33,8 @@ class ThreadedUvicorn:
|
||||
|
||||
@pytest.fixture
|
||||
async def appserver(tmpdir, setup_database, celery_session_app, celery_session_worker):
|
||||
from reflector.settings import settings
|
||||
from reflector.app import app
|
||||
from reflector.settings import settings
|
||||
|
||||
DATA_DIR = settings.DATA_DIR
|
||||
settings.DATA_DIR = Path(tmpdir)
|
||||
@@ -110,9 +110,11 @@ async def test_transcript_rtc_and_websocket(
|
||||
|
||||
# create stream client
|
||||
import argparse
|
||||
from reflector.stream_client import StreamClient
|
||||
|
||||
from aiortc.contrib.signaling import add_signaling_arguments, create_signaling
|
||||
|
||||
from reflector.stream_client import StreamClient
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
add_signaling_arguments(parser)
|
||||
args = parser.parse_args(["-s", "tcp-socket"])
|
||||
@@ -270,9 +272,11 @@ async def test_transcript_rtc_and_websocket_and_fr(
|
||||
|
||||
# create stream client
|
||||
import argparse
|
||||
from reflector.stream_client import StreamClient
|
||||
|
||||
from aiortc.contrib.signaling import add_signaling_arguments, create_signaling
|
||||
|
||||
from reflector.stream_client import StreamClient
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
add_signaling_arguments(parser)
|
||||
args = parser.parse_args(["-s", "tcp-socket"])
|
||||
|
||||
Reference in New Issue
Block a user