adding Optional type hinting for limits ( fix #565 ) (#567)

* adding Optional type hinting for limits

adding Optional typing for limit in methods whose documentation explicitly allows the use of None type for no limit

* format

---------

Co-authored-by: sigma67 <sigma67.github@gmail.com>
This commit is contained in:
Allemand Instable 2024-03-20 12:53:41 +01:00 • committed by GitHub
commit d63eb07779
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View file

@ -10,7 +10,7 @@ from ._utils import *
class LibraryMixin(MixinProtocol):
def get_library_playlists(self, limit: int = 25) -> List[Dict]:
def get_library_playlists(self, limit: Optional[int] = 25) -> List[Dict]:
"""
Retrieves the playlists in the user's library.

View file

@ -12,7 +12,7 @@ from ._utils import *
class PlaylistsMixin(MixinProtocol):
def get_playlist(
self, playlistId: str, limit: int = 100, related: bool = False, suggestions_limit: int = 0
self, playlistId: str, limit: Optional[int] = 100, related: bool = False, suggestions_limit: int = 0
) -> Dict:
"""
Returns a list of playlist items

View file

@ -22,7 +22,7 @@ from ._utils import prepare_order_params, validate_order_parameter
class UploadsMixin(MixinProtocol):
def get_library_upload_songs(self, limit: int = 25, order: Optional[str] = None) -> List[Dict]:
def get_library_upload_songs(self, limit: Optional[int] = 25, order: Optional[str] = None) -> List[Dict]:
"""
Returns a list of uploaded songs
@ -69,7 +69,7 @@ class UploadsMixin(MixinProtocol):
return songs
def get_library_upload_albums(self, limit: int = 25, order: Optional[str] = None) -> List[Dict]:
def get_library_upload_albums(self, limit: Optional[int] = 25, order: Optional[str] = None) -> List[Dict]:
"""
Gets the albums of uploaded songs in the user's library.
@ -88,7 +88,9 @@ class UploadsMixin(MixinProtocol):
response, lambda additionalParams: self._send_request(endpoint, body, additionalParams), limit
)
def get_library_upload_artists(self, limit: int = 25, order: Optional[str] = None) -> List[Dict]:
def get_library_upload_artists(
self, limit: Optional[int] = 25, order: Optional[str] = None
) -> List[Dict]:
"""
Gets the artists of uploaded songs in the user's library.