| 330 | def read_temp_file(): |
| 331 | return read_file("temp.txt") |
| 332 | def normalize_data(data): |
| 333 | if data is None: |
| 334 | return [] |
| 335 | elif isinstance(data, (list, set, tuple)): |
| 336 | normalized_list = [] |
| 337 | for item in data: |
| 338 | if item is None: |
| 339 | continue # Skip None items |
| 340 | elif not isinstance(item, dict): |
| 341 | item = {"data": item} # Wrap non-dict items |
| 342 | normalized_list.append(item) |
| 343 | return normalized_list |
| 344 | |
| 345 | elif isinstance(data, dict): |
| 346 | return [data] |
| 347 | |
| 348 | else: |
| 349 | return [{"data": data}] |
| 350 | |
| 351 | def normalize_dicts_by_fieldnames(data): |
| 352 | fieldnames = get_fieldnames(data) |