MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / to_spec

Method to_spec

api/experimentation/serializers.py:231–246  ·  view source on GitHub ↗
(data: dict[str, Any], request: Any)

Source from the content-addressed store, hash-verified

229
230 @staticmethod
231 def to_spec(data: dict[str, Any], request: Any) -> RolloutSpec:
232 value = data["feature_state_value"]
233 return RolloutSpec(
234 enabled=data["enabled"],
235 rollout_percentage=data["rollout_percentage"],
236 feature_state_value=value["value"],
237 value_type=value["type"],
238 multivariate_values=[
239 MultivariateValueChangeSet(
240 multivariate_feature_option_id=mv["multivariate_feature_option"],
241 percentage_allocation=mv["percentage_allocation"],
242 )
243 for mv in data.get("multivariate_feature_state_values", [])
244 ],
245 author=AuthorData.from_request(request),
246 )
247
248
249class ExperimentSerializer(serializers.ModelSerializer): # type: ignore[type-arg]

Callers 2

createMethod · 0.80
rolloutMethod · 0.80

Calls 4

RolloutSpecClass · 0.90
from_requestMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected