@@ -147,7 +147,7 @@ def are_attributes_valid(attributes):
147
147
Boolean depending upon whether attributes are in valid format or not.
148
148
"""
149
149
150
- return type (attributes ) is dict
150
+ return isinstance (attributes , dict )
151
151
152
152
153
153
def are_event_tags_valid (event_tags ):
@@ -160,7 +160,7 @@ def are_event_tags_valid(event_tags):
160
160
Boolean depending upon whether event_tags are in valid format or not.
161
161
"""
162
162
163
- return type (event_tags ) is dict
163
+ return isinstance (event_tags , dict )
164
164
165
165
166
166
def is_user_profile_valid (user_profile ):
@@ -176,7 +176,7 @@ def is_user_profile_valid(user_profile):
176
176
if not user_profile :
177
177
return False
178
178
179
- if not type (user_profile ) is dict :
179
+ if not isinstance (user_profile , dict ) :
180
180
return False
181
181
182
182
if UserProfile .USER_ID_KEY not in user_profile :
@@ -186,11 +186,11 @@ def is_user_profile_valid(user_profile):
186
186
return False
187
187
188
188
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 ) :
190
190
return False
191
191
192
192
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 :
194
194
return False
195
195
196
196
return True
0 commit comments