chore: apply ruff's pyupgrade linter rules to modernize Python code with targeted version (#2419)

This commit is contained in:
Bowen Liang
2024-02-09 15:21:33 +08:00
committed by GitHub
parent 589099a005
commit 063191889d
246 changed files with 912 additions and 937 deletions

View File

@@ -1,5 +1,5 @@
import io
from typing import Any, Dict, List, Union
from typing import Any, Union
import matplotlib.pyplot as plt
@@ -8,8 +8,8 @@ from core.tools.tool.builtin_tool import BuiltinTool
class BarChartTool(BuiltinTool):
def _invoke(self, user_id: str, tool_parameters: Dict[str, Any]) \
-> Union[ToolInvokeMessage, List[ToolInvokeMessage]]:
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) \
-> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
data = tool_parameters.get('data', '')
if not data:
return self.create_text_message('Please input data')

View File

@@ -1,5 +1,5 @@
import io
from typing import Any, Dict, List, Union
from typing import Any, Union
import matplotlib.pyplot as plt
@@ -10,8 +10,8 @@ from core.tools.tool.builtin_tool import BuiltinTool
class LinearChartTool(BuiltinTool):
def _invoke(self,
user_id: str,
tool_parameters: Dict[str, Any],
) -> Union[ToolInvokeMessage, List[ToolInvokeMessage]]:
tool_parameters: dict[str, Any],
) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
data = tool_parameters.get('data', '')
if not data:
return self.create_text_message('Please input data')

View File

@@ -1,5 +1,5 @@
import io
from typing import Any, Dict, List, Union
from typing import Any, Union
import matplotlib.pyplot as plt
@@ -10,8 +10,8 @@ from core.tools.tool.builtin_tool import BuiltinTool
class PieChartTool(BuiltinTool):
def _invoke(self,
user_id: str,
tool_parameters: Dict[str, Any],
) -> Union[ToolInvokeMessage, List[ToolInvokeMessage]]:
tool_parameters: dict[str, Any],
) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
data = tool_parameters.get('data', '')
if not data:
return self.create_text_message('Please input data')