ref: Remove some useless asyncio.to_thread (#5149)

Remove some useless asyncio.to_thread
This commit is contained in:
Christophe Bornet 2024-12-08 20:13:08 +01:00 committed by GitHub
commit c0b25fa651
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 44 additions and 94 deletions

View file

@ -1,18 +1,11 @@
import asyncio
from pathlib import Path
from typing import Any
from aiofile import async_open
from fastapi import status
from httpx import AsyncClient
from langflow.api.v1.schemas import UpdateCustomComponentRequest
async def get_dynamic_output_component_code():
return await asyncio.to_thread(
Path("src/backend/tests/data/dynamic_output_component.py").read_text, encoding="utf-8"
)
async def test_get_version(client: AsyncClient):
response = await client.get("api/v1/version")
result = response.json()
@ -37,7 +30,8 @@ async def test_get_config(client: AsyncClient):
async def test_update_component_outputs(client: AsyncClient, logged_in_headers: dict):
code = await get_dynamic_output_component_code()
async with async_open("src/backend/tests/data/dynamic_output_component.py", encoding="utf-8") as f:
code = await f.read()
frontend_node: dict[str, Any] = {"outputs": []}
request = UpdateCustomComponentRequest(
code=code,