Skip to content

Commit 41e2cc3

Browse files
committed
improve docstrings
1 parent aa3bdc6 commit 41e2cc3

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

flag_engine/context/mappers.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def map_environment_identity_to_context(
3333
override_traits: typing.Optional[typing.List[TraitModel]],
3434
) -> EvaluationContext:
3535
"""
36-
Maps an EnvironmentModel and IdentityModel to an EvaluationContext.
36+
Map an EnvironmentModel and IdentityModel to an EvaluationContext.
3737
3838
:param environment: The environment model object.
3939
:param identity: The identity model object.
@@ -134,6 +134,12 @@ def map_environment_identity_to_context(
134134
def map_feature_states_to_feature_contexts(
135135
feature_states: typing.List[FeatureStateModel],
136136
) -> typing.Dict[str, FeatureContext]:
137+
"""
138+
Map feature states to feature contexts.
139+
140+
:param feature_states: A list of FeatureStateModel objects.
141+
:return: A dictionary mapping feature names to their contexts.
142+
"""
137143
features: typing.Dict[str, FeatureContext] = {}
138144
for feature_state in feature_states:
139145
feature_ctx_data: FeatureContext = {
@@ -170,6 +176,12 @@ def map_feature_states_to_feature_contexts(
170176
def map_segment_rules_to_segment_context_rules(
171177
rules: typing.List[SegmentRuleModel],
172178
) -> typing.List[SegmentRule]:
179+
"""
180+
Map segment rules to segment rules for the evaluation context.
181+
182+
:param rules: A list of SegmentRuleModel objects.
183+
:return: A list of SegmentRule objects.
184+
"""
173185
return [
174186
{
175187
"type": rule.type,
@@ -190,6 +202,12 @@ def map_segment_rules_to_segment_context_rules(
190202
def map_flag_results_to_feature_states(
191203
flag_results: typing.List[FlagResult],
192204
) -> typing.List[FeatureStateModel]:
205+
"""
206+
Map flag results to feature states.
207+
208+
:param flag_results: A list of FlagResult objects.
209+
:return: A list of FeatureStateModel objects.
210+
"""
193211
return [
194212
FeatureStateModel(
195213
feature=FeatureModel(

0 commit comments

Comments
 (0)