-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add mypy, fix typing errors - add absolufy-imports, ditch relative imports - move segment evaluation logic to `flag_engine.segments.evaluation` module - migrate `IdentityFeaturesList` to a Pydantic model
- Loading branch information
Showing
37 changed files
with
686 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
import typing | ||
|
||
from pydantic import parse_obj_as | ||
|
||
from flag_engine.environments.models import EnvironmentAPIKeyModel, EnvironmentModel | ||
|
||
|
||
def build_environment_model(environment_dict: dict) -> EnvironmentModel: | ||
def build_environment_model( | ||
environment_dict: typing.Dict[str, typing.Any] | ||
) -> EnvironmentModel: | ||
return parse_obj_as(EnvironmentModel, environment_dict) | ||
|
||
|
||
def build_environment_api_key_model( | ||
environment_key_dict: dict, | ||
environment_key_dict: typing.Dict[str, typing.Any], | ||
) -> EnvironmentAPIKeyModel: | ||
return parse_obj_as(EnvironmentAPIKeyModel, environment_key_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
from dataclasses import dataclass | ||
from typing import Optional | ||
|
||
|
||
@dataclass | ||
class IntegrationModel: | ||
api_key: str = None | ||
base_url: str = None | ||
entity_selector: str = None | ||
api_key: Optional[str] = None | ||
base_url: Optional[str] = None | ||
entity_selector: Optional[str] = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from typing import Union | ||
|
||
TraitValue = Union[int, str, bool, float] | ||
TraitValue = Union[None, int, str, bool, float] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,22 @@ | ||
# Segment Rules | ||
ALL_RULE = "ALL" | ||
ANY_RULE = "ANY" | ||
NONE_RULE = "NONE" | ||
from flag_engine.segments.types import ConditionOperator, RuleType | ||
|
||
RULE_TYPES = [ALL_RULE, ANY_RULE, NONE_RULE] | ||
# Segment Rules | ||
ALL_RULE: RuleType = "ALL" | ||
ANY_RULE: RuleType = "ANY" | ||
NONE_RULE: RuleType = "NONE" | ||
|
||
# Segment Condition Operators | ||
EQUAL = "EQUAL" | ||
GREATER_THAN = "GREATER_THAN" | ||
LESS_THAN = "LESS_THAN" | ||
LESS_THAN_INCLUSIVE = "LESS_THAN_INCLUSIVE" | ||
CONTAINS = "CONTAINS" | ||
GREATER_THAN_INCLUSIVE = "GREATER_THAN_INCLUSIVE" | ||
NOT_CONTAINS = "NOT_CONTAINS" | ||
NOT_EQUAL = "NOT_EQUAL" | ||
REGEX = "REGEX" | ||
PERCENTAGE_SPLIT = "PERCENTAGE_SPLIT" | ||
MODULO = "MODULO" | ||
IS_SET = "IS_SET" | ||
IS_NOT_SET = "IS_NOT_SET" | ||
IN = "IN" | ||
|
||
CONDITION_OPERATORS = [ | ||
EQUAL, | ||
GREATER_THAN, | ||
LESS_THAN, | ||
LESS_THAN_INCLUSIVE, | ||
CONTAINS, | ||
GREATER_THAN_INCLUSIVE, | ||
NOT_CONTAINS, | ||
NOT_EQUAL, | ||
REGEX, | ||
PERCENTAGE_SPLIT, | ||
MODULO, | ||
IS_SET, | ||
IS_NOT_SET, | ||
IN, | ||
] | ||
EQUAL: ConditionOperator = "EQUAL" | ||
GREATER_THAN: ConditionOperator = "GREATER_THAN" | ||
LESS_THAN: ConditionOperator = "LESS_THAN" | ||
LESS_THAN_INCLUSIVE: ConditionOperator = "LESS_THAN_INCLUSIVE" | ||
CONTAINS: ConditionOperator = "CONTAINS" | ||
GREATER_THAN_INCLUSIVE: ConditionOperator = "GREATER_THAN_INCLUSIVE" | ||
NOT_CONTAINS: ConditionOperator = "NOT_CONTAINS" | ||
NOT_EQUAL: ConditionOperator = "NOT_EQUAL" | ||
REGEX: ConditionOperator = "REGEX" | ||
PERCENTAGE_SPLIT: ConditionOperator = "PERCENTAGE_SPLIT" | ||
MODULO: ConditionOperator = "MODULO" | ||
IS_SET: ConditionOperator = "IS_SET" | ||
IS_NOT_SET: ConditionOperator = "IS_NOT_SET" | ||
IN: ConditionOperator = "IN" |
Oops, something went wrong.