@@ -47,10 +47,12 @@ def __init__(
4747
4848 def _parse_single_property (self , index : int , prop : Property , total_props : int ) -> Dict [str , Any ]:
4949 """Parse a single property response. Returns dict with results and errors."""
50- result = {
50+ parsed_properties : List [Property ] = []
51+ errors : List [Dict [str , Any ]] = []
52+ result : Dict [str , Any ] = {
5153 'index' : index ,
52- 'parsed_properties' : [] ,
53- 'errors' : [] ,
54+ 'parsed_properties' : parsed_properties ,
55+ 'errors' : errors ,
5456 'parse_failed' : False ,
5557 'empty_response' : False
5658 }
@@ -63,7 +65,7 @@ def _parse_single_property(self, index: int, prop: Property, total_props: int) -
6365 if parsed_json is None :
6466 result ['parse_failed' ] = True
6567 error_details = self ._analyze_json_parsing_error (prop .raw_response )
66- result [ ' errors' ] .append ({
68+ errors .append ({
6769 'property_id' : prop .id ,
6870 'question_id' : prop .question_id ,
6971 'model' : prop .model ,
@@ -84,7 +86,7 @@ def _parse_single_property(self, index: int, prop: Property, total_props: int) -
8486 else :
8587 result ['parse_failed' ] = True
8688 error_details = f"Parsed JSON has unsupported type: { type (parsed_json )} . Expected dict, list, or dict with 'properties' key."
87- result [ ' errors' ] .append ({
89+ errors .append ({
8890 'property_id' : prop .id ,
8991 'question_id' : prop .question_id ,
9092 'model' : prop .model ,
@@ -98,7 +100,7 @@ def _parse_single_property(self, index: int, prop: Property, total_props: int) -
98100
99101 # Process property dicts
100102 if not prop_dicts or (isinstance (prop_dicts , list ) and len (prop_dicts ) == 0 ):
101- result [ ' errors' ] .append ({
103+ errors .append ({
102104 'property_id' : prop .id ,
103105 'question_id' : prop .question_id ,
104106 'model' : prop .model ,
@@ -123,7 +125,7 @@ def _parse_single_property(self, index: int, prop: Property, total_props: int) -
123125 contains_errors = prop_dict .get ("contains_errors" ),
124126 raw_response = prop .raw_response ,
125127 )
126- result [ ' parsed_properties' ] .append (new_prop )
128+ parsed_properties .append (new_prop )
127129
128130 return result
129131
0 commit comments