diff --git a/src/celery_app/tasks.py b/src/celery_app/tasks.py index 8e0cd67e2..c8fd85a88 100644 --- a/src/celery_app/tasks.py +++ b/src/celery_app/tasks.py @@ -1,3 +1,5 @@ import seer.automation.autofix.tasks import seer.automation.codebase.tasks -from celery_app.app import app as celery_app + +# Import runs the `bootup_celery` and `bootup` helpers +from celery_app.app import app as celery_app # noqa diff --git a/src/seer/automation/agent/client.py b/src/seer/automation/agent/client.py index 5d1ebf916..30bec7ff9 100644 --- a/src/seer/automation/agent/client.py +++ b/src/seer/automation/agent/client.py @@ -3,7 +3,7 @@ from abc import ABC, abstractmethod from typing import Any, Callable, Optional, TypeVar -import openai_multi_tool_use_parallel_patch # import applies the patch +import openai_multi_tool_use_parallel_patch # noqa - import applies the patch from openai import OpenAI from openai.types.chat import ChatCompletion diff --git a/src/seer/automation/autofix/components/planner/models.py b/src/seer/automation/autofix/components/planner/models.py index f398ce9db..6df5cc8cb 100644 --- a/src/seer/automation/autofix/components/planner/models.py +++ b/src/seer/automation/autofix/components/planner/models.py @@ -3,7 +3,6 @@ from pydantic import BaseModel, StringConstraints from pydantic_xml import attr, element -from seer.automation.autofix.components.assessment.models import ProblemDiscoveryOutput from seer.automation.autofix.components.root_cause.models import RootCauseAnalysisItem from seer.automation.component import BaseComponentOutput, BaseComponentRequest from seer.automation.models import EventDetails, PromptXmlModel diff --git a/src/seer/automation/autofix/components/reranker/models.py b/src/seer/automation/autofix/components/reranker/models.py index 7d48c583c..56f3cb7c4 100644 --- a/src/seer/automation/autofix/components/reranker/models.py +++ b/src/seer/automation/autofix/components/reranker/models.py @@ -1,7 +1,5 @@ import json -import textwrap -from pydantic import BaseModel from pydantic_xml import element from seer.automation.codebase.models import BaseDocumentChunk diff --git a/src/seer/automation/autofix/steps/create_index_step.py b/src/seer/automation/autofix/steps/create_index_step.py index 068d5c836..db65e8bfa 100644 --- a/src/seer/automation/autofix/steps/create_index_step.py +++ b/src/seer/automation/autofix/steps/create_index_step.py @@ -1,4 +1,4 @@ -from typing import Any, Type +from typing import Any import sentry_sdk diff --git a/src/seer/automation/autofix/tools.py b/src/seer/automation/autofix/tools.py index 03d026fa4..4f149acbc 100644 --- a/src/seer/automation/autofix/tools.py +++ b/src/seer/automation/autofix/tools.py @@ -1,11 +1,8 @@ -import json import logging import textwrap from sentry_sdk.ai.monitoring import ai_track -from seer.automation.agent.client import GptClient -from seer.automation.agent.models import Message, Usage from seer.automation.agent.tools import FunctionTool from seer.automation.autofix.autofix_context import AutofixContext from seer.automation.autofix.components.retriever import RetrieverRequest @@ -19,7 +16,6 @@ from seer.automation.autofix.utils import find_original_snippet from seer.automation.codebase.codebase_index import CodebaseIndex from seer.automation.models import FileChange -from seer.automation.state import State logger = logging.getLogger("autofix") diff --git a/src/seer/automation/codebase/ast.py b/src/seer/automation/codebase/ast.py index 243796fbd..a9e2d0f6b 100644 --- a/src/seer/automation/codebase/ast.py +++ b/src/seer/automation/codebase/ast.py @@ -1,5 +1,5 @@ from pydantic import BaseModel -from tree_sitter import Node, Tree +from tree_sitter import Node class AstDeclaration(BaseModel): diff --git a/src/seer/automation/component.py b/src/seer/automation/component.py index 4114a63ff..7832fad7d 100644 --- a/src/seer/automation/component.py +++ b/src/seer/automation/component.py @@ -5,7 +5,6 @@ from seer.automation.models import PromptXmlModel from seer.automation.pipeline import PipelineContext -from seer.automation.state import State class BaseComponentRequest(BaseModel): diff --git a/src/seer/automation/state.py b/src/seer/automation/state.py index 7f3c4851f..28a3d5686 100644 --- a/src/seer/automation/state.py +++ b/src/seer/automation/state.py @@ -2,7 +2,7 @@ import contextlib import dataclasses import functools -from typing import Any, Callable, Generic, Iterator, Type, TypeVar, cast +from typing import Any, Generic, Iterator, Type, TypeVar, cast from celery import Task from pydantic import BaseModel diff --git a/src/seer/automation/utils.py b/src/seer/automation/utils.py index f7620ca29..188749fe4 100644 --- a/src/seer/automation/utils.py +++ b/src/seer/automation/utils.py @@ -1,7 +1,6 @@ import functools import logging import os -from typing import Any import billiard # type: ignore[import-untyped] import torch diff --git a/src/seer/db.py b/src/seer/db.py index a2efc00c4..cb1974c5e 100644 --- a/src/seer/db.py +++ b/src/seer/db.py @@ -23,7 +23,7 @@ ) from sqlalchemy.dialects.postgresql import insert from sqlalchemy.ext.asyncio import async_sessionmaker -from sqlalchemy.orm import DeclarativeBase, Mapped, deferred, mapped_column, sessionmaker +from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, sessionmaker class Base(DeclarativeBase): diff --git a/src/seer/generate_schemas.py b/src/seer/generate_schemas.py index dff29d2f6..01d047ba7 100644 --- a/src/seer/generate_schemas.py +++ b/src/seer/generate_schemas.py @@ -1,6 +1,6 @@ import json import os.path -from typing import Dict, Generator, Iterable, Iterator, List, Optional, Set, Union +from typing import Generator, Iterator, List, Optional, Set, Union root = os.path.abspath(os.path.join(__file__, "..")) diff --git a/src/seer/grouping/grouping.py b/src/seer/grouping/grouping.py index 5df67a7ca..4465b8467 100644 --- a/src/seer/grouping/grouping.py +++ b/src/seer/grouping/grouping.py @@ -1,9 +1,8 @@ import difflib import logging -from typing import List, Mapping, Optional +from typing import List, Optional import numpy as np -import pandas as pd import sentry_sdk import torch from pydantic import BaseModel, ValidationInfo, field_validator diff --git a/src/seer/tasks.py b/src/seer/tasks.py index ea300389f..6aba63f71 100644 --- a/src/seer/tasks.py +++ b/src/seer/tasks.py @@ -13,7 +13,6 @@ from dateutil.relativedelta import relativedelta from sentry_sdk.integrations.asyncio import AsyncioIntegration from sqlalchemy import func, select, text -from sqlalchemy.ext.asyncio import async_sessionmaker from seer.db import AsyncSession, ProcessRequest from seer.task_factory import AsyncTaskFactory, _async_task_factories diff --git a/src/seer/utils.py b/src/seer/utils.py index 1c1d67b3c..13e2df0c2 100644 --- a/src/seer/utils.py +++ b/src/seer/utils.py @@ -1,7 +1,6 @@ import contextlib import functools import json -import sys import weakref from enum import Enum from queue import Empty, Full, Queue diff --git a/tests/automation/agent/test_agent.py b/tests/automation/agent/test_agent.py index e264dfd16..8f2cdfc36 100644 --- a/tests/automation/agent/test_agent.py +++ b/tests/automation/agent/test_agent.py @@ -1,8 +1,8 @@ import unittest -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock from seer.automation.agent.agent import GptAgent -from seer.automation.agent.models import Message, ToolCall +from seer.automation.agent.models import ToolCall from seer.automation.agent.tools import FunctionTool diff --git a/tests/automation/autofix/steps/test_create_missing_indexes_chain.py b/tests/automation/autofix/steps/test_create_missing_indexes_chain.py index 568767e40..5430c5bee 100644 --- a/tests/automation/autofix/steps/test_create_missing_indexes_chain.py +++ b/tests/automation/autofix/steps/test_create_missing_indexes_chain.py @@ -5,7 +5,6 @@ from seer.automation.autofix.models import AutofixRequest from seer.automation.autofix.steps.create_missing_indexes_chain import CreateMissingIndexesStep -from seer.automation.autofix.steps.update_index_step import UpdateIndexStep from seer.automation.models import RepoDefinition from seer.automation.steps import ParallelizedChainStepRequest diff --git a/tests/automation/autofix/test_autofix_context.py b/tests/automation/autofix/test_autofix_context.py index ac3cd6966..a35ce1f87 100644 --- a/tests/automation/autofix/test_autofix_context.py +++ b/tests/automation/autofix/test_autofix_context.py @@ -16,7 +16,7 @@ from seer.automation.autofix.state import ContinuationState from seer.automation.codebase.models import QueryResultDocumentChunk, RepositoryInfo from seer.automation.models import FileChange, IssueDetails, SentryEventData -from seer.automation.state import DbState, LocalMemoryState +from seer.automation.state import LocalMemoryState from seer.db import DbPrIdToAutofixRunIdMapping, Session diff --git a/tests/automation/codebase/test_parser.py b/tests/automation/codebase/test_parser.py index 5d6fe9382..5f4652c53 100644 --- a/tests/automation/codebase/test_parser.py +++ b/tests/automation/codebase/test_parser.py @@ -1,5 +1,5 @@ import unittest -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock from sentence_transformers import SentenceTransformer from tree_sitter import Node, Parser diff --git a/tests/automation/codebase/test_repo_client.py b/tests/automation/codebase/test_repo_client.py index 45d032039..73fb0b87c 100644 --- a/tests/automation/codebase/test_repo_client.py +++ b/tests/automation/codebase/test_repo_client.py @@ -5,7 +5,7 @@ from pydantic import ValidationError from seer.automation.codebase.repo_client import RepoClient -from seer.automation.models import InitializationError, RepoDefinition +from seer.automation.models import RepoDefinition class TestRepoClient(unittest.TestCase): diff --git a/tests/automation/test_steps.py b/tests/automation/test_steps.py index 22b3886cf..7272222fc 100644 --- a/tests/automation/test_steps.py +++ b/tests/automation/test_steps.py @@ -1,6 +1,5 @@ import unittest -from typing import Type -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock from src.seer.automation.steps import ( ConditionalStep, diff --git a/tests/conftest.py b/tests/conftest.py index ed076d76b..9b38ba6a9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,9 +1,7 @@ -import asyncio import os import pytest from sqlalchemy import text -from sqlalchemy.ext.asyncio import create_async_engine from seer.bootup import CELERY_CONFIG, bootup from seer.db import Session, db diff --git a/tests/generators.py b/tests/generators.py index 94a9ab158..760cb571a 100644 --- a/tests/generators.py +++ b/tests/generators.py @@ -1,7 +1,6 @@ import contextlib import dataclasses import datetime -import hashlib from typing import Annotated, Iterator from unittest import mock diff --git a/tests/test_rpc.py b/tests/test_rpc.py index 58eb54bcc..b2301e99b 100644 --- a/tests/test_rpc.py +++ b/tests/test_rpc.py @@ -12,9 +12,7 @@ import pytest from aiohttp import ClientResponseError -from johen import gen from johen.pytest import parametrize -from pydantic import BaseModel from requests.models import HTTPError from seer.automation.autofix.models import AutofixCompleteArgs, AutofixStepUpdateArgs