Skip to content

Commit 9256e6a

Browse files
committed
additional removal
1 parent ca7984a commit 9256e6a

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

optimizely/helpers/condition.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ def __init__(self, condition_data, attributes, logger):
5555
def _get_condition_json(self, index):
5656
""" Method to generate json for logging audience condition.
5757
58-
Args:
59-
index: Index of the condition.
58+
Args:
59+
index: Index of the condition.
6060
61-
Returns:
62-
String: Audience condition JSON.
63-
"""
61+
Returns:
62+
String: Audience condition JSON.
63+
"""
6464
condition = self.condition_data[index]
6565
condition_log = {
6666
'name': condition[0],
@@ -74,12 +74,12 @@ def _get_condition_json(self, index):
7474
def is_value_type_valid_for_exact_conditions(self, value):
7575
""" Method to validate if the value is valid for exact match type evaluation.
7676
77-
Args:
78-
value: Value to validate.
77+
Args:
78+
value: Value to validate.
7979
80-
Returns:
81-
Boolean: True if value is a string, boolean, or number. Otherwise False.
82-
"""
80+
Returns:
81+
Boolean: True if value is a string, boolean, or number. Otherwise False.
82+
"""
8383
# No need to check for bool since bool is a subclass of int
8484
if isinstance(value, string_types) or isinstance(value, (numbers.Integral, float)):
8585
return True
@@ -194,29 +194,29 @@ def compare_user_version_with_target_version(self, index):
194194
def exact_evaluator(self, index):
195195
""" Evaluate the given exact match condition for the user attributes.
196196
197-
Args:
198-
index: Index of the condition to be evaluated.
197+
Args:
198+
index: Index of the condition to be evaluated.
199199
200-
Returns:
201-
Boolean:
202-
- True if the user attribute value is equal (===) to the condition value.
203-
- False if the user attribute value is not equal (!==) to the condition value.
204-
None:
205-
- if the condition value or user attribute value has an invalid type.
206-
- if there is a mismatch between the user attribute type and the condition value type.
207-
"""
200+
Returns:
201+
Boolean:
202+
- True if the user attribute value is equal (===) to the condition value.
203+
- False if the user attribute value is not equal (!==) to the condition value.
204+
None:
205+
- if the condition value or user attribute value has an invalid type.
206+
- if there is a mismatch between the user attribute type and the condition value type.
207+
"""
208208
condition_name = self.condition_data[index][0]
209209
condition_value = self.condition_data[index][1]
210210
user_value = self.attributes.get(condition_name)
211211

212212
if not self.is_value_type_valid_for_exact_conditions(condition_value) or (
213-
self.is_value_a_number(condition_value) and not validator.is_finite_number(condition_value)
213+
self.is_value_a_number(condition_value) and not validator.is_finite_number(condition_value)
214214
):
215215
self.logger.warning(audience_logs.UNKNOWN_CONDITION_VALUE.format(self._get_condition_json(index)))
216216
return None
217217

218218
if not self.is_value_type_valid_for_exact_conditions(user_value) or not validator.are_values_same_type(
219-
condition_value, user_value
219+
condition_value, user_value
220220
):
221221
self.logger.warning(
222222
audience_logs.UNEXPECTED_TYPE.format(self._get_condition_json(index), type(user_value), condition_name)
@@ -234,28 +234,28 @@ def exact_evaluator(self, index):
234234
def exists_evaluator(self, index):
235235
""" Evaluate the given exists match condition for the user attributes.
236236
237-
Args:
238-
index: Index of the condition to be evaluated.
237+
Args:
238+
index: Index of the condition to be evaluated.
239239
240-
Returns:
241-
Boolean: True if the user attributes have a non-null value for the given condition,
242-
otherwise False.
243-
"""
240+
Returns:
241+
Boolean: True if the user attributes have a non-null value for the given condition,
242+
otherwise False.
243+
"""
244244
attr_name = self.condition_data[index][0]
245245
return self.attributes.get(attr_name) is not None
246246

247247
def greater_than_evaluator(self, index):
248248
""" Evaluate the given greater than match condition for the user attributes.
249249
250-
Args:
251-
index: Index of the condition to be evaluated.
250+
Args:
251+
index: Index of the condition to be evaluated.
252252
253-
Returns:
254-
Boolean:
255-
- True if the user attribute value is greater than the condition value.
256-
- False if the user attribute value is less than or equal to the condition value.
257-
None: if the condition value isn't finite or the user attribute value isn't finite.
258-
"""
253+
Returns:
254+
Boolean:
255+
- True if the user attribute value is greater than the condition value.
256+
- False if the user attribute value is less than or equal to the condition value.
257+
None: if the condition value isn't finite or the user attribute value isn't finite.
258+
"""
259259
condition_name = self.condition_data[index][0]
260260
condition_value = self.condition_data[index][1]
261261
user_value = self.attributes.get(condition_name)

tests/helpers_tests/test_condition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def test_exact_int__returns_true__when_user_provided_value_is_equal_to_condition
492492

493493
self.assertStrictTrue(evaluator.evaluate(0))
494494

495-
def test_exact_float__returns_true__when_user_provided_value_is_equal_to_condition_value(self, ):
495+
def test_exact_float__returns_true__when_user_provided_value_is_equal_to_condition_value(self,):
496496

497497
if PY2:
498498
evaluator = condition_helper.CustomAttributeConditionEvaluator(
@@ -955,7 +955,7 @@ def test_less_than_int__returns_true__when_user_value_less_than_condition_value(
955955

956956
self.assertStrictTrue(evaluator.evaluate(0))
957957

958-
def test_less_than_float__returns_true__when_user_value_less_than_condition_value(self):
958+
def test_less_than_float__returns_true__when_user_value_less_than_condition_value(self,):
959959

960960
evaluator = condition_helper.CustomAttributeConditionEvaluator(
961961
lt_float_condition_list, {'meters_travelled': 48.1}, self.mock_client_logger

0 commit comments

Comments
 (0)