Skip to content

Commit 18252c6

Browse files
⬆️ Update dependency ruff to v0.15.2 (#755)
* ⬆️ Update dependency ruff to v0.15.2 * fix --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Joostlek <joostlek@outlook.com>
1 parent 7bceed0 commit 18252c6

File tree

4 files changed

+30
-31
lines changed

4 files changed

+30
-31
lines changed

poetry.lock

Lines changed: 20 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pylint = "4.0.4"
4242
pytest = "9.0.2"
4343
pytest-asyncio = "1.3.0"
4444
pytest-cov = "7.0.0"
45-
ruff = "0.14.14"
45+
ruff = "0.15.2"
4646
safety = "3.7.0"
4747
yamllint = "1.38.0"
4848
syrupy = "5.1.0"

src/spotifyaio/spotify.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ async def get_new_releases(self) -> list[SimplifiedAlbum]:
292292
@catch_json_decode_error
293293
async def get_artist(self, artist_id: str) -> Artist:
294294
"""Get artist."""
295-
identifier = artist_id.split(":")[-1]
295+
identifier = artist_id.rsplit(":", maxsplit=1)[-1]
296296
response = await self._get(f"v1/artists/{identifier}")
297297
return Artist.from_json(response)
298298

@@ -314,14 +314,14 @@ async def get_artists(self, artist_ids: list[str]) -> list[Artist]:
314314
async def get_artist_albums(self, artist_id: str) -> list[SimplifiedAlbum]:
315315
"""Get artist albums."""
316316
params: dict[str, Any] = {"limit": 48}
317-
identifier = artist_id.split(":")[-1]
317+
identifier = artist_id.rsplit(":", maxsplit=1)[-1]
318318
response = await self._get(f"v1/artists/{identifier}/albums", params=params)
319319
return NewReleasesResponseInner.from_json(response).items
320320

321321
@catch_json_decode_error
322322
async def get_artist_top_tracks(self, artist_id: str) -> list[Track]:
323323
"""Get artist top tracks."""
324-
identifier = artist_id.split(":")[-1]
324+
identifier = artist_id.rsplit(":", maxsplit=1)[-1]
325325
response = await self._get(f"v1/artists/{identifier}/top-tracks")
326326
return ArtistTopTracksResponse.from_json(response).tracks
327327

@@ -413,7 +413,7 @@ async def get_category(self, category_id: str) -> Category:
413413
@catch_json_decode_error
414414
async def get_chapter(self, chapter_id: str) -> Chapter:
415415
"""Get chapter."""
416-
identifier = chapter_id.split(":")[-1]
416+
identifier = chapter_id.rsplit(":", maxsplit=1)[-1]
417417
response = await self._get(f"v1/chapters/{identifier}")
418418
return Chapter.from_json(response)
419419

@@ -434,7 +434,7 @@ async def get_chapters(self, chapter_ids: list[str]) -> list[Chapter]:
434434
@catch_json_decode_error
435435
async def get_episode(self, episode_id: str) -> Episode:
436436
"""Get episode."""
437-
identifier = episode_id.split(":")[-1]
437+
identifier = episode_id.rsplit(":", maxsplit=1)[-1]
438438
response = await self._get(f"v1/episodes/{identifier}")
439439
return Episode.from_json(response)
440440

@@ -638,7 +638,7 @@ async def add_to_queue(self, uri: str, device_id: str | None = None) -> None:
638638
@catch_json_decode_error
639639
async def get_playlist(self, playlist_id: str) -> Playlist:
640640
"""Get playlist."""
641-
identifier = playlist_id.split(":")[-1]
641+
identifier = playlist_id.rsplit(":", maxsplit=1)[-1]
642642
response = await self._get(
643643
f"v1/playlists/{identifier}", params={"additional_types": "track,episode"}
644644
)
@@ -810,7 +810,7 @@ async def search(
810810
@catch_json_decode_error
811811
async def get_show(self, show_id: str) -> Show:
812812
"""Get show."""
813-
identifier = show_id.split(":")[-1]
813+
identifier = show_id.rsplit(":", maxsplit=1)[-1]
814814
response = await self._get(f"v1/shows/{identifier}")
815815
return Show.from_json(response)
816816

@@ -819,7 +819,7 @@ async def get_show(self, show_id: str) -> Show:
819819
@catch_json_decode_error
820820
async def get_show_episodes(self, show_id: str) -> list[SimplifiedEpisode]:
821821
"""Get show episodes."""
822-
identifier = show_id.split(":")[-1]
822+
identifier = show_id.rsplit(":", maxsplit=1)[-1]
823823
params: dict[str, Any] = {"limit": 48}
824824
response = await self._get(f"v1/shows/{identifier}/episodes", params=params)
825825
return ShowEpisodesResponse.from_json(response).items

src/spotifyaio/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
def get_identifier(identifier: str) -> str:
55
"""Get the identifier from a Spotify URI."""
6-
return identifier.split(":")[-1]
6+
return identifier.rsplit(":", maxsplit=1)[-1]

0 commit comments

Comments
 (0)