(file_path)
| 12 | |
| 13 | |
| 14 | def load_json_data(file_path): |
| 15 | data = [] |
| 16 | # Determine file type, support both JSON and JSONL |
| 17 | if file_path.endswith('.json'): |
| 18 | # Handle JSON file |
| 19 | with open(file_path, 'r') as file: |
| 20 | data = json.load(file) |
| 21 | elif file_path.endswith('.jsonl'): |
| 22 | # Handle JSONL file |
| 23 | with open(file_path, 'r') as file: |
| 24 | first_line = file.readline().strip() |
| 25 | try: |
| 26 | json.loads(first_line) |
| 27 | data.append(json.loads(first_line)) |
| 28 | except json.JSONDecodeError: |
| 29 | pass |
| 30 | for line in file: |
| 31 | line = line.strip() |
| 32 | if line: |
| 33 | data.append(json.loads(line)) |
| 34 | return data |
| 35 | |
| 36 | |
| 37 | def parse_action(data): |
no outgoing calls
no test coverage detected