Skip to content

Commit aaeb7f1

Browse files
committed
deprecate stuff
1 parent 395e9a6 commit aaeb7f1

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

flag_engine/engine.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import typing
2+
import warnings
23

34
from flag_engine.context.mappers import (
45
map_environment_identity_to_context,
@@ -28,6 +29,10 @@ def get_environment_feature_states(
2829
2930
:param environment: the environment model object
3031
"""
32+
warnings.warn(
33+
"`get_environment_feature_states` is deprecated, use `get_evaluation_result` instead.",
34+
DeprecationWarning,
35+
)
3136
if environment.get_hide_disabled_flags():
3237
return [fs for fs in environment.feature_states if fs.enabled]
3338
return environment.feature_states
@@ -42,6 +47,10 @@ def get_environment_feature_state(
4247
:param environment: the environment model object
4348
:param feature_name: the name of the feature to get the feature state for
4449
"""
50+
warnings.warn(
51+
"`get_environment_feature_state` is deprecated, use `get_evaluation_result` instead.",
52+
DeprecationWarning,
53+
)
4554
try:
4655
return next(
4756
filter(lambda f: f.feature.name == feature_name, environment.feature_states)
@@ -65,6 +74,10 @@ def get_identity_feature_states(
6574
:return: list of feature state models based on the environment, any matching
6675
segments and any specific identity overrides
6776
"""
77+
warnings.warn(
78+
"`get_identity_feature_states` is deprecated, use `get_evaluation_result` instead.",
79+
DeprecationWarning,
80+
)
6881
context = map_environment_identity_to_context(
6982
environment=environment,
7083
identity=identity,
@@ -96,6 +109,10 @@ def get_identity_feature_state(
96109
:return: feature state model based on the environment, any matching
97110
segments and any specific identity overrides
98111
"""
112+
warnings.warn(
113+
"`get_identity_feature_state` is deprecated, use `get_evaluation_result` instead.",
114+
DeprecationWarning,
115+
)
99116
context = map_environment_identity_to_context(
100117
environment=environment,
101118
identity=identity,

flag_engine/segments/evaluator.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import operator
22
import re
33
import typing
4+
import warnings
45
from contextlib import suppress
56
from functools import partial, wraps
67

@@ -32,12 +33,16 @@ def get_identity_segments(
3233
environment: EnvironmentModel,
3334
) -> typing.List[SegmentModel]:
3435
"""
35-
Get a list of segments for a given identity in a given environment.
36+
DEPRECATED: Get a list of segments for a given identity in a given environment.
3637
3738
:param identity: the identity model object to get the segments for
3839
:param environment: the environment model object the identity belongs to
3940
:return: list of segments that the identity belongs to in the environment
4041
"""
42+
warnings.warn(
43+
"`get_identity_feature_states` is deprecated, use `get_evaluation_result` instead.",
44+
DeprecationWarning,
45+
)
4146
context = map_environment_identity_to_context(
4247
environment=environment,
4348
identity=identity,
@@ -53,11 +58,15 @@ def get_context_segments(
5358
context: EvaluationContext,
5459
) -> typing.List[SegmentResult]:
5560
"""
56-
Get a list of segments for a given evaluation context.
61+
DEPRECATED: Get a list of segments for a given evaluation context.
5762
5863
:param context: the evaluation context
5964
:return: list of segments that match the context
6065
"""
66+
warnings.warn(
67+
"`get_context_segments` is deprecated, use `get_evaluation_result` instead.",
68+
DeprecationWarning,
69+
)
6170
return get_evaluation_result(context)["segments"]
6271

6372

0 commit comments

Comments
 (0)