forked from Unleash/unleash-client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStrategyV2.py
39 lines (34 loc) · 1.26 KB
/
StrategyV2.py
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
#Old Strategy object from unleash-client-python version 1.x.x and 2.x.x
# pylint: disable=dangerous-default-value
class StrategyOldV2():
"""
In general, default & custom classes should only need to override:
* __call__() - Implementation of the strategy.
* load_provisioning - Loads strategy provisioning
"""
def __init__(self,
parameters: dict = {}) -> None:
"""
A generic strategy objects.
:param parameters: 'parameters' key from strategy section (...from feature section) of
/api/clients/features response
"""
# Experiment information
self.parameters = parameters
self.parsed_provisioning = self.load_provisioning()
# pylint: disable=no-self-use
def load_provisioning(self) -> list:
"""
Method to load data on object initialization, if desired.
This should parse the raw values in self.parameters into format Python can comprehend.
"""
return []
def __eq__(self, other):
return self.parameters == other.parameters
def __call__(self, context: dict = None) -> bool:
"""
Strategy implementation goes here.
:param context: Context information
:return:
"""
return False