96
96
)
97
97
from .pdl_context import ( # noqa: E402
98
98
DependentContext ,
99
+ IndependentContext ,
99
100
PDLContext ,
100
101
SerializeMode ,
101
102
SingletonContext ,
@@ -359,7 +360,11 @@ def set_error_to_scope_for_retry(
359
360
"content" : error ,
360
361
"defsite" : block_id ,
361
362
}
362
- scope = scope | {"pdl_context" : pdl_context * SingletonContext (PdlDict (err_msg ))}
363
+ scope = scope | {
364
+ "pdl_context" : DependentContext (
365
+ [pdl_context , SingletonContext (PdlDict (err_msg ))]
366
+ )
367
+ }
363
368
return scope
364
369
365
370
@@ -605,9 +610,13 @@ def process_block_body(
605
610
append (obj_loc , k ),
606
611
)
607
612
if block .context == IndependentEnum .DEPENDENT :
608
- background = background * value_background
613
+ background = DependentContext (
614
+ [background , value_background ]
615
+ )
609
616
else :
610
- background = background + value_background
617
+ background = IndependentContext (
618
+ [background , value_background ]
619
+ )
611
620
if (
612
621
block .context is IndependentEnum .INDEPENDENT
613
622
): # reset pdl_context
@@ -829,7 +838,9 @@ def process_block_body(
829
838
}
830
839
]
831
840
)
832
- scope = scope | {"pdl_context" : pdl_context_init * background }
841
+ scope = scope | {
842
+ "pdl_context" : DependentContext ([pdl_context_init , background ])
843
+ }
833
844
if items is not None :
834
845
for k in items .keys ():
835
846
scope = scope | {k : items [k ][iidx ]}
@@ -845,9 +856,13 @@ def process_block_body(
845
856
repeat_loc ,
846
857
)
847
858
if block .context is IndependentEnum .DEPENDENT :
848
- saved_background = saved_background * iteration_background
859
+ saved_background = DependentContext (
860
+ [saved_background , iteration_background ]
861
+ )
849
862
else :
850
- saved_background = saved_background + iteration_background
863
+ saved_background = IndependentContext (
864
+ [saved_background , iteration_background ]
865
+ )
851
866
852
867
if block .context is IndependentEnum .DEPENDENT :
853
868
background = saved_background
@@ -1088,7 +1103,9 @@ def process_blocks( # pylint: disable=too-many-arguments,too-many-positional-ar
1088
1103
try :
1089
1104
for i , block in enumerate (blocks ):
1090
1105
iteration_state = iteration_state .with_iter (i )
1091
- scope = scope | {"pdl_context" : pdl_context_init * background }
1106
+ scope = scope | {
1107
+ "pdl_context" : DependentContext ([pdl_context_init , background ])
1108
+ }
1092
1109
new_loc = append (loc , "[" + str (i ) + "]" )
1093
1110
if iteration_type == IterationType .LASTOF and state .yield_result :
1094
1111
iteration_state = state .with_yield_result (i + 1 == len (blocks ))
@@ -1100,9 +1117,13 @@ def process_blocks( # pylint: disable=too-many-arguments,too-many-positional-ar
1100
1117
) = process_block (iteration_state , scope , block , new_loc )
1101
1118
results .append (iteration_result )
1102
1119
if context == IndependentEnum .DEPENDENT :
1103
- saved_background = saved_background * iteration_background
1120
+ saved_background = DependentContext (
1121
+ [saved_background , iteration_background ]
1122
+ )
1104
1123
else :
1105
- saved_background = saved_background + iteration_background
1124
+ saved_background = IndependentContext (
1125
+ [saved_background , iteration_background ]
1126
+ )
1106
1127
1107
1128
if context == IndependentEnum .DEPENDENT :
1108
1129
background = saved_background
0 commit comments