mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 18:19:11 +08:00
chore: apply and fix flake8-bugbear lint rules (#4496)
This commit is contained in:
parent
5f4df34829
commit
e8e213ad1e
@ -1,4 +1,3 @@
|
|||||||
from abc import ABC
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from core.model_runtime.entities.llm_entities import LLMResult, LLMResultChunk
|
from core.model_runtime.entities.llm_entities import LLMResult, LLMResultChunk
|
||||||
@ -14,7 +13,7 @@ _TEXT_COLOR_MAPPING = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Callback(ABC):
|
class Callback:
|
||||||
"""
|
"""
|
||||||
Base class for callbacks.
|
Base class for callbacks.
|
||||||
Only for LLM.
|
Only for LLM.
|
||||||
|
@ -361,7 +361,6 @@ class ToolManager:
|
|||||||
|
|
||||||
:return: the label of the tool
|
:return: the label of the tool
|
||||||
"""
|
"""
|
||||||
cls._builtin_tools_labels
|
|
||||||
if len(cls._builtin_tools_labels) == 0:
|
if len(cls._builtin_tools_labels) == 0:
|
||||||
# init the builtin providers
|
# init the builtin providers
|
||||||
cls.load_builtin_providers_cache()
|
cls.load_builtin_providers_cache()
|
||||||
|
@ -39,7 +39,6 @@ class ToolNode(BaseNode):
|
|||||||
parameters = self._generate_parameters(variable_pool, node_data)
|
parameters = self._generate_parameters(variable_pool, node_data)
|
||||||
# get tool runtime
|
# get tool runtime
|
||||||
try:
|
try:
|
||||||
self.app_id
|
|
||||||
tool_runtime = ToolManager.get_workflow_tool_runtime(self.tenant_id, self.app_id, self.node_id, node_data)
|
tool_runtime = ToolManager.get_workflow_tool_runtime(self.tenant_id, self.app_id, self.node_id, node_data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return NodeRunResult(
|
return NodeRunResult(
|
||||||
|
@ -9,9 +9,9 @@ line-length = 120
|
|||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
ignore-init-module-imports = true
|
ignore-init-module-imports = true
|
||||||
select = [
|
select = [
|
||||||
|
"B", # flake8-bugbear rules
|
||||||
"F", # pyflakes rules
|
"F", # pyflakes rules
|
||||||
"I001", # unsorted-imports
|
"I", # isort rules
|
||||||
"I002", # missing-required-import
|
|
||||||
"UP", # pyupgrade rules
|
"UP", # pyupgrade rules
|
||||||
"RUF019", # unnecessary-key-check
|
"RUF019", # unnecessary-key-check
|
||||||
]
|
]
|
||||||
@ -22,6 +22,12 @@ ignore = [
|
|||||||
"F841", # unused-variable
|
"F841", # unused-variable
|
||||||
"UP007", # non-pep604-annotation
|
"UP007", # non-pep604-annotation
|
||||||
"UP032", # f-string
|
"UP032", # f-string
|
||||||
|
"B005", # strip-with-multi-characters
|
||||||
|
"B006", # mutable-argument-default
|
||||||
|
"B007", # unused-loop-control-variable
|
||||||
|
"B026", # star-arg-unpacking-after-keyword-arg
|
||||||
|
"B904", # raise-without-from-inside-except
|
||||||
|
"B905", # zip-without-explicit-strict
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff.lint.per-file-ignores]
|
[tool.ruff.lint.per-file-ignores]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user