chore: refurbish Python code by applying refurb linter rules (#8296)

This commit is contained in:
Bowen Liang
2024-09-12 15:50:49 +08:00
committed by GitHub
parent c69f5b07ba
commit 40fb4d16ef
105 changed files with 220 additions and 276 deletions

View File

@@ -115,7 +115,7 @@ class GetWorksheetFieldsTool(BuiltinTool):
fields.append(field)
fields_list.append(
f"|{field['id']}|{field['name']}|{field['type']}|{field['typeId']}|{field['description']}"
f"|{field['options'] if field['options'] else ''}|"
f"|{field['options'] or ''}|"
)
fields.append(

View File

@@ -130,7 +130,7 @@ class GetWorksheetPivotDataTool(BuiltinTool):
# ]
rows = []
for row in data["data"]:
row_data = row["rows"] if row["rows"] else {}
row_data = row["rows"] or {}
row_data.update(row["columns"])
row_data.update(row["values"])
rows.append(row_data)

View File

@@ -113,7 +113,7 @@ class ListWorksheetRecordsTool(BuiltinTool):
result_text = f"Found {result['total']} rows in worksheet \"{worksheet_name}\"."
if result["total"] > 0:
result_text += (
f" The following are {result['total'] if result['total'] < limit else limit}"
f" The following are {min(limit, result['total'])}"
f" pieces of data presented in a table format:\n\n{table_header}"
)
for row in rows: