From 4b435994d4f1126cc320301a4490dc3f49cc36bc Mon Sep 17 00:00:00 2001 From: yihong0618 Date: Mon, 30 Dec 2024 10:17:27 +0800 Subject: [PATCH] fix: lint Signed-off-by: yihong0618 --- api/core/moderation/api/api.py | 3 ++- api/core/moderation/base.py | 3 ++- api/core/moderation/factory.py | 3 ++- api/core/moderation/input_moderation.py | 2 +- api/core/moderation/keywords/keywords.py | 4 ++-- api/core/moderation/openai_moderation/openai_moderation.py | 3 ++- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/api/core/moderation/api/api.py b/api/core/moderation/api/api.py index 05b89b22aa1810..1b664913f0ff87 100644 --- a/api/core/moderation/api/api.py +++ b/api/core/moderation/api/api.py @@ -1,4 +1,5 @@ -from typing import Optional, MutableMapping +from collections.abc import MutableMapping +from typing import Optional from pydantic import BaseModel diff --git a/api/core/moderation/base.py b/api/core/moderation/base.py index 50d7492ee129a8..aca10835c54e05 100644 --- a/api/core/moderation/base.py +++ b/api/core/moderation/base.py @@ -1,6 +1,7 @@ from abc import ABC, abstractmethod +from collections.abc import MutableMapping from enum import Enum -from typing import Optional, MutableMapping +from typing import Optional from pydantic import BaseModel diff --git a/api/core/moderation/factory.py b/api/core/moderation/factory.py index 45956c0ef728f4..3de45ea613dc96 100644 --- a/api/core/moderation/factory.py +++ b/api/core/moderation/factory.py @@ -1,4 +1,5 @@ -from typing import MutableMapping +from collections.abc import MutableMapping + from core.extension.extensible import ExtensionModule from core.moderation.base import Moderation, ModerationInputsResult, ModerationOutputsResult from extensions.ext_code_based_extension import code_based_extension diff --git a/api/core/moderation/input_moderation.py b/api/core/moderation/input_moderation.py index 7dc464a64adf09..bafab1e5ca2780 100644 --- a/api/core/moderation/input_moderation.py +++ b/api/core/moderation/input_moderation.py @@ -1,5 +1,5 @@ import logging -from collections.abc import Mapping, MutableMapping +from collections.abc import MutableMapping from typing import Any, Optional from core.app.app_config.entities import AppConfig diff --git a/api/core/moderation/keywords/keywords.py b/api/core/moderation/keywords/keywords.py index ef0b124538a023..fd036a060af919 100644 --- a/api/core/moderation/keywords/keywords.py +++ b/api/core/moderation/keywords/keywords.py @@ -1,5 +1,5 @@ -from collections.abc import Sequence -from typing import Any, MutableMapping +from collections.abc import MutableMapping, Sequence +from typing import Any from core.moderation.base import Moderation, ModerationAction, ModerationInputsResult, ModerationOutputsResult diff --git a/api/core/moderation/openai_moderation/openai_moderation.py b/api/core/moderation/openai_moderation/openai_moderation.py index e9903e8babe6fa..8b9e776cac51d6 100644 --- a/api/core/moderation/openai_moderation/openai_moderation.py +++ b/api/core/moderation/openai_moderation/openai_moderation.py @@ -1,4 +1,5 @@ -from typing import MutableMapping +from collections.abc import MutableMapping + from core.model_manager import ModelManager from core.model_runtime.entities.model_entities import ModelType from core.moderation.base import Moderation, ModerationAction, ModerationInputsResult, ModerationOutputsResult