@@ -169,7 +169,7 @@ def bucket_to_entity_id(
169
169
self ,
170
170
bucketing_id : str ,
171
171
experiment : Experiment ,
172
- traffic_allocations : list ,
172
+ traffic_allocations : list [ TrafficAllocation ] ,
173
173
group : Optional [Group ] = None
174
174
) -> tuple [Optional [str ], list [str ]]:
175
175
"""
@@ -193,8 +193,8 @@ def bucket_to_entity_id(
193
193
194
194
matched = False
195
195
for allocation in group .trafficAllocation :
196
- end_of_range = cast ( int , allocation . get ( "end_of_range" , 0 ))
197
- entity_id = cast ( Optional [ str ], allocation . get ( "entity_id" ))
196
+ end_of_range = allocation [ 'endOfRange' ]
197
+ entity_id = allocation [ 'entityId' ]
198
198
if bucket_val < end_of_range :
199
199
matched = True
200
200
if entity_id != experiment .id :
@@ -218,8 +218,8 @@ def bucket_to_entity_id(
218
218
decide_reasons .append (f'Generated experiment bucket value { bucket_val } for key "{ bucket_key } ".' )
219
219
220
220
for allocation in traffic_allocations :
221
- end_of_range = allocation . get ( "end_of_range" , 0 )
222
- entity_id = allocation . get ( "entity_id" )
221
+ end_of_range = allocation [ 'endOfRange' ]
222
+ entity_id = allocation [ 'entityId' ]
223
223
if bucket_val < end_of_range :
224
224
decide_reasons .append (
225
225
f'User bucketed into entity id "{ entity_id } ".'
0 commit comments