MCPcopy Create free account
hub / github.com/Bairong-Xdynamics/MistakeNotebookLearning / load_data

Function load_data

resources/agents/caculate_scores.py:42–66  ·  view source on GitHub ↗

Loads data from a list of file paths.

(file_paths)

Source from the content-addressed store, hash-verified

40 return None
41
42def load_data(file_paths):
43 """
44 Loads data from a list of file paths.
45 """
46 data = []
47 if not file_paths:
48 return data
49
50 # If a single string is passed, wrap it in a list
51 if isinstance(file_paths, str):
52 file_paths = [file_paths]
53
54 for path in file_paths:
55 try:
56 with open(path, 'r', encoding='utf-8') as f:
57 for line in f:
58 if line.strip():
59 try:
60 data.append(json.loads(line))
61 except json.JSONDecodeError:
62 print(f"Warning: Failed to decode line in {path}")
63 except FileNotFoundError:
64 print(f"Error: File not found {path}")
65 sys.exit(1)
66 return data
67
68def evaluate_model(model_items, std_by_task):
69 """

Callers 1

mainFunction · 0.85

Calls 1

loadsMethod · 0.80

Tested by

no test coverage detected