File tree Expand file tree Collapse file tree 1 file changed +9
-19
lines changed
Expand file tree Collapse file tree 1 file changed +9
-19
lines changed Original file line number Diff line number Diff line change @@ -51,13 +51,12 @@ def get_environment_feature_state(
5151 "`get_environment_feature_state` is deprecated, use `get_evaluation_result` instead." ,
5252 DeprecationWarning ,
5353 )
54- try :
55- return next (
56- filter (lambda f : f .feature .name == feature_name , environment .feature_states )
57- )
5854
59- except StopIteration :
60- raise FeatureStateNotFound ()
55+ for feature_state in environment .feature_states :
56+ if feature_state .feature .name == feature_name :
57+ return feature_state
58+
59+ raise FeatureStateNotFound ()
6160
6261
6362def get_identity_feature_states (
@@ -121,17 +120,8 @@ def get_identity_feature_state(
121120
122121 result = get_evaluation_result (context )
123122
124- feature_states = map_flag_results_to_feature_states (result ["flags" ])
125-
126- matching_feature_state = next (
127- filter (
128- lambda feature_state : feature_state .feature .name == feature_name ,
129- feature_states ,
130- ),
131- None ,
132- )
133-
134- if not matching_feature_state :
135- raise FeatureStateNotFound ()
123+ for feature_state in map_flag_results_to_feature_states (result ["flags" ]):
124+ if feature_state .feature .name == feature_name :
125+ return feature_state
136126
137- return matching_feature_state
127+ raise FeatureStateNotFound ()
You can’t perform that action at this time.
0 commit comments