8000 [FORMATTER] - Testing autopep8 formatter using single --aggressive · optimizely/python-sdk@9d71d56 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d71d56

Browse files
[FORMATTER] - Testing autopep8 formatter using single --aggressive
1 parent 9d9088b commit 9d71d56

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

optimizely/helpers/validator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def are_attributes_valid(attributes):
147147
Boolean depending upon whether attributes are in valid format or not.
148148
"""
149149

150-
return type(attributes) is dict
150+
return isinstance(attributes, dict)
151151

152152

153153
def are_event_tags_valid(event_tags):
@@ -160,7 +160,7 @@ def are_event_tags_valid(event_tags):
160160
Boolean depending upon whether event_tags are in valid format or not.
161161
"""
162162

163-
return type(event_tags) is dict
163+
return isinstance(event_tags, dict)
164164

165165

166166
def is_user_profile_valid(user_profile):
@@ -176,7 +176,7 @@ def is_user_profile_valid(user_profile):
176176
if not user_profile:
177177
return False
178178

179-
if not type(user_profile) is dict:
179+
if not isinstance(user_profile, dict):
180180
return False
181181

182182
if UserProfile.USER_ID_KEY not in user_profile:
@@ -186,11 +186,11 @@ def is_user_profile_valid(user_profile):
186186
return False
187187

188188
experiment_bucket_map = user_profile.get(UserProfile.EXPERIMENT_BUCKET_MAP_KEY)
189-
if not type(experiment_bucket_map) is dict:
189+
if not isinstance(experiment_bucket_map, dict):
190190
return False
191191

192192
for decision in experiment_bucket_map.values():
193-
if type(decision) is not dict or UserProfile.VARIATION_ID_KEY not in decision:
193+
if not isinstance(decision, dict) or UserProfile.VARIATION_ID_KEY not in decision:
194194
return False
195195

196196
return True

optimizely/optimizely.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ def create_user_context(self, user_id, attributes=None):
950950
self.logger.error(enums.Errors.INVALID_INPUT.format('user_id'))
951951
return None
952952

953-
if attributes is not None and type(attributes) is not dict:
953+
if attributes is not None and not isinstance(attributes, dict):
954954
self.logger.error(enums.Errors.INVALID_INPUT.format('attributes'))
955955
return None
956956

0 commit comments

Comments
 (0)
0