ref: Some ruff fixes from preview (#5420)

* Some ruff fixes from preview

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Christophe Bornet 2024-12-28 22:25:35 +01:00 • committed by GitHub
commit e91bcc2520
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
79 changed files with 402 additions and 374 deletions

View file

@ -1,12 +1,17 @@
import pytest
from langflow.components.astra_assistants import (
AssistantsCreateAssistant,
AssistantsCreateThread,
AssistantsGetAssistantName,
AssistantsListAssistants,
AssistantsRun,
)
from tests.integration.utils import run_single_component
@pytest.mark.api_key_required
async def test_list_assistants():
from langflow.components.astra_assistants import AssistantsListAssistants
results = await run_single_component(
AssistantsListAssistants,
inputs={},
@ -16,8 +21,6 @@ async def test_list_assistants():
@pytest.mark.api_key_required
async def test_create_assistants():
from langflow.components.astra_assistants import AssistantsCreateAssistant
results = await run_single_component(
AssistantsCreateAssistant,
inputs={
@ -36,8 +39,6 @@ async def test_create_assistants():
@pytest.mark.api_key_required
async def test_create_thread():
from langflow.components.astra_assistants import AssistantsCreateThread
results = await run_single_component(
AssistantsCreateThread,
inputs={},
@ -48,8 +49,6 @@ async def test_create_thread():
async def get_assistant_name(assistant_id):
from langflow.components.astra_assistants import AssistantsGetAssistantName
results = await run_single_component(
AssistantsGetAssistantName,
inputs={
@ -60,8 +59,6 @@ async def get_assistant_name(assistant_id):
async def run_assistant(assistant_id, thread_id):
from langflow.components.astra_assistants import AssistantsRun
results = await run_single_component(
AssistantsRun,
inputs={

View file

@ -2,6 +2,7 @@ import os
import pytest
from astrapy.db import AstraDB
from langchain_astradb import AstraDBVectorStore, CollectionVectorServiceOptions
from langchain_core.documents import Document
from langflow.components.embeddings import OpenAIEmbeddingsComponent
from langflow.components.vectorstores import AstraDBVectorStoreComponent
@ -37,8 +38,6 @@ def astradb_client():
@pytest.mark.api_key_required
async def test_base(astradb_client: AstraDB):
from langflow.components.embeddings import OpenAIEmbeddingsComponent
application_token = get_astradb_application_token()
api_endpoint = get_astradb_api_endpoint()
@ -88,8 +87,6 @@ async def test_astra_embeds_and_search():
@pytest.mark.api_key_required
def test_astra_vectorize():
from langchain_astradb import AstraDBVectorStore, CollectionVectorServiceOptions
application_token = get_astradb_application_token()
api_endpoint = get_astradb_api_endpoint()
@ -132,8 +129,6 @@ def test_astra_vectorize():
@pytest.mark.api_key_required
def test_astra_vectorize_with_provider_api_key():
"""Tests vectorize using an openai api key."""
from langchain_astradb import AstraDBVectorStore, CollectionVectorServiceOptions
application_token = get_astradb_application_token()
api_endpoint = get_astradb_api_endpoint()
@ -189,8 +184,6 @@ def test_astra_vectorize_with_provider_api_key():
@pytest.mark.api_key_required
def test_astra_vectorize_passes_authentication():
"""Tests vectorize using the authentication parameter."""
from langchain_astradb import AstraDBVectorStore, CollectionVectorServiceOptions
store = None
try:
application_token = get_astradb_application_token()

View file

@ -10,7 +10,7 @@ from tests.integration.utils import ComponentInputHandle, run_single_component
@pytest.mark.api_key_required
async def test_csv_output_parser_openai():
format_instructions = ComponentInputHandle(
format_instructions_ = ComponentInputHandle(
clazz=OutputParserComponent,
inputs={},
output_name="format_instructions",
@ -24,7 +24,7 @@ async def test_csv_output_parser_openai():
clazz=PromptComponent,
inputs={
"template": "List the first five positive integers.\n\n{format_instructions}",
"format_instructions": format_instructions,
"format_instructions": format_instructions_,
},
output_name="prompt",
)