Skip to content

Commit

Permalink
chore(lint): correct allowed-unused-imports settings for cleanup unus…
Browse files Browse the repository at this point in the history
…ed imports in tests (#11922)
  • Loading branch information
bowenliang123 authored Dec 27, 2024
1 parent 4c9618b commit 72ae414
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 18 deletions.
4 changes: 2 additions & 2 deletions api/.ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ ignore = [
]
"tests/*" = [
"F811", # redefined-while-unused
"F401", # unused-import
]

[lint.pyflakes]
extend-generics = [
allowed-unused-imports = [
"_pytest.monkeypatch",
"tests.integration_tests",
"tests.unit_tests",
]
1 change: 0 additions & 1 deletion api/migrations/README
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Single-database configuration for Flask.

1 change: 0 additions & 1 deletion api/tests/integration_tests/model_runtime/__mock/google.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from collections.abc import Generator
from unittest.mock import MagicMock

import google.generativeai.types.generation_types as generation_config_types # type: ignore
Expand Down
2 changes: 0 additions & 2 deletions api/tests/integration_tests/vdb/baidu/test_baidu.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from unittest.mock import MagicMock

from core.rag.datasource.vdb.baidu.baidu_vector import BaiduConfig, BaiduVector
from tests.integration_tests.vdb.__mock.baiduvectordb import setup_baiduvectordb_mock
from tests.integration_tests.vdb.test_vector_store import AbstractVectorTest, get_example_text, setup_mock_redis
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from unittest.mock import MagicMock, patch

import pytest

from core.rag.datasource.vdb.tidb_vector.tidb_vector import TiDBVector, TiDBVectorConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from configs import dify_config
from core.app.app_config.entities import ModelConfigEntity
from core.file import File, FileTransferMethod, FileType, FileUploadConfig, ImageConfig
from core.file import File, FileTransferMethod, FileType
from core.memory.token_buffer_memory import TokenBufferMemory
from core.model_runtime.entities.message_entities import (
AssistantPromptMessage,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import uuid
from collections.abc import Generator
from datetime import UTC, datetime, timezone
from datetime import UTC, datetime

from core.workflow.entities.variable_pool import VariablePool
from core.workflow.enums import SystemVariableKey
Expand Down
3 changes: 1 addition & 2 deletions api/tests/unit_tests/core/workflow/nodes/llm/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
from core.model_runtime.entities.model_entities import AIModelEntity, FetchFrom, ModelFeature, ModelType
from core.model_runtime.model_providers.model_provider_factory import ModelProviderFactory
from core.prompt.entities.advanced_prompt_entities import MemoryConfig
from core.variables import ArrayAnySegment, ArrayFileSegment, NoneSegment, StringSegment
from core.workflow.entities.variable_entities import VariableSelector
from core.variables import ArrayAnySegment, ArrayFileSegment, NoneSegment
from core.workflow.entities.variable_pool import VariablePool
from core.workflow.graph_engine import Graph, GraphInitParams, GraphRuntimeState
from core.workflow.nodes.answer import AnswerStreamGenerateRoute
Expand Down
1 change: 0 additions & 1 deletion api/tests/unit_tests/core/workflow/nodes/test_retry.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from core.workflow.graph_engine.entities.event import (
GraphRunFailedEvent,
GraphRunPartialSucceededEvent,
GraphRunSucceededEvent,
NodeRunRetryEvent,
)
from tests.unit_tests.core.workflow.nodes.test_continue_on_error import ContinueOnErrorTestHelper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pytest

from core.variables import SegmentType
from core.workflow.nodes.variable_assigner.v2.enums import Operation
from core.workflow.nodes.variable_assigner.v2.helpers import is_input_value_valid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from unittest.mock import MagicMock, patch
from unittest.mock import patch

import pytest
from oss2 import Auth # type: ignore
Expand Down
2 changes: 0 additions & 2 deletions api/tests/unit_tests/utils/test_text_processing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from textwrap import dedent

import pytest

from core.tools.utils.text_processing_utils import remove_leading_symbols
Expand Down

0 comments on commit 72ae414

Please sign in to comment.