fix: Check result list before appending. Remove the need to clean final_data

This commit is contained in:
KenF
2026-01-22 20:01:20 +08:00
parent 0614cee9b2
commit 675f0f6ef3
10 changed files with 30 additions and 30 deletions
+3 -3
View File
@@ -23,7 +23,8 @@ def printResources(region_name: str) -> list[list[str | int]]:
for page in paginator.paginate():
functions = page.get('Functions', [])
for i in functions:
return_data.append([i['FunctionName'], i['Runtime'], i['Architectures'][0], region_name])
if i:
return_data.append([i['FunctionName'], i['Runtime'], i['Architectures'][0], region_name])
return return_data
# Main function
@@ -40,8 +41,7 @@ def main() -> None:
region_data = future.result()
final_data.extend(region_data)
clean_data = [row for row in final_data if row]
for row in clean_data:
for row in final_data:
ws.append(row)
wb.save('aws-inventory.xlsx')