1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2025-12-15 12:56:41 +01:00

Use isinstance rather than direct type comparison

This commit is contained in:
David Lynch 2023-08-06 17:56:13 -05:00
parent 03e9d3844f
commit 6c692968a4

View file

@ -62,12 +62,12 @@ class FictionLive(Site):
votes = {} votes = {}
for vote in segment['votes']: for vote in segment['votes']:
votechoices = segment['votes'][vote] votechoices = segment['votes'][vote]
if type(votechoices) == str: if isinstance(votechoices, str):
# This caused issue #30, where for some reason one # This caused issue #30, where for some reason one
# choice on a story was a string rather than an # choice on a story was a string rather than an
# index into the choices array. # index into the choices array.
continue continue
if type(votechoices) == int: if isinstance(votechoices, int):
votechoices = (votechoices,) votechoices = (votechoices,)
for choice in votechoices: for choice in votechoices:
if int(choice) < len(segment['choices']): if int(choice) < len(segment['choices']):