kameleoon-client-python 3.22.1__py2.py3-none-any.whl → 3.22.2__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
kameleoon/sdk_version.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Kameleoon SDK version"""
2
2
 
3
- version_info = (3, 22, 1)
3
+ version_info = (3, 22, 2)
4
4
  __version__ = ".".join(str(v) for v in version_info) # uses in scripts
5
5
 
6
6
 
@@ -23,7 +23,12 @@ class BrowserCondition(TargetingCondition):
23
23
  else BrowserType.INTERNET_EXPLORER
24
24
  )
25
25
  self.__version = json_condition.get("version", None)
26
- self.__operator = TargetingOperator[str(json_condition.get("versionMatchType", None))]
26
+ # Version is optional; the operator is only meaningful when it's set
27
+ self.__operator = (
28
+ TargetingOperator.from_string(json_condition.get("versionMatchType", None))
29
+ if self.__version is not None
30
+ else TargetingOperator.UNKNOWN
31
+ )
27
32
  except KeyError as exeception:
28
33
  KameleoonLogger.error("%s has wrong JSON structure: %s", self.__class__, exeception)
29
34
 
@@ -1,6 +1,9 @@
1
1
  """ Constants """
2
2
 
3
3
  from enum import Enum
4
+ from typing import Any
5
+
6
+ from kameleoon.logging.kameleoon_logger import KameleoonLogger
4
7
 
5
8
 
6
9
  class TargetingOperator(Enum):
@@ -17,3 +20,13 @@ class TargetingOperator(Enum):
17
20
  FALSE = "FALSE"
18
21
  AMONG_VALUES = "AMONG_VALUES"
19
22
  ANY = "ANY"
23
+ UNKNOWN = "UNKNOWN"
24
+
25
+ @classmethod
26
+ def from_string(cls, raw: Any) -> "TargetingOperator":
27
+ """Parse an operator name from the configuration; unparsable values map to UNKNOWN."""
28
+ try:
29
+ return cls[str(raw).upper()]
30
+ except KeyError:
31
+ KameleoonLogger.error("Unexpected TargetingOperator: %s", raw)
32
+ return cls.UNKNOWN
@@ -19,11 +19,12 @@ class VersionCondition(TargetingCondition):
19
19
  def __init__(self, json_condition: Dict[str, Union[str, int, Any]]):
20
20
  super().__init__(json_condition)
21
21
  self._condition_version = json_condition.get("version", None)
22
- try:
23
- self.__operator = TargetingOperator[str(json_condition.get("versionMatchType", None))]
24
- except KeyError as ex:
25
- KameleoonLogger.error("%s has wrong JSON structure: %s", self.__class__, ex)
26
- self.__operator = TargetingOperator.UNDEFINED
22
+ # Version may be optional (e.g. SDK_LANGUAGE); the operator is only meaningful when it's set
23
+ self.__operator = (
24
+ TargetingOperator.from_string(json_condition.get("versionMatchType", None))
25
+ if self._condition_version is not None
26
+ else TargetingOperator.UNKNOWN
27
+ )
27
28
  self.__cached_sem_version: Optional[SemVersion] = None
28
29
 
29
30
  def check(self, data: Any) -> bool:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kameleoon-client-python
3
- Version: 3.22.1
3
+ Version: 3.22.2
4
4
  Summary: Kameleoon Client Python Software Development Kit.
5
5
  Home-page: https://developers.kameleoon.com/python-sdk.html
6
6
  Author: Kameleoon
@@ -20,27 +20,27 @@ Requires-Dist: requests<3.0.0,>=2.25
20
20
  Requires-Dist: sseclient-py<1.9.0,>=1.7.0
21
21
  Requires-Dist: aiohttp<4.0.0,>=3.8.0
22
22
  Provides-Extra: test
23
- Requires-Dist: types-python-dateutil==2.8.2; extra == "test"
24
- Requires-Dist: twine==3.4.1; extra == "test"
25
23
  Requires-Dist: sseclient-py<1.9.0,>=1.7.0; extra == "test"
26
- Requires-Dist: types-PyYAML==5.4.3; extra == "test"
27
- Requires-Dist: aiohttp<4.0.0,>=3.8.0; extra == "test"
28
- Requires-Dist: pyyaml<6.1.0,>=5.4.0; extra == "test"
29
- Requires-Dist: requests<3.0.0,>=2.25; extra == "test"
30
- Requires-Dist: pylint==2.12.*; extra == "test"
31
- Requires-Dist: pytest-pythonpath==0.7.3; extra == "test"
32
- Requires-Dist: pytest-django==4.5.2; extra == "test"
33
- Requires-Dist: flake8==4.0.1; extra == "test"
34
24
  Requires-Dist: pytest-cov==2.12.1; extra == "test"
25
+ Requires-Dist: pytest-django==4.5.2; extra == "test"
26
+ Requires-Dist: pylint==2.12.*; extra == "test"
35
27
  Requires-Dist: wheel==0.36.2; extra == "test"
36
- Requires-Dist: freezegun==1.1.0; extra == "test"
28
+ Requires-Dist: types-PyYAML==5.4.3; extra == "test"
37
29
  Requires-Dist: types-requests==2.25.0; extra == "test"
38
- Requires-Dist: pytest-ordering==0.6; extra == "test"
30
+ Requires-Dist: types-python-dateutil==2.8.2; extra == "test"
31
+ Requires-Dist: aiohttp<4.0.0,>=3.8.0; extra == "test"
32
+ Requires-Dist: Django==4.2.*; extra == "test"
39
33
  Requires-Dist: aioresponses==0.7.*; extra == "test"
40
- Requires-Dist: mypy==0.991; extra == "test"
41
- Requires-Dist: Werkzeug==2.0.1; extra == "test"
34
+ Requires-Dist: freezegun==1.1.0; extra == "test"
42
35
  Requires-Dist: pytest-asyncio==0.21.*; extra == "test"
43
- Requires-Dist: Django==4.2.*; extra == "test"
36
+ Requires-Dist: Werkzeug==2.0.1; extra == "test"
37
+ Requires-Dist: mypy==0.991; extra == "test"
38
+ Requires-Dist: twine==3.4.1; extra == "test"
39
+ Requires-Dist: pyyaml<6.1.0,>=5.4.0; extra == "test"
40
+ Requires-Dist: flake8==4.0.1; extra == "test"
41
+ Requires-Dist: pytest-pythonpath==0.7.3; extra == "test"
42
+ Requires-Dist: requests<3.0.0,>=2.25; extra == "test"
43
+ Requires-Dist: pytest-ordering==0.6; extra == "test"
44
44
  Dynamic: author
45
45
  Dynamic: author-email
46
46
  Dynamic: classifier
@@ -5,7 +5,7 @@ kameleoon/kameleoon_client.py,sha256=Gg1NTcI0JUmYKPFYDRhJSG_Z2fxKaO8ECZ7R0yRgffA
5
5
  kameleoon/kameleoon_client_config.py,sha256=DJm--TtaTPc_09q3uv8XjHrX_q7C-sh0tf65lL2TxCw,11181
6
6
  kameleoon/kameleoon_client_factory.py,sha256=9_VXYnfZ0A5GNY6Y3j9aCfUV2uc-_-SQhslU3uUoeSQ,3228
7
7
  kameleoon/middleware.py,sha256=gwbt2YK0D6Uvmm3M7WqkTdwUIZEA85Use39Tt3oVeus,1584
8
- kameleoon/sdk_version.py,sha256=vobvHmOVOH8odPo1VzdJ-teYOgYoUjoNqpgXam4VHy8,289
8
+ kameleoon/sdk_version.py,sha256=7ZsKymIDnKmWCSJ-FIVDMmzAxUjdAcZfrkndtWxSG08,289
9
9
  kameleoon/client_readiness/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  kameleoon/client_readiness/async_readiness.py,sha256=NTzreGNJ9jOdpia0gAnkOwjn14Vu6m53l7QC_eJQ5ig,1569
11
11
  kameleoon/client_readiness/threading_readiness.py,sha256=bpld4cxl4H6ZIvJxomU_Qmhii2ru7fRK1yzYp2SQhTw,5794
@@ -133,8 +133,8 @@ kameleoon/targeting/targeting_manager.py,sha256=IH1LcAptfCB4KhcWrHWROzE1aXCG5eEl
133
133
  kameleoon/targeting/tree_builder.py,sha256=Np7b4aIUN_Sgt87hWTXRNkMImCLCbzxe36dCmk6tpTc,5622
134
134
  kameleoon/targeting/tree_condition_factory.py,sha256=FbAqnJ4Y1wQ-pxH4tBLbVOd2hbU-9LMplUvWM7vCX78,6366
135
135
  kameleoon/targeting/conditions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
136
- kameleoon/targeting/conditions/browser_condition.py,sha256=_Zq8SLvXDopRCDm0ucBIcP_ynI0991Q9xIeqkOGkVvU,2605
137
- kameleoon/targeting/conditions/constants.py,sha256=3ospn-l0fVyNrrpsGZFfjW9uLIvsKOT6yCFttxVWy-I,389
136
+ kameleoon/targeting/conditions/browser_condition.py,sha256=_zgC6KrK5gFY4aQHcFkOdlNPK8TclNJwE-94_9hfISA,2818
137
+ kameleoon/targeting/conditions/constants.py,sha256=_m6M_HjKHFna-LbH1M3dWFaRUzzRN6h73Whl-VQJk04,857
138
138
  kameleoon/targeting/conditions/conversion_condition.py,sha256=l4lju0HlkVD82neDZehGhCaBqr7uaNOzq3S51MiYoNI,1707
139
139
  kameleoon/targeting/conditions/cookie_condition.py,sha256=iZsQKC6L1RD9jnQMOmEfEohPR9Ek5s4ON0SJCmpb7Cg,2714
140
140
  kameleoon/targeting/conditions/custom_datum.py,sha256=H8SDA6sXAANFKmToasPzxibGRv8vB2Z8dRPjLCZCRWo,4020
@@ -157,7 +157,7 @@ kameleoon/targeting/conditions/target_personalization_condition.py,sha256=42fm_F
157
157
  kameleoon/targeting/conditions/targeting_condition.py,sha256=QaGrJAaoGLQKQagHOUmdjGV6cDySl9O7KI_IdjOyQnU,1986
158
158
  kameleoon/targeting/conditions/time_elapsed_since_visit_condition.py,sha256=xm2nnppMd5EEAD9-KqQLXGO838u1Srm6HROvgNaLErc,1161
159
159
  kameleoon/targeting/conditions/unknown_condition.py,sha256=Hw2-ncD6bSSqQutiz_2uSqJNQMgwzh82k-UiVnJN8ag,551
160
- kameleoon/targeting/conditions/version_condition.py,sha256=hmgAgxZNOccatjS5uvo9QkxjYn0-AEhLD_hPGqVIolk,2733
160
+ kameleoon/targeting/conditions/version_condition.py,sha256=YUcP4ZDcNz2hYfdB-7uB0TgtwZ08LOYxe5X_eiNDuTE,2764
161
161
  kameleoon/targeting/conditions/visit_number_today_condition.py,sha256=Zgm4f_YUCBbbItanK0ZVDnYDOU-gOvkJGq-XB0wXDMQ,1769
162
162
  kameleoon/targeting/conditions/visit_number_total_condition.py,sha256=eKTBGNPsbwJh4_uayWbdSZxFFK5Cu5vzNjKV9Uilwcg,764
163
163
  kameleoon/targeting/conditions/visitor_code_condition.py,sha256=03q8MeXc4y1FhHyA_7rCOmDjN7iDka-sOUfhNDTDrCg,415
@@ -170,7 +170,7 @@ kameleoon/types/remote_visitor_data_filter.py,sha256=YqInU1WvVwdBC9cTLhVXK7JYLic
170
170
  kameleoon/types/rule.py,sha256=RrnZA_nkIbvzfUSUcuKCqxqs48aVVk6WhlGfg2WrPns,1307
171
171
  kameleoon/types/variable.py,sha256=txEU9O07WPQOz6NjRIibyJWQ_mFexyqRa8YaR6W6eSE,833
172
172
  kameleoon/types/variation.py,sha256=vrgQWDeDc1FvsG5_O7CfsB5Xl4QhiKgKsWQMyoF1BkQ,2771
173
- kameleoon_client_python-3.22.1.dist-info/METADATA,sha256=3k7Cdx2P6d90V88V555Ml85XUzF238d68yWaU5F8mN4,13195
174
- kameleoon_client_python-3.22.1.dist-info/WHEEL,sha256=AeO2BvogYWm3eGaHCvhzmUYt8ia7KfURiHzO_1atlys,109
175
- kameleoon_client_python-3.22.1.dist-info/top_level.txt,sha256=i6mIQRivSZ-iWKzQ7WnfUr-c19Hkt0uJR_PKO53yZEc,10
176
- kameleoon_client_python-3.22.1.dist-info/RECORD,,
173
+ kameleoon_client_python-3.22.2.dist-info/METADATA,sha256=5yUAN6CSAN7zbIPgZEcJxK9p-qPsCaxS03iKdDuM9VM,13195
174
+ kameleoon_client_python-3.22.2.dist-info/WHEEL,sha256=AeO2BvogYWm3eGaHCvhzmUYt8ia7KfURiHzO_1atlys,109
175
+ kameleoon_client_python-3.22.2.dist-info/top_level.txt,sha256=i6mIQRivSZ-iWKzQ7WnfUr-c19Hkt0uJR_PKO53yZEc,10
176
+ kameleoon_client_python-3.22.2.dist-info/RECORD,,