@@ -38,7 +38,7 @@ def __init__(self, data: Union[Dict, List]):
38
38
super ().__init__ (data )
39
39
40
40
self ._is_simple = True
41
- if hasattr ( self , 'status' ) and self [ 'status' ] == "success" :
41
+ if self . _is_succeeded () :
42
42
self ._repr = self ._item_result_table ()
43
43
self .summary = HTMLWrapper (self ._item_result_summary_table ())
44
44
self .diagram = EstimatorResultDiagram (self .data ().copy ())
@@ -63,6 +63,9 @@ def __init__(self, data: Union[Dict, List]):
63
63
# Add plot function for batching jobs
64
64
self .plot = self ._plot
65
65
self .summary_data_frame = self ._summary_data_frame
66
+
67
+ def _is_succeeded (self ):
68
+ return 'status' in self and self ['status' ] == "success"
66
69
67
70
def data (self , idx : Optional [int ] = None ) -> Any :
68
71
"""
@@ -276,7 +279,7 @@ def _summary_data_frame(self, **kwargs):
276
279
labels = labels [:len (self )]
277
280
278
281
def get_row (result ):
279
- if 'status' in result and result [ 'status' ] == 'success' :
282
+ if self . _is_succeeded () :
280
283
formatted = result ["physicalCountsFormatted" ]
281
284
282
285
return (
@@ -406,7 +409,7 @@ def _item_result_summary_table(self):
406
409
return html
407
410
408
411
def _batch_result_table (self , indices ):
409
- succeeded_item_indices = [i for i in indices if 'status' in self [i ] and self [ i ][ 'status' ] == 'success' ]
412
+ succeeded_item_indices = [i for i in indices if self [i ]. _is_succeeded () ]
410
413
if len (succeeded_item_indices ) == 0 :
411
414
print ("None of the jobs succeeded" )
412
415
return ""
0 commit comments