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

Function generate_change_dict

api/edge_api/identities/utils.py:9–30  ·  view source on GitHub ↗
(
    change_type: "ChangeType",
    identity_id: int | str | None,
    new: FeatureStateModel | None = None,
    old: FeatureStateModel | None = None,
)

Source from the content-addressed store, hash-verified

7
8
9def generate_change_dict(
10 change_type: "ChangeType",
11 identity_id: int | str | None,
12 new: FeatureStateModel | None = None,
13 old: FeatureStateModel | None = None,
14) -> "FeatureStateChangeDetails":
15 if not (new or old):
16 raise ValueError("Must provide one of 'new' or 'old'")
17
18 change_dict = {"change_type": change_type}
19 if new:
20 change_dict["new"] = _get_overridden_feature_state_dict( # type: ignore[assignment]
21 identity_id=identity_id,
22 feature_state=new,
23 )
24 if old:
25 change_dict["old"] = _get_overridden_feature_state_dict( # type: ignore[assignment]
26 identity_id=identity_id,
27 feature_state=old,
28 )
29
30 return change_dict # type: ignore[return-value]
31
32
33def _get_overridden_feature_state_dict(

Callers 1

_get_changesMethod · 0.90

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…