Skip to content

Commit 1595816

Browse files
author
Matias Melograno
committed
refactored validation names
1 parent 690a2e5 commit 1595816

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

splitio/input_validator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _check_is_string(value, name, operation):
4949
return True
5050

5151

52-
def _check_not_empty(value, name, operation):
52+
def _check_string_not_empty(value, name, operation):
5353
"""
5454
Checks if value is an empty string
5555
@@ -68,7 +68,7 @@ def _check_not_empty(value, name, operation):
6868
return True
6969

7070

71-
def _check_pattern_match(value, name, operation, pattern):
71+
def _check_string_matches(value, name, operation, pattern):
7272
"""
7373
Checks if value is adhere to a regular expression passed
7474
@@ -131,7 +131,7 @@ def _check_valid_matching_key(matching_key):
131131
'matchingKey with valid string properties.')
132132
return False
133133
if isinstance(matching_key, six.string_types):
134-
if not _check_not_empty(matching_key, 'matching_key', 'get_treatment'):
134+
if not _check_string_not_empty(matching_key, 'matching_key', 'get_treatment'):
135135
return False
136136
else:
137137
if not _check_can_convert(matching_key, 'matching_key', 'get_treatment',
@@ -230,7 +230,7 @@ def validate_traffic_type(traffic_type):
230230
"""
231231
if (not _check_not_null(traffic_type, 'traffic_type', 'track')) or \
232232
(not _check_is_string(traffic_type, 'traffic_type', 'track')) or \
233-
(not _check_not_empty(traffic_type, 'traffic_type', 'track')):
233+
(not _check_string_not_empty(traffic_type, 'traffic_type', 'track')):
234234
return None
235235
return traffic_type
236236

@@ -246,8 +246,8 @@ def validate_event_type(event_type):
246246
"""
247247
if (not _check_not_null(event_type, 'event_type', 'track')) or \
248248
(not _check_is_string(event_type, 'event_type', 'track')) or \
249-
(not _check_pattern_match(event_type, 'event_type', 'track',
250-
r'[a-zA-Z0-9][-_\.a-zA-Z0-9]{0,62}')):
249+
(not _check_string_matches(event_type, 'event_type', 'track',
250+
r'[a-zA-Z0-9][-_\.a-zA-Z0-9]{0,62}')):
251251
return None
252252
return event_type
253253

0 commit comments

Comments
 (0)