chore: refurish python code by applying Pylint linter rules (#8322)

This commit is contained in:
Bowen Liang
2024-09-13 22:42:08 +08:00
committed by GitHub
parent 1ab81b4972
commit a1104ab97e
126 changed files with 253 additions and 272 deletions

View File

@@ -19,7 +19,7 @@ class ToolFileMessageTransformer:
result = []
for message in messages:
if message.type == ToolInvokeMessage.MessageType.TEXT or message.type == ToolInvokeMessage.MessageType.LINK:
if message.type in {ToolInvokeMessage.MessageType.TEXT, ToolInvokeMessage.MessageType.LINK}:
result.append(message)
elif message.type == ToolInvokeMessage.MessageType.IMAGE:
# try to download image

View File

@@ -165,7 +165,7 @@ class ApiBasedToolSchemaParser:
elif "schema" in parameter and "type" in parameter["schema"]:
typ = parameter["schema"]["type"]
if typ == "integer" or typ == "number":
if typ in {"integer", "number"}:
return ToolParameter.ToolParameterType.NUMBER
elif typ == "boolean":
return ToolParameter.ToolParameterType.BOOLEAN

View File

@@ -313,7 +313,7 @@ def normalize_whitespace(text):
def is_leaf(element):
return element.name in ["p", "li"]
return element.name in {"p", "li"}
def is_text(element):