Skip to content

Commit

Permalink
Removed some redundant if branches.
Browse files Browse the repository at this point in the history
- 'if type(value).__module__[0:8] == "telethon"' is subsumed by 'if type(value) not in scalars and value is not None'
- 'if type(value) is dict' is unreachable since dict is not in scalars, so the loop will already have continue-d at the previous condition
  • Loading branch information
ianroberts committed Aug 22, 2023
1 parent 948d0d3 commit dc6822d
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions datasources/telegram/search_telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,17 +677,11 @@ def serialize_obj(input_obj):
mapped_obj[item] = SearchTelegram.serialize_obj(value)
elif type(value) is list:
mapped_obj[item] = [SearchTelegram.serialize_obj(item) for item in value]
elif type(value).__module__[0:8] == "telethon":
# some type of internal telethon struct
continue
elif type(value) is bytes:
mapped_obj[item] = value.hex()
elif type(value) not in scalars and value is not None:
# type we can't make sense of here
continue
elif type(value) is dict:
for key, vvalue in value:
mapped_obj[item][key] = SearchTelegram.serialize_obj(vvalue)
else:
mapped_obj[item] = value

Expand Down

0 comments on commit dc6822d

Please sign in to comment.