Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions featuremanagement/_featuremanagerbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,7 @@ def _variant_name_to_variant(self, feature_flag: FeatureFlag, variant_name: Opti
return None
for variant_reference in feature_flag.variants:
if variant_reference.name == variant_name:
configuration = variant_reference.configuration_value
if not configuration and variant_reference.configuration_reference:
configuration = self._configuration.get(variant_reference.configuration_reference)
return Variant(variant_reference.name, configuration)
return Variant(variant_reference.name, variant_reference.configuration_value)
return None

def _build_targeting_context(self, args: Tuple[Any]) -> TargetingContext:
Expand Down
1 change: 0 additions & 1 deletion featuremanagement/_models/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@
# Variant Reference
VARIANT_REFERENCE_NAME = "name"
CONFIGURATION_VALUE = "configuration_value"
CONFIGURATION_REFERENCE = "configuration_reference"
STATUS_OVERRIDE = "status_override"
14 changes: 1 addition & 13 deletions featuremanagement/_models/_variant_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from dataclasses import dataclass
from typing import Optional, Mapping, Any
from typing_extensions import Self
from ._constants import VARIANT_REFERENCE_NAME, CONFIGURATION_VALUE, CONFIGURATION_REFERENCE, STATUS_OVERRIDE
from ._constants import VARIANT_REFERENCE_NAME, CONFIGURATION_VALUE, STATUS_OVERRIDE


@dataclass
Expand All @@ -18,7 +18,6 @@ class VariantReference:
def __init__(self) -> None:
self._name = None
self._configuration_value = None
self._configuration_reference = None
self._status_override = None

@classmethod
Expand All @@ -33,7 +32,6 @@ def convert_from_json(cls, json: Mapping[str, Any]) -> Self:
variant_reference = cls()
variant_reference._name = json.get(VARIANT_REFERENCE_NAME)
variant_reference._configuration_value = json.get(CONFIGURATION_VALUE)
variant_reference._configuration_reference = json.get(CONFIGURATION_REFERENCE)
variant_reference._status_override = json.get(STATUS_OVERRIDE, None)
return variant_reference

Expand All @@ -57,16 +55,6 @@ def configuration_value(self) -> Optional[str]:
"""
return self._configuration_value

@property
def configuration_reference(self) -> Optional[str]:
"""
Get the configuration reference for the variant.

:return: Configuration reference for the variant.
:rtype: str
"""
return self._configuration_reference

@property
def status_override(self) -> Optional[str]:
"""
Expand Down
1 change: 0 additions & 1 deletion samples/formatted_feature_flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@
},
{
"name": "False_Override",
"configuration_reference": "false-override",
"status_override": "True"
}
]
Expand Down