-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtypes.py
More file actions
63 lines (43 loc) · 1.51 KB
/
types.py
File metadata and controls
63 lines (43 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# generated by datamodel-codegen:
# filename: https://raw.githubusercontent.com/Flagsmith/flagsmith/chore/features-contexts-in-eval-context-schema/sdk/evaluation-context.json # noqa: E501
# timestamp: 2025-08-11T18:17:29+00:00
from __future__ import annotations
from typing import Any, Dict, List, Optional, TypedDict, Union
from typing_extensions import NotRequired
from flag_engine.segments.types import ConditionOperator, RuleType
class EnvironmentContext(TypedDict):
key: str
name: str
class FeatureValue(TypedDict):
value: Any
weight: float
class IdentityContext(TypedDict):
identifier: str
key: str
traits: NotRequired[Dict[str, Optional[Union[str, float, bool]]]]
class SegmentCondition(TypedDict):
property: NotRequired[str]
operator: ConditionOperator
value: str
class SegmentRule(TypedDict):
type: RuleType
conditions: NotRequired[List[SegmentCondition]]
rules: NotRequired[List[SegmentRule]]
class FeatureContext(TypedDict):
key: str
feature_key: str
name: str
enabled: bool
value: Any
variants: NotRequired[List[FeatureValue]]
priority: NotRequired[float]
class SegmentContext(TypedDict):
key: str
name: str
rules: List[SegmentRule]
overrides: NotRequired[List[FeatureContext]]
class EvaluationContext(TypedDict):
environment: EnvironmentContext
identity: NotRequired[Optional[IdentityContext]]
segments: NotRequired[Dict[str, SegmentContext]]
features: NotRequired[Dict[str, FeatureContext]]