From 8d58c2ae084509e93116322993ec239c13dc0996 Mon Sep 17 00:00:00 2001 From: Mustafa Kerem Kurban Date: Tue, 24 Sep 2024 13:57:21 +0200 Subject: [PATCH] ruff --- src/neuroagent/app/dependencies.py | 2 +- src/neuroagent/tools/__init__.py | 2 +- tests/agents/test_simple_agent.py | 1 + tests/agents/test_simple_chat_agent.py | 1 + tests/app/database/test_threads.py | 7 ++++--- tests/app/database/test_tools.py | 1 + tests/app/test_config.py | 3 ++- tests/app/test_dependencies.py | 5 +++-- tests/app/test_main.py | 1 + tests/app/test_middleware.py | 1 + tests/conftest.py | 7 ++++--- tests/test_cell_types.py | 1 + tests/test_resolving.py | 1 + tests/test_utils.py | 1 + tests/tools/test_basic_tool.py | 3 ++- tests/tools/test_electrophys_tool.py | 1 + tests/tools/test_get_me_model_tool.py | 1 + tests/tools/test_get_morpho_tool.py | 1 + tests/tools/test_kg_morpho_features_tool.py | 1 + tests/tools/test_literature_search_tool.py | 1 + tests/tools/test_morphology_features_tool.py | 1 + tests/tools/test_resolve_br_tool.py | 1 + tests/tools/test_traces_tool.py | 1 + 23 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/neuroagent/app/dependencies.py b/src/neuroagent/app/dependencies.py index fcdec92..dfcd9f2 100644 --- a/src/neuroagent/app/dependencies.py +++ b/src/neuroagent/app/dependencies.py @@ -28,13 +28,13 @@ from neuroagent.multi_agents import BaseMultiAgent, SupervisorMultiAgent from neuroagent.tools import ( ElectrophysFeatureTool, + GetMEModelTool, GetMorphoTool, GetTracesTool, KGMorphoFeatureTool, LiteratureSearchTool, MorphologyFeatureTool, ResolveBrainRegionTool, - GetMEModelTool, ) from neuroagent.utils import RegionMeta, get_file_from_KG diff --git a/src/neuroagent/tools/__init__.py b/src/neuroagent/tools/__init__.py index 56779e9..af6761e 100644 --- a/src/neuroagent/tools/__init__.py +++ b/src/neuroagent/tools/__init__.py @@ -1,6 +1,7 @@ """Tools folder.""" from neuroagent.tools.electrophys_tool import ElectrophysFeatureTool, FeaturesOutput +from neuroagent.tools.get_me_model_tool import GetMEModelTool from neuroagent.tools.get_morpho_tool import GetMorphoTool, KnowledgeGraphOutput from neuroagent.tools.kg_morpho_features_tool import ( KGMorphoFeatureOutput, @@ -19,7 +20,6 @@ ResolveBrainRegionTool, ) from neuroagent.tools.traces_tool import GetTracesTool, TracesOutput -from neuroagent.tools.get_me_model_tool import GetMEModelTool __all__ = [ "BRResolveOutput", diff --git a/tests/agents/test_simple_agent.py b/tests/agents/test_simple_agent.py index a31cf91..0f0ca1d 100644 --- a/tests/agents/test_simple_agent.py +++ b/tests/agents/test_simple_agent.py @@ -4,6 +4,7 @@ from pathlib import Path import pytest + from neuroagent.agents import AgentOutput, AgentStep, SimpleAgent diff --git a/tests/agents/test_simple_chat_agent.py b/tests/agents/test_simple_chat_agent.py index 6ec5474..e580574 100644 --- a/tests/agents/test_simple_chat_agent.py +++ b/tests/agents/test_simple_chat_agent.py @@ -6,6 +6,7 @@ import pytest from langchain_core.messages import HumanMessage, ToolMessage from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver + from neuroagent.agents import AgentOutput, AgentStep, SimpleChatAgent diff --git a/tests/app/database/test_threads.py b/tests/app/database/test_threads.py index 7807826..dfc3313 100644 --- a/tests/app/database/test_threads.py +++ b/tests/app/database/test_threads.py @@ -1,13 +1,14 @@ """Test of the thread router.""" import pytest +from sqlalchemy import MetaData, create_engine +from sqlalchemy.orm import Session +from sqlalchemy.sql.expression import Select + from neuroagent.app.config import Settings from neuroagent.app.dependencies import get_language_model, get_settings from neuroagent.app.main import app from neuroagent.app.routers.database.schemas import GetThreadsOutput -from sqlalchemy import MetaData, create_engine -from sqlalchemy.orm import Session -from sqlalchemy.sql.expression import Select def test_create_thread(patch_required_env, app_client, db_connection): diff --git a/tests/app/database/test_tools.py b/tests/app/database/test_tools.py index a5f55e0..03f2cf0 100644 --- a/tests/app/database/test_tools.py +++ b/tests/app/database/test_tools.py @@ -1,6 +1,7 @@ """Test of the tool router.""" import pytest + from neuroagent.app.config import Settings from neuroagent.app.dependencies import get_language_model, get_settings from neuroagent.app.main import app diff --git a/tests/app/test_config.py b/tests/app/test_config.py index 459d457..38191f8 100644 --- a/tests/app/test_config.py +++ b/tests/app/test_config.py @@ -1,9 +1,10 @@ """Test config""" import pytest -from neuroagent.app.config import Settings from pydantic import ValidationError +from neuroagent.app.config import Settings + def test_required(monkeypatch, patch_required_env): settings = Settings() diff --git a/tests/app/test_dependencies.py b/tests/app/test_dependencies.py index 7b3ad21..cde38e3 100644 --- a/tests/app/test_dependencies.py +++ b/tests/app/test_dependencies.py @@ -11,6 +11,7 @@ from langchain_openai import ChatOpenAI from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver + from neuroagent.agents import SimpleAgent, SimpleChatAgent from neuroagent.app.dependencies import ( Settings, @@ -24,21 +25,21 @@ get_kg_morpho_feature_tool, get_language_model, get_literature_tool, + get_me_model_tool, get_morpho_tool, get_morphology_feature_tool, get_traces_tool, get_update_kg_hierarchy, get_user_id, - get_me_model_tool, ) from neuroagent.tools import ( ElectrophysFeatureTool, + GetMEModelTool, GetMorphoTool, GetTracesTool, KGMorphoFeatureTool, LiteratureSearchTool, MorphologyFeatureTool, - GetMEModelTool, ) diff --git a/tests/app/test_main.py b/tests/app/test_main.py index 79fe9a8..3827ad8 100644 --- a/tests/app/test_main.py +++ b/tests/app/test_main.py @@ -2,6 +2,7 @@ from unittest.mock import patch from fastapi.testclient import TestClient + from neuroagent.app.dependencies import get_settings from neuroagent.app.main import app diff --git a/tests/app/test_middleware.py b/tests/app/test_middleware.py index 2707d4d..5a9bdcf 100644 --- a/tests/app/test_middleware.py +++ b/tests/app/test_middleware.py @@ -5,6 +5,7 @@ import pytest from fastapi.requests import Request from fastapi.responses import Response + from neuroagent.app.config import Settings from neuroagent.app.middleware import strip_path_prefix diff --git a/tests/conftest.py b/tests/conftest.py index d4c5f6d..c49e3a9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,13 +8,14 @@ from httpx import AsyncClient from langchain_core.language_models.fake_chat_models import GenericFakeChatModel from langchain_core.messages import AIMessage +from sqlalchemy import MetaData, create_engine +from sqlalchemy.exc import OperationalError +from sqlalchemy.orm import Session + from neuroagent.app.config import Settings from neuroagent.app.dependencies import get_kg_token, get_settings from neuroagent.app.main import app from neuroagent.tools import GetMorphoTool -from sqlalchemy import MetaData, create_engine -from sqlalchemy.exc import OperationalError -from sqlalchemy.orm import Session @pytest.fixture(name="app_client") diff --git a/tests/test_cell_types.py b/tests/test_cell_types.py index 0596534..930ec71 100644 --- a/tests/test_cell_types.py +++ b/tests/test_cell_types.py @@ -3,6 +3,7 @@ from pathlib import Path import pytest + from neuroagent.cell_types import CellTypesMeta, get_celltypes_descendants CELL_TYPES_FILE = Path(__file__).parent / "data" / "kg_cell_types_hierarchy_test.json" diff --git a/tests/test_resolving.py b/tests/test_resolving.py index eeafbad..2e794ce 100644 --- a/tests/test_resolving.py +++ b/tests/test_resolving.py @@ -1,5 +1,6 @@ import pytest from httpx import AsyncClient + from neuroagent.resolving import ( es_resolve, escape_punctuation, diff --git a/tests/test_utils.py b/tests/test_utils.py index 742388b..7f30bc3 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -5,6 +5,7 @@ import pytest from httpx import AsyncClient + from neuroagent.schemas import KGMetadata from neuroagent.utils import ( RegionMeta, diff --git a/tests/tools/test_basic_tool.py b/tests/tools/test_basic_tool.py index fb9ab17..c29bc6c 100644 --- a/tests/tools/test_basic_tool.py +++ b/tests/tools/test_basic_tool.py @@ -4,9 +4,10 @@ from langchain_core.messages import AIMessage, HumanMessage from langchain_core.tools import ToolException from langgraph.prebuilt import create_react_agent -from neuroagent.tools.base_tool import BasicTool from pydantic import BaseModel +from neuroagent.tools.base_tool import BasicTool + class input_for_test(BaseModel): test_str: str diff --git a/tests/tools/test_electrophys_tool.py b/tests/tools/test_electrophys_tool.py index e7729fc..59e8763 100644 --- a/tests/tools/test_electrophys_tool.py +++ b/tests/tools/test_electrophys_tool.py @@ -6,6 +6,7 @@ import httpx import pytest from langchain_core.tools import ToolException + from neuroagent.tools import ElectrophysFeatureTool from neuroagent.tools.electrophys_tool import ( CALCULATED_FEATURES, diff --git a/tests/tools/test_get_me_model_tool.py b/tests/tools/test_get_me_model_tool.py index 0627d5f..2366b59 100644 --- a/tests/tools/test_get_me_model_tool.py +++ b/tests/tools/test_get_me_model_tool.py @@ -6,6 +6,7 @@ import httpx import pytest from langchain_core.tools import ToolException + from neuroagent.tools.get_me_model_tool import GetMEModelTool, MEModelOutput diff --git a/tests/tools/test_get_morpho_tool.py b/tests/tools/test_get_morpho_tool.py index d3ef4ab..87fdcbb 100644 --- a/tests/tools/test_get_morpho_tool.py +++ b/tests/tools/test_get_morpho_tool.py @@ -6,6 +6,7 @@ import httpx import pytest from langchain_core.tools import ToolException + from neuroagent.tools import GetMorphoTool from neuroagent.tools.get_morpho_tool import KnowledgeGraphOutput diff --git a/tests/tools/test_kg_morpho_features_tool.py b/tests/tools/test_kg_morpho_features_tool.py index 2f5473c..b346e26 100644 --- a/tests/tools/test_kg_morpho_features_tool.py +++ b/tests/tools/test_kg_morpho_features_tool.py @@ -6,6 +6,7 @@ import httpx import pytest from langchain_core.tools import ToolException + from neuroagent.tools import KGMorphoFeatureTool from neuroagent.tools.kg_morpho_features_tool import ( FeatRangeInput, diff --git a/tests/tools/test_literature_search_tool.py b/tests/tools/test_literature_search_tool.py index 0f58728..93adf4f 100644 --- a/tests/tools/test_literature_search_tool.py +++ b/tests/tools/test_literature_search_tool.py @@ -4,6 +4,7 @@ import httpx import pytest + from neuroagent.tools import LiteratureSearchTool from neuroagent.tools.literature_search_tool import ParagraphMetadata diff --git a/tests/tools/test_morphology_features_tool.py b/tests/tools/test_morphology_features_tool.py index 22943e6..92a311f 100644 --- a/tests/tools/test_morphology_features_tool.py +++ b/tests/tools/test_morphology_features_tool.py @@ -6,6 +6,7 @@ import httpx import pytest from langchain_core.tools import ToolException + from neuroagent.tools import MorphologyFeatureTool from neuroagent.tools.morphology_features_tool import MorphologyFeatureOutput diff --git a/tests/tools/test_resolve_br_tool.py b/tests/tools/test_resolve_br_tool.py index 697a6ef..31f893d 100644 --- a/tests/tools/test_resolve_br_tool.py +++ b/tests/tools/test_resolve_br_tool.py @@ -2,6 +2,7 @@ import pytest from httpx import AsyncClient + from neuroagent.tools import ResolveBrainRegionTool from neuroagent.tools.resolve_brain_region_tool import ( BRResolveOutput, diff --git a/tests/tools/test_traces_tool.py b/tests/tools/test_traces_tool.py index 0bae056..ad26bf4 100644 --- a/tests/tools/test_traces_tool.py +++ b/tests/tools/test_traces_tool.py @@ -6,6 +6,7 @@ import httpx import pytest from langchain_core.tools import ToolException + from neuroagent.tools import GetTracesTool from neuroagent.tools.traces_tool import TracesOutput