Skip to content

Commit a863208

Browse files
chore: Use identity test to compare types (#7330)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
1 parent e2c06ee commit a863208

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

app/api/celery_tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def celery_task(task_id):
2828
info = result.info
2929
# check
3030
if state == 'SUCCESS':
31-
if type(info) == dict:
31+
if type(info) is dict:
3232
# check if is error
3333
if '__error' in info:
3434
return info['result']

app/api/helpers/checksum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def __decode__(to_decode, iv, key):
117117
# Decrypt
118118
c = AES.new(key.encode('UTF-8'), AES.MODE_CBC, iv.encode('UTF-8'))
119119
to_decode = c.decrypt(to_decode)
120-
if type(to_decode) == bytes:
120+
if type(to_decode) is bytes:
121121
# convert bytes array to str.
122122
to_decode = to_decode.decode()
123123
# remove pad

app/api/helpers/export_helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ def sorted_dict(data):
128128
"""
129129
sorts a json (dict/list->dict) and returns OrderedDict
130130
"""
131-
if type(data) == OrderedDict:
131+
if type(data) is OrderedDict:
132132
data = dict(data)
133-
if type(data) == dict:
133+
if type(data) is dict:
134134
data = OrderedDict(sorted(list(data.items()), key=lambda t: t[0]))
135-
elif type(data) == list:
135+
elif type(data) is list:
136136
for count in range(len(data)):
137137
data[count] = OrderedDict(
138138
sorted(list(data[count].items()), key=lambda t: t[0])

app/api/helpers/import_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def _fix_related_fields(srv, data, service_ids):
273273
continue
274274
# else continue normal
275275
old_value = data[field[0]]
276-
if type(old_value) == list:
276+
if type(old_value) is list:
277277
ls = []
278278
for i in old_value:
279279
old_id = i['id']
@@ -282,7 +282,7 @@ def _fix_related_fields(srv, data, service_ids):
282282
del data[field[0]]
283283
data[field[1]] = ls
284284
else:
285-
if type(old_value) == dict:
285+
if type(old_value) is dict:
286286
old_id = old_value['id']
287287
else:
288288
old_id = old_value

0 commit comments

Comments
 (0)