@@ -93,44 +93,20 @@ def __init__(self, datafile: str | bytes, logger: Logger, error_handler: Any):
9393 holdouts_data : list [types .HoldoutDict ] = config .get ('holdouts' , [])
9494 self .holdouts : list [entities .Holdout ] = []
9595 self .holdout_id_map : dict [str , entities .Holdout ] = {}
96- self .global_holdouts : list [entities .Holdout ] = []
97- self .included_holdouts : dict [str , list [entities .Holdout ]] = {}
98- self .excluded_holdouts : dict [str , list [entities .Holdout ]] = {}
99- self .flag_holdouts_map : dict [str , list [entities .Holdout ]] = {}
10096
10197 # Convert holdout dicts to Holdout entities
10298 for holdout_data in holdouts_data :
10399 # Create Holdout entity
104100 holdout = entities .Holdout (** holdout_data )
105101 self .holdouts .append (holdout )
106102
107- # Only process Running holdouts but doing it here for efficiency like the original Python implementation)
103+ # Only process Running holdouts
108104 if not holdout .is_activated :
109105 continue
110106
111107 # Map by ID for quick lookup
112108 self .holdout_id_map [holdout .id ] = holdout
113109
114- # Categorize as global vs flag-specific
115- # Global holdouts: apply to all flags unless explicitly excluded
116- # Flag-specific holdouts: only apply to explicitly included flags
117- if not holdout .includedFlags :
118- # This is a global holdout
119- self .global_holdouts .append (holdout )
120-
121- # Track which flags this global holdout excludes
122- if holdout .excludedFlags :
123- for flag_id in holdout .excludedFlags :
124- if flag_id not in self .excluded_holdouts :
125- self .excluded_holdouts [flag_id ] = []
126- self .excluded_holdouts [flag_id ].append (holdout )
127- else :
128- # This holdout applies to specific flags only
129- for flag_id in holdout .includedFlags :
130- if flag_id not in self .included_holdouts :
131- self .included_holdouts [flag_id ] = []
132- self .included_holdouts [flag_id ].append (holdout )
133-
134110 # Utility maps for quick lookup
135111 self .group_id_map : dict [str , entities .Group ] = self ._generate_key_map (self .groups , 'id' , entities .Group )
136112 self .experiment_id_map : dict [str , entities .Experiment ] = self ._generate_key_map (
@@ -263,22 +239,6 @@ def __init__(self, datafile: str | bytes, logger: Logger, error_handler: Any):
263239 everyone_else_variation .variables , 'id' , entities .Variation .VariableUsage
264240 )
265241
266- flag_id = feature .id
267- applicable_holdouts : list [entities .Holdout ] = []
268-
269- # Add global holdouts first, excluding any that are explicitly excluded for this flag
270- excluded_holdouts = self .excluded_holdouts .get (flag_id , [])
271- for holdout in self .global_holdouts :
272- if holdout not in excluded_holdouts :
273- applicable_holdouts .append (holdout )
274-
275- # Add flag-specific local holdouts AFTER global holdouts
276- if flag_id in self .included_holdouts :
277- applicable_holdouts .extend (self .included_holdouts [flag_id ])
278-
279- if applicable_holdouts :
280- self .flag_holdouts_map [feature .key ] = applicable_holdouts
281-
282242 rollout = None if len (feature .rolloutId ) == 0 else self .rollout_id_map [feature .rolloutId ]
283243 if rollout :
284244 for exp in rollout .experiments :
@@ -912,19 +872,6 @@ def get_flag_variation(
912872
913873 return None
914874
915- def get_holdouts_for_flag (self , flag_key : str ) -> list [entities .Holdout ]:
916- """ Helper method to get holdouts from an applied feature flag.
917-
918- Args:
919- flag_key: Key of the feature flag.
920-
921- Returns:
922- The holdouts that apply for a specific flag as Holdout entity objects.
923- """
924- if not self .holdouts :
925- return []
926-
927- return self .flag_holdouts_map .get (flag_key , [])
928875
929876 def get_holdout (self , holdout_id : str ) -> Optional [entities .Holdout ]:
930877 """ Helper method to get holdout from holdout ID.
0 commit comments