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

@@ -133,9 +133,9 @@ class GetWorksheetFieldsTool(BuiltinTool):
def _extract_options(self, control: dict) -> list:
options = []
if control["type"] in [9, 10, 11]:
if control["type"] in {9, 10, 11}:
options.extend([{"key": opt["key"], "value": opt["value"]} for opt in control.get("options", [])])
elif control["type"] in [28, 36]:
elif control["type"] in {28, 36}:
itemnames = control["advancedSetting"].get("itemnames")
if itemnames and itemnames.startswith("[{"):
try:

View File

@@ -183,11 +183,11 @@ class ListWorksheetRecordsTool(BuiltinTool):
type_id = field.get("typeId")
if type_id == 10:
value = value if isinstance(value, str) else "".join(value)
elif type_id in [28, 36]:
elif type_id in {28, 36}:
value = field.get("options", {}).get(value, value)
elif type_id in [26, 27, 48, 14]:
elif type_id in {26, 27, 48, 14}:
value = self.process_value(value)
elif type_id in [35, 29]:
elif type_id in {35, 29}:
value = self.parse_cascade_or_associated(field, value)
elif type_id == 40:
value = self.parse_location(value)