|
10 | 10 | from splitio.metrics import SDK_GET_TREATMENT |
11 | 11 | from splitio.splits import ConditionType |
12 | 12 | from splitio.events import Event |
13 | | -from splitio.input_validator import InputValidator |
| 13 | +from . import input_validator |
14 | 14 | from splitio.key import Key |
15 | 15 |
|
16 | 16 |
|
@@ -66,13 +66,12 @@ def get_treatment(self, key, feature, attributes=None): |
66 | 66 |
|
67 | 67 | start = int(round(time.time() * 1000)) |
68 | 68 |
|
69 | | - input_validator = InputValidator() |
70 | 69 | matching_key, bucketing_key = input_validator.validate_key(key) |
71 | 70 | feature = input_validator.validate_feature_name(feature) |
72 | 71 |
|
73 | | - if ((matching_key is None and bucketing_key is None) or (feature is None)): |
| 72 | + if (matching_key is None and bucketing_key is None) or feature is None: |
74 | 73 | impression = self._build_impression(matching_key, feature, CONTROL, Label.EXCEPTION, |
75 | | - 0, None, start) |
| 74 | + 0, bucketing_key, start) |
76 | 75 | self._record_stats(impression, start, SDK_GET_TREATMENT) |
77 | 76 | return CONTROL |
78 | 77 |
|
@@ -238,7 +237,6 @@ def track(self, key, traffic_type, event_type, value=None): |
238 | 237 |
|
239 | 238 | :rtype: bool |
240 | 239 | """ |
241 | | - input_validator = InputValidator() |
242 | 240 | key = input_validator.validate_track_key(key) |
243 | 241 | event_type = input_validator.validate_event_type(event_type) |
244 | 242 | traffic_type = input_validator.validate_traffic_type(traffic_type) |
@@ -296,11 +294,10 @@ def get_treatment(self, key, feature, attributes=None): |
296 | 294 | :param attributes: (Optional) attributes associated with the user key |
297 | 295 | :type attributes: dict |
298 | 296 | """ |
299 | | - input_validator = InputValidator() |
300 | 297 | matching_key, bucketing_key = input_validator.validate_key(key) |
301 | 298 | feature = input_validator.validate_feature_name(feature) |
302 | 299 |
|
303 | | - if ((matching_key is None and bucketing_key is None) or feature is None): |
| 300 | + if (matching_key is None and bucketing_key is None) or feature is None: |
304 | 301 | return CONTROL |
305 | 302 |
|
306 | 303 | try: |
|
0 commit comments