Refactor unnecessary else / elif when if block has a return statement

This commit is contained in:
deepsource-autofix[bot]
2021-04-09 23:30:53 +00:00
committed by GitHub
parent 86ae06de51
commit bd2a63653b
19 changed files with 52 additions and 70 deletions

View File

@@ -22,8 +22,7 @@ class AlbumId(SpotifyId.SpotifyId):
album_id = matcher.group(1)
return AlbumId(
Utils.bytes_to_hex(AlbumId._BASE62.decode(album_id, 16)))
else:
raise TypeError("Not a Spotify album ID: {}.f".format(uri))
raise TypeError("Not a Spotify album ID: {}.f".format(uri))
@staticmethod
def from_base62(base62: str) -> AlbumId:

View File

@@ -22,8 +22,7 @@ class ArtistId(SpotifyId.SpotifyId):
artist_id = matcher.group(1)
return ArtistId(
Utils.bytes_to_hex(ArtistId._BASE62.decode(artist_id, 16)))
else:
raise TypeError("Not a Spotify artist ID: {}".format(uri))
raise TypeError("Not a Spotify artist ID: {}".format(uri))
@staticmethod
def from_base62(base62: str) -> ArtistId:

View File

@@ -20,8 +20,7 @@ class EpisodeId(SpotifyId.SpotifyId, PlayableId):
return EpisodeId(
Utils.Utils.bytes_to_hex(
PlayableId.BASE62.decode(episode_id, 16)))
else:
TypeError("Not a Spotify episode ID: {}".format(uri))
TypeError("Not a Spotify episode ID: {}".format(uri))
@staticmethod
def from_base62(base62: str) -> EpisodeId:

View File

@@ -22,8 +22,7 @@ class ShowId(SpotifyId.SpotifyId):
show_id = matcher.group(1)
return ShowId(
Utils.bytes_to_hex(ShowId._BASE62.decode(show_id, 16)))
else:
raise TypeError("Not a Spotify show ID: {}".format(uri))
raise TypeError("Not a Spotify show ID: {}".format(uri))
@staticmethod
def from_base62(base62: str) -> ShowId:

View File

@@ -21,8 +21,7 @@ class TrackId(PlayableId, SpotifyId):
track_id = search.group(1)
return TrackId(
Utils.bytes_to_hex(PlayableId.BASE62.decode(track_id, 16)))
else:
raise RuntimeError("Not a Spotify track ID: {}".format(uri))
raise RuntimeError("Not a Spotify track ID: {}".format(uri))
@staticmethod
def from_base62(base62: str) -> TrackId: