Skip to content

Commit b0aec1a

Browse files
committed
improve metadata type
1 parent 9b23e74 commit b0aec1a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

flagsmith/models.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@ def from_evaluation_result(
3030
cls,
3131
flag_result: SDKFlagResult,
3232
) -> typing.Optional[Flag]:
33-
if (
34-
flagsmith_id := (flag_result.get("metadata") or {}).get("flagsmith_id")
35-
) is not None:
33+
if metadata := flag_result.get("metadata"):
3634
return Flag(
3735
enabled=flag_result["enabled"],
3836
value=flag_result["value"],
3937
feature_name=flag_result["name"],
40-
feature_id=flagsmith_id,
38+
feature_id=metadata["flagsmith_id"],
4139
)
4240
return None
4341

flagsmith/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class SegmentMetadata(typing.TypedDict):
4545

4646

4747
class FeatureMetadata(typing.TypedDict):
48-
flagsmith_id: NotRequired[int]
48+
flagsmith_id: int
4949
"""The ID of the feature used in Flagsmith API."""
5050

5151

0 commit comments

Comments
 (0)