diff --git a/pyproject.toml b/pyproject.toml index fb8500a..02e59a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,6 @@ types-requests = "^2.31.0.1" types-python-dateutil = "^2.8.19.14" responses = "^0.23.1" ruff = "^0.0.280" -sphinx = "^7.1.0" [build-system] requires = ["poetry-core"] diff --git a/src/knuckles/models/playlist.py b/src/knuckles/models/playlist.py index 9c13011..e309dc4 100644 --- a/src/knuckles/models/playlist.py +++ b/src/knuckles/models/playlist.py @@ -73,7 +73,9 @@ def __init__( self.public = public self.cover_art = CoverArt(coverArt) if coverArt else None self.allowed_users = ( - [User(self.__subsonic, username) for username in allowedUser] if allowedUser else None + [User(self.__subsonic, username) for username in allowedUser] + if allowedUser + else None ) self.songs = ( [Song(self.__subsonic, **song) for song in entry] if entry else None diff --git a/src/knuckles/models/user.py b/src/knuckles/models/user.py index 9f35245..1e85836 100644 --- a/src/knuckles/models/user.py +++ b/src/knuckles/models/user.py @@ -81,9 +81,7 @@ def generate(self) -> "User": self.__check_api_access() - return self.subsonic.user_management.get_user( # type: ignore[union-attr] - self.username - ) + return self.subsonic.user_management.get_user(self.username) def create(self) -> Self: """Calls the "createUser" endpoint of the API. @@ -118,7 +116,7 @@ def create(self) -> Self: self.video_conversion_role, self.music_folder_id, self.max_bit_rate, - ) # type: ignore[union-attr] + ) return self @@ -154,7 +152,7 @@ def update(self) -> Self: self.video_conversion_role, self.music_folder_id, self.max_bit_rate, - ) # type: ignore[union-attr] + ) return self @@ -168,9 +166,7 @@ def delete(self) -> Self: self.__check_api_access() - self.subsonic.user_management.delete_user( # type: ignore[union-attr] - self.username - ) + self.subsonic.user_management.delete_user(self.username) return self @@ -189,8 +185,6 @@ def change_password(self, new_password: str) -> Self: self.__check_api_access() - self.subsonic.user_management.change_password( # type: ignore[union-attr] - self.username, new_password - ) + self.subsonic.user_management.change_password(self.username, new_password) return self diff --git a/src/knuckles/user_management.py b/src/knuckles/user_management.py index f330718..1278045 100644 --- a/src/knuckles/user_management.py +++ b/src/knuckles/user_management.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING from .api import Api from .models.user import User @@ -61,27 +61,29 @@ def get_users(self) -> list[User]: users: list[User] = [] for user in request: - users.append(User( - self.subsonic, - user["username"], - user["password"], - user["email"], - user["ldapAuthenticated"], - user["adminRole"], - user["settingsRole"], - user["streamRole"], - user["jukeboxRole"], - user["downloadRole"], - user["uploadRole"], - user["playlistRole"], - user["coverArtRole"], - user["commentRole"], - user["podcastRole"], - user["shareRole"], - user["videoConversionRole"], - user["musicFolderId"], - user["maxBitRate"], - )) + users.append( + User( + self.subsonic, + user["username"], + user["password"], + user["email"], + user["ldapAuthenticated"], + user["adminRole"], + user["settingsRole"], + user["streamRole"], + user["jukeboxRole"], + user["downloadRole"], + user["uploadRole"], + user["playlistRole"], + user["coverArtRole"], + user["commentRole"], + user["podcastRole"], + user["shareRole"], + user["videoConversionRole"], + user["musicFolderId"], + user["maxBitRate"], + ) + ) return users @@ -187,7 +189,9 @@ def update_user( :rtype: User """ - self.api.json_request("updateUser", { + self.api.json_request( + "updateUser", + { "username": username, "password": password, "email": email, @@ -206,7 +210,8 @@ def update_user( "videoConversionRole": video_conversion_role, "musicFolderId": music_folder_id, "maxBitRate": max_bit_rate, - }) + }, + ) updated_user = User( self.subsonic, diff --git a/tests/api/test_user_management.py b/tests/api/test_user_management.py index b487d5a..521d7d7 100644 --- a/tests/api/test_user_management.py +++ b/tests/api/test_user_management.py @@ -2,7 +2,6 @@ import responses from knuckles import Subsonic -from knuckles.models.user import User from responses import Response diff --git a/tests/models/test_user.py b/tests/models/test_user.py index 48354ed..800f3ec 100644 --- a/tests/models/test_user.py +++ b/tests/models/test_user.py @@ -1,9 +1,7 @@ from typing import Any -import pytest import responses from knuckles import Subsonic -from knuckles.exceptions import NoApiAccess from knuckles.models.user import User from responses import Response