@@ -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
0 commit comments