Skip to content

Commit cae060f

Browse files
committed
Fix type checks
1 parent f95800a commit cae060f

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

plugins/librefm.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def librefm(text, nick, db, bot, notice):
7878

7979
tracks = response["recenttracks"]["track"]
8080

81-
if type(tracks) == list:
81+
if isinstance(tracks, list):
8282
track = tracks[0]
8383

8484
if "@attr" in track and "nowplaying" in track["@attr"] and track["@attr"]["nowplaying"] == "true":
@@ -89,7 +89,7 @@ def librefm(text, nick, db, bot, notice):
8989
status = 'is listening to'
9090
ending = '.'
9191

92-
elif type(tracks) == dict:
92+
elif isinstance(tracks, dict):
9393
track = tracks
9494
# otherwise, the user is not listening to anything right now
9595
status = 'last listened to'
@@ -138,16 +138,16 @@ def getartisttags(artist, bot):
138138
except LookupError:
139139
return 'no tags'
140140

141-
if type(tag) == dict:
141+
if isinstance(tag, dict):
142142
tag_list = tag['name']
143-
elif type(tag) == list:
143+
elif isinstance(tag, list):
144144
tag_list = []
145145
for item in tag:
146146
tag_list.append(item['name'])
147147
else:
148148
return "error returning tags"
149149

150-
if type(tag_list) == list:
150+
if isinstance(tag_list, list):
151151
tag_list = tag_list[0:4]
152152
return ', '.join(tag_list)
153153
else:
@@ -190,7 +190,7 @@ def getartistinfo(artist, bot, user=''):
190190
'autocorrect': '1'}
191191
if user:
192192
params['username'] = user
193-
request = requests.get(api_url, params=params);
193+
request = requests.get(api_url, params=params)
194194
artist = request.json()
195195
return artist
196196

plugins/yandex_translate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def list_langs(message):
5555
data = r.json()
5656
langs = data['langs']
5757
out = "Language Codes:"
58-
out += ",".join("\n{}-{}".format(key, value) for (key, value) in sorted(langs.items(), ))
58+
out += ",".join("\n{}-{}".format(key, value) for (key, value) in sorted(langs.items(),))
5959
out += "\n\nTranslation directions:"
6060
out += ",".join("\n{}".format(code) for code in data['dirs'])
6161
paste = web.paste(out, ext="txt")

0 commit comments

Comments
 (0)