From 378bd1c3629c2413817af34b30a86964220bf64e Mon Sep 17 00:00:00 2001 From: "Ilya (Marshal)" Date: Fri, 17 Nov 2023 22:37:12 +0100 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D0=B0=D0=BD=D0=BD=D0=BE=D1=82=D0=B0=D1=86=D0=B8=D0=B8?= =?UTF-8?q?=20=D1=82=D0=B8=D0=BF=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generate_async_version.py | 4 ++-- generate_camel_case_aliases.py | 4 ++-- ruff.toml | 7 ++++--- setup.py | 2 +- yandex_music/account/account.py | 2 +- yandex_music/account/alert.py | 2 +- yandex_music/account/alert_button.py | 2 +- yandex_music/account/auto_renewable.py | 2 +- yandex_music/account/deactivation.py | 2 +- yandex_music/account/non_auto_renewable.py | 2 +- yandex_music/account/operator.py | 2 +- yandex_music/account/passport_phone.py | 2 +- yandex_music/account/permissions.py | 2 +- yandex_music/account/plus.py | 2 +- yandex_music/account/price.py | 2 +- yandex_music/account/product.py | 2 +- yandex_music/account/renewable_remainder.py | 2 +- yandex_music/account/status.py | 2 +- yandex_music/account/subscription.py | 2 +- yandex_music/account/user_settings.py | 2 +- yandex_music/album/album.py | 2 +- yandex_music/album/deprecation.py | 2 +- yandex_music/album/label.py | 2 +- yandex_music/album/track_position.py | 2 +- yandex_music/artist/artist.py | 14 +++++++++----- yandex_music/artist/artist_albums.py | 4 ++-- yandex_music/artist/artist_tracks.py | 4 ++-- yandex_music/artist/brief_info.py | 2 +- yandex_music/artist/counts.py | 2 +- yandex_music/artist/description.py | 2 +- yandex_music/artist/link.py | 2 +- yandex_music/artist/ratings.py | 2 +- yandex_music/artist/vinyl.py | 2 +- yandex_music/base.py | 14 +++++++------- yandex_music/client.py | 10 ++++++---- yandex_music/client_async.py | 8 ++++---- yandex_music/cover.py | 2 +- yandex_music/download_info.py | 2 +- yandex_music/exceptions.py | 2 +- yandex_music/experiments.py | 2 +- yandex_music/feed/album_event.py | 2 +- yandex_music/feed/artist_event.py | 2 +- yandex_music/feed/day.py | 2 +- yandex_music/feed/event.py | 2 +- yandex_music/feed/feed.py | 2 +- yandex_music/feed/generated_playlist.py | 2 +- yandex_music/feed/track_with_ads.py | 2 +- yandex_music/genre/genre.py | 2 +- yandex_music/genre/images.py | 2 +- yandex_music/genre/title.py | 8 ++++---- yandex_music/icon.py | 4 ++-- yandex_music/invocation_info.py | 2 +- yandex_music/landing/block.py | 2 +- yandex_music/landing/block_entity.py | 2 +- yandex_music/landing/chart.py | 2 +- yandex_music/landing/chart_info.py | 2 +- yandex_music/landing/chart_info_menu.py | 2 +- yandex_music/landing/chart_info_menu_item.py | 2 +- yandex_music/landing/chart_item.py | 2 +- yandex_music/landing/landing.py | 4 ++-- yandex_music/landing/landing_list.py | 2 +- yandex_music/landing/mix_link.py | 2 +- yandex_music/landing/personal_playlists_data.py | 2 +- yandex_music/landing/play_context.py | 2 +- yandex_music/landing/play_contexts_data.py | 2 +- yandex_music/landing/promotion.py | 2 +- yandex_music/landing/track_id.py | 2 +- yandex_music/landing/track_short_old.py | 2 +- yandex_music/like.py | 2 +- yandex_music/pager.py | 2 +- yandex_music/playlist/brand.py | 2 +- yandex_music/playlist/case_forms.py | 2 +- yandex_music/playlist/contest.py | 2 +- yandex_music/playlist/custom_wave.py | 2 +- yandex_music/playlist/made_for.py | 2 +- yandex_music/playlist/open_graph_data.py | 2 +- yandex_music/playlist/play_counter.py | 2 +- yandex_music/playlist/playlist.py | 6 +++--- yandex_music/playlist/playlist_absence.py | 2 +- yandex_music/playlist/playlist_id.py | 12 ++++++------ yandex_music/playlist/playlist_recommendation.py | 2 +- yandex_music/playlist/tag.py | 2 +- yandex_music/playlist/tag_result.py | 2 +- yandex_music/playlist/user.py | 2 +- yandex_music/promo_code_status.py | 2 +- yandex_music/queue/context.py | 2 +- yandex_music/queue/queue.py | 2 +- yandex_music/queue/queue_item.py | 2 +- yandex_music/rotor/ad_params.py | 2 +- yandex_music/rotor/dashboard.py | 2 +- yandex_music/rotor/discrete_scale.py | 2 +- yandex_music/rotor/enum.py | 2 +- yandex_music/rotor/id.py | 2 +- yandex_music/rotor/restrictions.py | 2 +- yandex_music/rotor/rotor_settings.py | 2 +- yandex_music/rotor/sequence.py | 2 +- yandex_music/rotor/station.py | 2 +- yandex_music/rotor/station_data.py | 2 +- yandex_music/rotor/station_result.py | 2 +- yandex_music/rotor/station_tracks_result.py | 4 ++-- yandex_music/rotor/value.py | 2 +- yandex_music/search/best.py | 2 +- yandex_music/search/search.py | 2 +- yandex_music/search/search_result.py | 2 +- yandex_music/search/suggestions.py | 8 ++++---- yandex_music/settings.py | 2 +- yandex_music/shot/shot.py | 2 +- yandex_music/shot/shot_data.py | 2 +- yandex_music/shot/shot_event.py | 2 +- yandex_music/shot/shot_type.py | 2 +- yandex_music/supplement/lyrics.py | 2 +- yandex_music/supplement/supplement.py | 2 +- yandex_music/supplement/video_supplement.py | 2 +- yandex_music/track/licence_text_part.py | 2 +- yandex_music/track/lyrics_info.py | 2 +- yandex_music/track/lyrics_major.py | 2 +- yandex_music/track/major.py | 2 +- yandex_music/track/meta_data.py | 2 +- yandex_music/track/normalization.py | 2 +- yandex_music/track/poetry_lover_match.py | 2 +- yandex_music/track/r128.py | 2 +- yandex_music/track/track.py | 6 +++--- yandex_music/track/track_lyrics.py | 2 +- yandex_music/track/tracks_similar.py | 4 ++-- yandex_music/track_short.py | 2 +- yandex_music/tracks_list.py | 4 ++-- yandex_music/utils/__init__.py | 2 +- yandex_music/utils/difference.py | 2 +- yandex_music/video.py | 2 +- 129 files changed, 178 insertions(+), 171 deletions(-) diff --git a/generate_async_version.py b/generate_async_version.py index e2c5a2fa..f7795e3b 100755 --- a/generate_async_version.py +++ b/generate_async_version.py @@ -7,7 +7,7 @@ REQUEST_METHODS = ('_request_wrapper', 'get', 'post', 'retrieve', 'download') -def gen_request(output_request_filename): +def gen_request(output_request_filename: str) -> None: with open('yandex_music/utils/request.py', 'r', encoding='UTF-8') as f: code = f.read() @@ -47,7 +47,7 @@ def gen_request(output_request_filename): f.write(code) -def gen_client(output_client_filename): +def gen_client(output_client_filename: str) -> None: with open('yandex_music/client.py', 'r', encoding='UTF-8') as f: code = f.read() diff --git a/generate_camel_case_aliases.py b/generate_camel_case_aliases.py index b973d0c6..4e346c12 100755 --- a/generate_camel_case_aliases.py +++ b/generate_camel_case_aliases.py @@ -32,7 +32,7 @@ def convert_snake_case_to_camel_case(string: str) -> str: return camel_case[0].lower() + camel_case[1:] -def _generate_code(function_name: str, intent=0) -> str: +def _generate_code(function_name: str, intent: int = 0) -> str: camel_case_name = convert_snake_case_to_camel_case(function_name) code = ALIAS_TEMPLATE.format(name=function_name, camel_case_name=camel_case_name) @@ -85,7 +85,7 @@ def _process_file(file: str) -> None: f.write(new_file_code) -def main(): +def main() -> None: for root, _, files in os.walk(SOURCE_FOLDER): for file in files: if file.endswith('.py') and file != '__init__.py': diff --git a/ruff.toml b/ruff.toml index 550ee52f..7c96c3a7 100644 --- a/ruff.toml +++ b/ruff.toml @@ -8,7 +8,7 @@ extend-select = [ "Q", # flake8-quotes "S", # flake8-bandit "ASYNC", # flake8-async - # "ANN", # flake8-annotations. Not all resolved yet + "ANN", # annotations "C", "BLE", "ERA", @@ -37,13 +37,14 @@ ignore = [ ] [per-file-ignores] -"examples/*.py" = ["T201", "S311", "ERA001", "INP001", "S106", "BLE001", "S603"] +"examples/*.py" = ["T201", "S311", "ERA001", "INP001", "S106", "BLE001", "S603", "ANN"] "docs/source/conf.py" = ["INP001"] -"tests/*.py" = ["S101"] # Use of assert +"tests/*.py" = ["S101", "ANN"] # Use of assert "tests/__init__.py" = ["F401"] # Unused import "yandex_music/__init__.py" = ["I001"] # Import sort "yandex_music/client*.py" = ["T201"] # print "test.py" = ["S101", "ERA001", "T201", "E501", "F401", "F841"] +"yandex_music/utils/request*.py" = ["ANN"] # TODO(MarshalX): annotate and remove this ignore [flake8-quotes] docstring-quotes = "double" diff --git a/setup.py b/setup.py index 5fbec79c..e8c587f5 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ class PyTest(test): - def run_tests(self): + def run_tests(self) -> None: import pytest sys.exit(pytest.main(['tests'])) diff --git a/yandex_music/account/account.py b/yandex_music/account/account.py index 6d4e8e58..e91384a6 100644 --- a/yandex_music/account/account.py +++ b/yandex_music/account/account.py @@ -49,7 +49,7 @@ class Account(YandexMusicObject): child: bool = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: if self.uid: self._id_attrs = (self.uid,) diff --git a/yandex_music/account/alert.py b/yandex_music/account/alert.py index 35d37ec3..66843e0d 100644 --- a/yandex_music/account/alert.py +++ b/yandex_music/account/alert.py @@ -37,7 +37,7 @@ class Alert(YandexMusicObject): close_button: bool client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.alert_id,) @classmethod diff --git a/yandex_music/account/alert_button.py b/yandex_music/account/alert_button.py index 971fdfd8..d9dc9452 100644 --- a/yandex_music/account/alert_button.py +++ b/yandex_music/account/alert_button.py @@ -25,7 +25,7 @@ class AlertButton(YandexMusicObject): uri: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.text, self.uri) @classmethod diff --git a/yandex_music/account/auto_renewable.py b/yandex_music/account/auto_renewable.py index d6843e1f..61fd4012 100644 --- a/yandex_music/account/auto_renewable.py +++ b/yandex_music/account/auto_renewable.py @@ -33,7 +33,7 @@ class AutoRenewable(YandexMusicObject): order_id: Optional[int] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.expires, self.vendor, self.vendor_help_url, self.product, self.finished) @classmethod diff --git a/yandex_music/account/deactivation.py b/yandex_music/account/deactivation.py index f20e6a23..d98d17ca 100644 --- a/yandex_music/account/deactivation.py +++ b/yandex_music/account/deactivation.py @@ -24,7 +24,7 @@ class Deactivation(YandexMusicObject): instructions: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.method, self.instructions) @classmethod diff --git a/yandex_music/account/non_auto_renewable.py b/yandex_music/account/non_auto_renewable.py index 716e5a1c..3f0d164c 100644 --- a/yandex_music/account/non_auto_renewable.py +++ b/yandex_music/account/non_auto_renewable.py @@ -21,7 +21,7 @@ class NonAutoRenewable(YandexMusicObject): end: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.start, self.end) @classmethod diff --git a/yandex_music/account/operator.py b/yandex_music/account/operator.py index 067cc417..ac3a07d2 100644 --- a/yandex_music/account/operator.py +++ b/yandex_music/account/operator.py @@ -29,7 +29,7 @@ class Operator(YandexMusicObject): suspended: bool client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.product_id, self.phone) @classmethod diff --git a/yandex_music/account/passport_phone.py b/yandex_music/account/passport_phone.py index 346113c7..8557dc23 100644 --- a/yandex_music/account/passport_phone.py +++ b/yandex_music/account/passport_phone.py @@ -19,7 +19,7 @@ class PassportPhone(YandexMusicObject): phone: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.phone,) @classmethod diff --git a/yandex_music/account/permissions.py b/yandex_music/account/permissions.py index 03831d0e..0b7d124f 100644 --- a/yandex_music/account/permissions.py +++ b/yandex_music/account/permissions.py @@ -23,7 +23,7 @@ class Permissions(YandexMusicObject): default: List[str] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.until, self.values, self.default) @classmethod diff --git a/yandex_music/account/plus.py b/yandex_music/account/plus.py index f661700e..4630938c 100644 --- a/yandex_music/account/plus.py +++ b/yandex_music/account/plus.py @@ -21,7 +21,7 @@ class Plus(YandexMusicObject): is_tutorial_completed: bool client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.has_plus, self.is_tutorial_completed) @classmethod diff --git a/yandex_music/account/price.py b/yandex_music/account/price.py index cad00c96..2a1d6393 100644 --- a/yandex_music/account/price.py +++ b/yandex_music/account/price.py @@ -21,7 +21,7 @@ class Price(YandexMusicObject): currency: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.amount, self.currency) @classmethod diff --git a/yandex_music/account/product.py b/yandex_music/account/product.py index a5d98f7c..c3f899d2 100644 --- a/yandex_music/account/product.py +++ b/yandex_music/account/product.py @@ -76,7 +76,7 @@ class Product(YandexMusicObject): payment_method_types: List[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.product_id, self.type, diff --git a/yandex_music/account/renewable_remainder.py b/yandex_music/account/renewable_remainder.py index b4cee114..a7ada09d 100644 --- a/yandex_music/account/renewable_remainder.py +++ b/yandex_music/account/renewable_remainder.py @@ -22,7 +22,7 @@ class RenewableRemainder(YandexMusicObject): days: int client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.days,) @classmethod diff --git a/yandex_music/account/status.py b/yandex_music/account/status.py index b98291b9..97057a1a 100644 --- a/yandex_music/account/status.py +++ b/yandex_music/account/status.py @@ -51,7 +51,7 @@ class Status(YandexMusicObject): userhash: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.account, self.permissions) @classmethod diff --git a/yandex_music/account/subscription.py b/yandex_music/account/subscription.py index 22fb68f6..1580fc5c 100644 --- a/yandex_music/account/subscription.py +++ b/yandex_music/account/subscription.py @@ -35,7 +35,7 @@ class Subscription(YandexMusicObject): end: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.non_auto_renewable_remainder, self.auto_renewable, self.family_auto_renewable) @classmethod diff --git a/yandex_music/account/user_settings.py b/yandex_music/account/user_settings.py index 007ebc9e..a31ea4a8 100644 --- a/yandex_music/account/user_settings.py +++ b/yandex_music/account/user_settings.py @@ -61,7 +61,7 @@ class UserSettings(YandexMusicObject): show_disk_tracks_in_library: Optional[bool] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.uid, self.last_fm_scrobbling_enabled, diff --git a/yandex_music/album/album.py b/yandex_music/album/album.py index c5755d45..bf371436 100644 --- a/yandex_music/album/album.py +++ b/yandex_music/album/album.py @@ -120,7 +120,7 @@ class Album(YandexMusicObject): available_for_options: Optional[List[str]] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id,) def with_tracks(self, *args, **kwargs) -> Optional['Album']: diff --git a/yandex_music/album/deprecation.py b/yandex_music/album/deprecation.py index 8dc6f6b3..7f9eb50b 100644 --- a/yandex_music/album/deprecation.py +++ b/yandex_music/album/deprecation.py @@ -23,7 +23,7 @@ class Deprecation(YandexMusicObject): done: Optional[bool] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.target_album_id, self.status, self.done) @classmethod diff --git a/yandex_music/album/label.py b/yandex_music/album/label.py index 5335457f..37f2b1c0 100644 --- a/yandex_music/album/label.py +++ b/yandex_music/album/label.py @@ -21,7 +21,7 @@ class Label(YandexMusicObject): name: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.name) @classmethod diff --git a/yandex_music/album/track_position.py b/yandex_music/album/track_position.py index 733aab3f..ac321349 100644 --- a/yandex_music/album/track_position.py +++ b/yandex_music/album/track_position.py @@ -26,7 +26,7 @@ class TrackPosition(YandexMusicObject): index: int client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.volume, self.index) @classmethod diff --git a/yandex_music/artist/artist.py b/yandex_music/artist/artist.py index 13edb7ff..44803ee6 100644 --- a/yandex_music/artist/artist.py +++ b/yandex_music/artist/artist.py @@ -78,7 +78,7 @@ class Artist(YandexMusicObject): ya_money_id: Optional[str] = None client: 'Client' = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.name, self.cover) def get_op_image_url(self, size: str = '200x200') -> str: @@ -223,28 +223,32 @@ async def dislike_async(self, *args, **kwargs) -> bool: """ return await self.client.users_likes_artists_remove(self.id, self.client.me.account.uid, *args, **kwargs) - def get_tracks(self, page=0, page_size=20, *args, **kwargs) -> Optional['ArtistTracks']: + def get_tracks(self, page: int = 0, page_size: int = 20, *args, **kwargs) -> Optional['ArtistTracks']: """Сокращение для:: client.artists_tracks(artist.id, page, page_size, *args, **kwargs) """ return self.client.artists_tracks(self.id, page, page_size, *args, **kwargs) - async def get_tracks_async(self, page=0, page_size=20, *args, **kwargs) -> Optional['ArtistTracks']: + async def get_tracks_async(self, page: int = 0, page_size: int = 20, *args, **kwargs) -> Optional['ArtistTracks']: """Сокращение для:: await client.artists_tracks(artist.id, page, page_size, *args, **kwargs) """ return await self.client.artists_tracks(self.id, page, page_size, *args, **kwargs) - def get_albums(self, page=0, page_size=20, sort_by='year', *args, **kwargs) -> Optional['ArtistAlbums']: + def get_albums( + self, page: int = 0, page_size: int = 20, sort_by: str = 'year', *args, **kwargs + ) -> Optional['ArtistAlbums']: """Сокращение для:: client.artists_direct_albums(artist.id, page, page_size, sort_by, *args, **kwargs) """ return self.client.artists_direct_albums(self.id, page, page_size, sort_by, *args, **kwargs) - async def get_albums_async(self, page=0, page_size=20, sort_by='year', *args, **kwargs) -> Optional['ArtistAlbums']: + async def get_albums_async( + self, page: int = 0, page_size: int = 20, sort_by: str = 'year', *args, **kwargs + ) -> Optional['ArtistAlbums']: """Сокращение для:: await client.artists_direct_albums(artist.id, page, page_size, sort_by, *args, **kwargs) diff --git a/yandex_music/artist/artist_albums.py b/yandex_music/artist/artist_albums.py index fcff24cd..924f9cb6 100644 --- a/yandex_music/artist/artist_albums.py +++ b/yandex_music/artist/artist_albums.py @@ -21,10 +21,10 @@ class ArtistAlbums(YandexMusicObject): pager: Optional['Pager'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.pager, self.albums) - def __getitem__(self, item) -> 'Album': + def __getitem__(self, item: int) -> 'Album': return self.albums[item] def __iter__(self) -> Iterator['Album']: diff --git a/yandex_music/artist/artist_tracks.py b/yandex_music/artist/artist_tracks.py index 87683450..296fcaec 100644 --- a/yandex_music/artist/artist_tracks.py +++ b/yandex_music/artist/artist_tracks.py @@ -21,10 +21,10 @@ class ArtistTracks(YandexMusicObject): pager: Optional['Pager'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.pager, self.tracks) - def __getitem__(self, item) -> 'Track': + def __getitem__(self, item: int) -> 'Track': return self.tracks[item] def __iter__(self) -> Iterator['Track']: diff --git a/yandex_music/artist/brief_info.py b/yandex_music/artist/brief_info.py index a202f430..fe2cd869 100644 --- a/yandex_music/artist/brief_info.py +++ b/yandex_music/artist/brief_info.py @@ -47,7 +47,7 @@ class BriefInfo(YandexMusicObject): tracks_in_chart: List['Chart'] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.artist, self.albums, diff --git a/yandex_music/artist/counts.py b/yandex_music/artist/counts.py index a529bcf2..ed713bef 100644 --- a/yandex_music/artist/counts.py +++ b/yandex_music/artist/counts.py @@ -29,7 +29,7 @@ class Counts(YandexMusicObject): also_tracks: int client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.tracks, self.direct_albums, self.also_albums, self.also_tracks) @classmethod diff --git a/yandex_music/artist/description.py b/yandex_music/artist/description.py index 5683fde4..c1a87010 100644 --- a/yandex_music/artist/description.py +++ b/yandex_music/artist/description.py @@ -25,7 +25,7 @@ class Description(YandexMusicObject): uri: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.text, self.uri) @classmethod diff --git a/yandex_music/artist/link.py b/yandex_music/artist/link.py index ff9123ba..244bc323 100644 --- a/yandex_music/artist/link.py +++ b/yandex_music/artist/link.py @@ -28,7 +28,7 @@ class Link(YandexMusicObject): social_network: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.title, self.href, self.type) @classmethod diff --git a/yandex_music/artist/ratings.py b/yandex_music/artist/ratings.py index 99561e31..884c7965 100644 --- a/yandex_music/artist/ratings.py +++ b/yandex_music/artist/ratings.py @@ -23,7 +23,7 @@ class Ratings(YandexMusicObject): day: Optional[int] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.week, self.month) @classmethod diff --git a/yandex_music/artist/vinyl.py b/yandex_music/artist/vinyl.py index 8f70c5eb..2d9a1155 100644 --- a/yandex_music/artist/vinyl.py +++ b/yandex_music/artist/vinyl.py @@ -34,7 +34,7 @@ class Vinyl(YandexMusicObject): picture: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.title, self.price, diff --git a/yandex_music/base.py b/yandex_music/base.py index c35d1ed4..324853a7 100644 --- a/yandex_music/base.py +++ b/yandex_music/base.py @@ -31,11 +31,11 @@ def __str__(self) -> str: def __repr__(self) -> str: return str(self) - def __getitem__(self, item): + def __getitem__(self, item: str) -> Any: # noqa: ANN401 return self.__dict__[item] @staticmethod - def report_unknown_fields_callback(cls, unknown_fields): + def report_unknown_fields_callback(cls: type, unknown_fields: dict) -> None: logger.warning( f'Found unknown fields received from API! Please copy warn message ' f'and send to {new_issue_by_template_url} (github issue), thank you!' @@ -43,7 +43,7 @@ def report_unknown_fields_callback(cls, unknown_fields): logger.warning(f'Type: {cls.__module__}.{cls.__name__}; fields: {unknown_fields}') @staticmethod - def is_valid_model_data(data: Any, *, array: bool = False) -> bool: + def is_valid_model_data(data: Any, *, array: bool = False) -> bool: # noqa: ANN401 if array: return data and isinstance(data, list) and all(isinstance(item, dict) for item in data) @@ -81,7 +81,7 @@ def de_json(cls, data: dict, client: Optional['Client']) -> Optional[dict]: return cleaned_data - def to_json(self, for_request=False) -> str: + def to_json(self, for_request: bool = False) -> str: """Сериализация объекта. Args: @@ -92,7 +92,7 @@ def to_json(self, for_request=False) -> str: """ return json.dumps(self.to_dict(for_request), ensure_ascii=not ujson) - def to_dict(self, for_request=False) -> dict: + def to_dict(self, for_request: bool = False) -> dict: """Рекурсивная сериализация объекта. Args: @@ -107,7 +107,7 @@ def to_dict(self, for_request=False) -> dict: :obj:`dict`: Сериализованный в dict объект. """ - def parse(val): + def parse(val: Any) -> Any: # noqa: ANN401 if hasattr(val, 'to_dict'): return val.to_dict(for_request) if isinstance(val, list): @@ -135,7 +135,7 @@ def parse(val): return parse(data) - def __eq__(self, other) -> bool: + def __eq__(self, other: Any) -> bool: # noqa: ANN401 """Проверка на равенство двух объектов. Note: diff --git a/yandex_music/client.py b/yandex_music/client.py index 2bc63957..61069221 100644 --- a/yandex_music/client.py +++ b/yandex_music/client.py @@ -64,7 +64,7 @@ def log(method: F) -> F: logger = logging.getLogger(method.__module__) @functools.wraps(method) - def wrapper(*args, **kwargs) -> Any: + def wrapper(*args, **kwargs) -> Any: # noqa: ANN401: logger.debug(f'Entering: {method.__name__}') result = method(*args, **kwargs) @@ -112,7 +112,7 @@ def __init__( base_url: str = None, request: Request = None, language: str = 'ru', - report_unknown_fields=False, + report_unknown_fields: bool = False, ) -> None: if not Client.__notice_displayed: print(f'Yandex Music API v{__version__}, {__copyright__}') @@ -151,7 +151,7 @@ def request(self) -> Request: return self._request @log - def init(self): + def init(self) -> 'Client': """Получение информацию об аккаунте использующихся в других запросах.""" self.me = self.account_status() return self @@ -862,7 +862,9 @@ def users_playlists( return Playlist.de_json(result, self) @log - def users_playlists_recommendations(self, kind: Union[str, int], user_id: Union[str, int] = None, *args, **kwargs): + def users_playlists_recommendations( + self, kind: Union[str, int], user_id: Union[str, int] = None, *args, **kwargs + ) -> Optional[PlaylistRecommendations]: """Получение рекомендаций для плейлиста. Args: diff --git a/yandex_music/client_async.py b/yandex_music/client_async.py index 617bcdf8..6d880511 100644 --- a/yandex_music/client_async.py +++ b/yandex_music/client_async.py @@ -68,7 +68,7 @@ def log(method: F) -> F: logger = logging.getLogger(method.__module__) @functools.wraps(method) - async def wrapper(*args, **kwargs) -> Any: + async def wrapper(*args, **kwargs) -> Any: # noqa: ANN401: logger.debug(f'Entering: {method.__name__}') result = await method(*args, **kwargs) @@ -116,7 +116,7 @@ def __init__( base_url: str = None, request: Request = None, language: str = 'ru', - report_unknown_fields=False, + report_unknown_fields: bool = False, ) -> None: if not ClientAsync.__notice_displayed: print(f'Yandex Music API v{__version__}, {__copyright__}') @@ -155,7 +155,7 @@ def request(self) -> Request: return self._request @log - async def init(self): + async def init(self) -> 'ClientAsync': """Получение информацию об аккаунте использующихся в других запросах.""" self.me = await self.account_status() return self @@ -870,7 +870,7 @@ async def users_playlists( @log async def users_playlists_recommendations( self, kind: Union[str, int], user_id: Union[str, int] = None, *args, **kwargs - ): + ) -> Optional[PlaylistRecommendations]: """Получение рекомендаций для плейлиста. Args: diff --git a/yandex_music/cover.py b/yandex_music/cover.py index d81d7fbe..97e5fb94 100644 --- a/yandex_music/cover.py +++ b/yandex_music/cover.py @@ -39,7 +39,7 @@ class Cover(YandexMusicObject): error: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.prefix, self.version, self.uri, self.items_uri) def get_url(self, index: int = 0, size: str = '200x200') -> str: diff --git a/yandex_music/download_info.py b/yandex_music/download_info.py index 877df245..0469f7ff 100644 --- a/yandex_music/download_info.py +++ b/yandex_music/download_info.py @@ -35,7 +35,7 @@ class DownloadInfo(YandexMusicObject): direct: bool client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self.direct_link = None self._id_attrs = (self.codec, self.bitrate_in_kbps, self.gain, self.preview, self.download_info_url) diff --git a/yandex_music/exceptions.py b/yandex_music/exceptions.py index 1162210e..827310b6 100644 --- a/yandex_music/exceptions.py +++ b/yandex_music/exceptions.py @@ -34,5 +34,5 @@ class NotFoundError(NetworkError): class TimedOutError(NetworkError): """Класс исключения, вызываемого для случаев истечения времени ожидания.""" - def __init__(self): + def __init__(self) -> None: super().__init__('Timed out') diff --git a/yandex_music/experiments.py b/yandex_music/experiments.py index 674a4272..357b5268 100644 --- a/yandex_music/experiments.py +++ b/yandex_music/experiments.py @@ -20,7 +20,7 @@ class Experiments(YandexMusicObject): **kwargs: Собственно тут и передаются все эти свистелки. """ - def __init__(self, client: Optional['Client'] = None, **kwargs): + def __init__(self, client: Optional['Client'] = None, **kwargs) -> None: self.__dict__.update(kwargs) self.client = client diff --git a/yandex_music/feed/album_event.py b/yandex_music/feed/album_event.py index 7cc575ee..6f6b5973 100644 --- a/yandex_music/feed/album_event.py +++ b/yandex_music/feed/album_event.py @@ -21,7 +21,7 @@ class AlbumEvent(YandexMusicObject): tracks: List['Track'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.album, self.tracks) @classmethod diff --git a/yandex_music/feed/artist_event.py b/yandex_music/feed/artist_event.py index 8ebb85b6..8d242def 100644 --- a/yandex_music/feed/artist_event.py +++ b/yandex_music/feed/artist_event.py @@ -25,7 +25,7 @@ class ArtistEvent(YandexMusicObject): subscribed: Optional['bool'] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.artist, self.tracks, self.similar_to_artists_from_history) @classmethod diff --git a/yandex_music/feed/day.py b/yandex_music/feed/day.py index 7883ae4e..3adb2cfd 100644 --- a/yandex_music/feed/day.py +++ b/yandex_music/feed/day.py @@ -25,7 +25,7 @@ class Day(YandexMusicObject): tracks_to_play: List['Track'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.day, self.events, self.tracks_to_play_with_ads, self.tracks_to_play) @classmethod diff --git a/yandex_music/feed/event.py b/yandex_music/feed/event.py index 3b11d00d..b49d2de7 100644 --- a/yandex_music/feed/event.py +++ b/yandex_music/feed/event.py @@ -49,7 +49,7 @@ class Event(YandexMusicObject): genre: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.type) @classmethod diff --git a/yandex_music/feed/feed.py b/yandex_music/feed/feed.py index f36f150e..e3bab2f0 100644 --- a/yandex_music/feed/feed.py +++ b/yandex_music/feed/feed.py @@ -36,7 +36,7 @@ class Feed(YandexMusicObject): next_revision: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.can_get_more_events, self.generated_playlists, self.headlines, self.today, self.days) @classmethod diff --git a/yandex_music/feed/generated_playlist.py b/yandex_music/feed/generated_playlist.py index ce3bbacd..7eef7f8b 100644 --- a/yandex_music/feed/generated_playlist.py +++ b/yandex_music/feed/generated_playlist.py @@ -33,7 +33,7 @@ class GeneratedPlaylist(YandexMusicObject): preview_description: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.type, self.ready, self.notify, self.data) @classmethod diff --git a/yandex_music/feed/track_with_ads.py b/yandex_music/feed/track_with_ads.py index 16d08b46..fcfc849f 100644 --- a/yandex_music/feed/track_with_ads.py +++ b/yandex_music/feed/track_with_ads.py @@ -24,7 +24,7 @@ class TrackWithAds(YandexMusicObject): track: Optional['Track'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.type, self.track) @classmethod diff --git a/yandex_music/genre/genre.py b/yandex_music/genre/genre.py index 681cce57..2346cd0c 100644 --- a/yandex_music/genre/genre.py +++ b/yandex_music/genre/genre.py @@ -45,7 +45,7 @@ class Genre(YandexMusicObject): hide_in_regions = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.weight, self.composer_top, self.title, self.images, self.show_in_menu) @classmethod diff --git a/yandex_music/genre/images.py b/yandex_music/genre/images.py index 3a34f3f2..666b08a6 100644 --- a/yandex_music/genre/images.py +++ b/yandex_music/genre/images.py @@ -21,7 +21,7 @@ class Images(YandexMusicObject): _300x300: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self._208x208, self._300x300) def download_208x208(self, filename: str) -> None: diff --git a/yandex_music/genre/title.py b/yandex_music/genre/title.py index c4007fc7..4377c19f 100644 --- a/yandex_music/genre/title.py +++ b/yandex_music/genre/title.py @@ -21,7 +21,7 @@ class Title(YandexMusicObject): full_title: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.title, self.full_title) @classmethod @@ -43,15 +43,15 @@ def de_json(cls, data: dict, client: 'Client') -> Optional['Title']: return cls(client=client, **data) @classmethod - def de_dict(cls, data, client) -> Dict[str, Optional['Title']]: + def de_dict(cls, data: dict, client: 'Client') -> Dict[str, Optional['Title']]: """Десериализация списка объектов. Args: - data (:obj:`list`): Список словарей с полями и значениями десериализуемого объекта. + data (:obj:`dict`): Словарь с полями и значениями десериализуемого объекта. client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music. Returns: - :obj:`list` из :obj:`yandex_music.Title`: Заголовки жанров. + :obj:`dict` где ключ это язык :obj:`str`, а значение :obj:`yandex_music.Title`: Заголовки жанров. """ if not data: return {} diff --git a/yandex_music/icon.py b/yandex_music/icon.py index f0175e72..ef02bd82 100644 --- a/yandex_music/icon.py +++ b/yandex_music/icon.py @@ -21,7 +21,7 @@ class Icon(YandexMusicObject): image_url: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.background_color, self.image_url) def download(self, filename: str, size: str = '200x200') -> None: @@ -64,7 +64,7 @@ async def download_bytes_async(self, size: str = '200x200') -> bytes: """ return await self.client.request.retrieve(self.get_url(size)) - def get_url(self, size: str = '200x200'): + def get_url(self, size: str = '200x200') -> str: """Получение URL иконки. Args: diff --git a/yandex_music/invocation_info.py b/yandex_music/invocation_info.py index 7b745745..41be71b3 100644 --- a/yandex_music/invocation_info.py +++ b/yandex_music/invocation_info.py @@ -23,7 +23,7 @@ class InvocationInfo(YandexMusicObject): exec_duration_millis: Optional[int] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.hostname, self.req_id) @classmethod diff --git a/yandex_music/landing/block.py b/yandex_music/landing/block.py index 6379e518..808574ab 100644 --- a/yandex_music/landing/block.py +++ b/yandex_music/landing/block.py @@ -35,7 +35,7 @@ class Block(YandexMusicObject): data: Optional[Union['PersonalPlaylistsData', 'PlayContextsData']] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.type, self.type_for_from, self.title, self.entities) def __getitem__(self, item: int) -> 'BlockEntity': diff --git a/yandex_music/landing/block_entity.py b/yandex_music/landing/block_entity.py index 473f42f0..52760d96 100644 --- a/yandex_music/landing/block_entity.py +++ b/yandex_music/landing/block_entity.py @@ -50,7 +50,7 @@ class BlockEntity(YandexMusicObject): data: Union['GeneratedPlaylist', 'Promotion', 'Album', 'Playlist', 'ChartItem', 'PlayContext', 'MixLink'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.type, self.data) @classmethod diff --git a/yandex_music/landing/chart.py b/yandex_music/landing/chart.py index 3466f121..02665284 100644 --- a/yandex_music/landing/chart.py +++ b/yandex_music/landing/chart.py @@ -32,7 +32,7 @@ class Chart(YandexMusicObject): track_id: Optional['TrackId'] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.position, self.progress, self.listeners, self.shift, self.track_id) @classmethod diff --git a/yandex_music/landing/chart_info.py b/yandex_music/landing/chart_info.py index 66875277..75fec774 100644 --- a/yandex_music/landing/chart_info.py +++ b/yandex_music/landing/chart_info.py @@ -31,7 +31,7 @@ class ChartInfo(YandexMusicObject): chart_description: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id,) @classmethod diff --git a/yandex_music/landing/chart_info_menu.py b/yandex_music/landing/chart_info_menu.py index d3a25cea..155a9ce5 100644 --- a/yandex_music/landing/chart_info_menu.py +++ b/yandex_music/landing/chart_info_menu.py @@ -19,7 +19,7 @@ class ChartInfoMenu(YandexMusicObject): items: List['ChartInfoMenuItem'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.items,) @classmethod diff --git a/yandex_music/landing/chart_info_menu_item.py b/yandex_music/landing/chart_info_menu_item.py index bad5f10b..7552cbb0 100644 --- a/yandex_music/landing/chart_info_menu_item.py +++ b/yandex_music/landing/chart_info_menu_item.py @@ -23,7 +23,7 @@ class ChartInfoMenuItem(YandexMusicObject): selected: Optional[bool] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.url, self.selected) @classmethod diff --git a/yandex_music/landing/chart_item.py b/yandex_music/landing/chart_item.py index 0e0d0000..34be6d02 100644 --- a/yandex_music/landing/chart_item.py +++ b/yandex_music/landing/chart_item.py @@ -21,7 +21,7 @@ class ChartItem(YandexMusicObject): chart: Optional['Chart'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.track, self.chart) @classmethod diff --git a/yandex_music/landing/landing.py b/yandex_music/landing/landing.py index 24406b66..62b05a26 100644 --- a/yandex_music/landing/landing.py +++ b/yandex_music/landing/landing.py @@ -23,10 +23,10 @@ class Landing(YandexMusicObject): blocks: List['Block'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.content_id, self.blocks) - def __getitem__(self, item): + def __getitem__(self, item: int) -> 'Block': return self.blocks[item] @classmethod diff --git a/yandex_music/landing/landing_list.py b/yandex_music/landing/landing_list.py index 8a25c8c8..762bf9c2 100644 --- a/yandex_music/landing/landing_list.py +++ b/yandex_music/landing/landing_list.py @@ -36,7 +36,7 @@ class LandingList(YandexMusicObject): podcasts: List[int] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.new_releases, self.new_playlists, self.podcasts) @classmethod diff --git a/yandex_music/landing/mix_link.py b/yandex_music/landing/mix_link.py index 00029cb8..a0b3528a 100644 --- a/yandex_music/landing/mix_link.py +++ b/yandex_music/landing/mix_link.py @@ -39,7 +39,7 @@ class MixLink(YandexMusicObject): cover_uri: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.url, self.title, diff --git a/yandex_music/landing/personal_playlists_data.py b/yandex_music/landing/personal_playlists_data.py index 36f0f2f8..222d0362 100644 --- a/yandex_music/landing/personal_playlists_data.py +++ b/yandex_music/landing/personal_playlists_data.py @@ -19,7 +19,7 @@ class PersonalPlaylistsData(YandexMusicObject): is_wizard_passed: bool client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.is_wizard_passed,) @classmethod diff --git a/yandex_music/landing/play_context.py b/yandex_music/landing/play_context.py index ee93b919..5db7449a 100644 --- a/yandex_music/landing/play_context.py +++ b/yandex_music/landing/play_context.py @@ -32,7 +32,7 @@ class PlayContext(YandexMusicObject): tracks: List['TrackShortOld'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.client_, self.context_item, self.context_item, self.tracks) @classmethod diff --git a/yandex_music/landing/play_contexts_data.py b/yandex_music/landing/play_contexts_data.py index 34dd8103..35089e70 100644 --- a/yandex_music/landing/play_contexts_data.py +++ b/yandex_music/landing/play_contexts_data.py @@ -19,7 +19,7 @@ class PlayContextsData(YandexMusicObject): other_tracks: List['TrackShortOld'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.other_tracks,) @classmethod diff --git a/yandex_music/landing/promotion.py b/yandex_music/landing/promotion.py index a03bfc02..aa6ddfac 100644 --- a/yandex_music/landing/promotion.py +++ b/yandex_music/landing/promotion.py @@ -40,7 +40,7 @@ class Promotion(YandexMusicObject): image: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.promo_id, self.title, diff --git a/yandex_music/landing/track_id.py b/yandex_music/landing/track_id.py index ebe159d1..b2c8674a 100644 --- a/yandex_music/landing/track_id.py +++ b/yandex_music/landing/track_id.py @@ -30,7 +30,7 @@ class TrackId(YandexMusicObject): from_: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.track_id, self.id, self.album_id) @property diff --git a/yandex_music/landing/track_short_old.py b/yandex_music/landing/track_short_old.py index 35bf2a7f..ed682967 100644 --- a/yandex_music/landing/track_short_old.py +++ b/yandex_music/landing/track_short_old.py @@ -26,7 +26,7 @@ class TrackShortOld(YandexMusicObject): timestamp: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.track_id,) @classmethod diff --git a/yandex_music/like.py b/yandex_music/like.py index 138e49eb..23af1830 100644 --- a/yandex_music/like.py +++ b/yandex_music/like.py @@ -46,7 +46,7 @@ class Like(YandexMusicObject): is_banner: Optional[bool] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.type, self.timestamp, self.album, self.artist, self.playlist) @classmethod diff --git a/yandex_music/pager.py b/yandex_music/pager.py index f5f500ae..667faad6 100644 --- a/yandex_music/pager.py +++ b/yandex_music/pager.py @@ -23,7 +23,7 @@ class Pager(YandexMusicObject): per_page: int client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.total, self.page, self.per_page) @classmethod diff --git a/yandex_music/playlist/brand.py b/yandex_music/playlist/brand.py index 96a41d84..80429993 100644 --- a/yandex_music/playlist/brand.py +++ b/yandex_music/playlist/brand.py @@ -34,7 +34,7 @@ class Brand(YandexMusicObject): button: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.image, self.reference, self.pixels) @classmethod diff --git a/yandex_music/playlist/case_forms.py b/yandex_music/playlist/case_forms.py index 5130ee8a..0f25c3dd 100644 --- a/yandex_music/playlist/case_forms.py +++ b/yandex_music/playlist/case_forms.py @@ -29,7 +29,7 @@ class CaseForms(YandexMusicObject): prepositional: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.nominative, self.genitive, diff --git a/yandex_music/playlist/contest.py b/yandex_music/playlist/contest.py index 6b450cbd..c3d10f89 100644 --- a/yandex_music/playlist/contest.py +++ b/yandex_music/playlist/contest.py @@ -30,7 +30,7 @@ class Contest(YandexMusicObject): withdrawn: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.contest_id, self.status) @classmethod diff --git a/yandex_music/playlist/custom_wave.py b/yandex_music/playlist/custom_wave.py index c1c2f1b2..af1488ee 100644 --- a/yandex_music/playlist/custom_wave.py +++ b/yandex_music/playlist/custom_wave.py @@ -26,7 +26,7 @@ class CustomWave(YandexMusicObject): position: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.title, self.animation_url, self.position) @classmethod diff --git a/yandex_music/playlist/made_for.py b/yandex_music/playlist/made_for.py index ddaac3a0..796477ae 100644 --- a/yandex_music/playlist/made_for.py +++ b/yandex_music/playlist/made_for.py @@ -21,7 +21,7 @@ class MadeFor(YandexMusicObject): case_forms: Optional['CaseForms'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.user_info, self.case_forms) @classmethod diff --git a/yandex_music/playlist/open_graph_data.py b/yandex_music/playlist/open_graph_data.py index b85d494a..24695e16 100644 --- a/yandex_music/playlist/open_graph_data.py +++ b/yandex_music/playlist/open_graph_data.py @@ -23,7 +23,7 @@ class OpenGraphData(YandexMusicObject): image: 'Cover' client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.title, self.description, self.image) @classmethod diff --git a/yandex_music/playlist/play_counter.py b/yandex_music/playlist/play_counter.py index dc598e04..746fdd10 100644 --- a/yandex_music/playlist/play_counter.py +++ b/yandex_music/playlist/play_counter.py @@ -27,7 +27,7 @@ class PlayCounter(YandexMusicObject): updated: bool client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.value, self.description, self.updated) @classmethod diff --git a/yandex_music/playlist/playlist.py b/yandex_music/playlist/playlist.py index 366b7af1..efc61fca 100644 --- a/yandex_music/playlist/playlist.py +++ b/yandex_music/playlist/playlist.py @@ -160,7 +160,7 @@ class Playlist(YandexMusicObject): pager: Optional['Pager'] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.uid, self.kind, self.title, self.playlist_absence) @property @@ -391,14 +391,14 @@ async def delete_tracks_async(self, from_: int, to: int, *args, **kwargs) -> Opt self.kind, from_, to, self.revision, self.owner.uid, *args, **kwargs ) - def delete(self, *args, **kwargs): + def delete(self, *args, **kwargs) -> bool: """Сокращение для:: client.users_playlists_delete(self.kind, self.owner.uid) """ return self.client.users_playlists_delete(self.kind, self.owner.uid, *args, **kwargs) - async def delete_async(self, *args, **kwargs): + async def delete_async(self, *args, **kwargs) -> bool: """Сокращение для:: await client.users_playlists_delete(self.kind, self.owner.uid) diff --git a/yandex_music/playlist/playlist_absence.py b/yandex_music/playlist/playlist_absence.py index 287217c6..6385e6f3 100644 --- a/yandex_music/playlist/playlist_absence.py +++ b/yandex_music/playlist/playlist_absence.py @@ -21,7 +21,7 @@ class PlaylistAbsence(YandexMusicObject): reason: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.kind, self.reason) @classmethod diff --git a/yandex_music/playlist/playlist_id.py b/yandex_music/playlist/playlist_id.py index d2be734f..8c46c3a4 100644 --- a/yandex_music/playlist/playlist_id.py +++ b/yandex_music/playlist/playlist_id.py @@ -1,10 +1,10 @@ -from typing import TYPE_CHECKING, List, Optional +from typing import TYPE_CHECKING, List, Optional, Union from yandex_music import YandexMusicObject from yandex_music.utils import model if TYPE_CHECKING: - from yandex_music import Client + from yandex_music import Client, Playlist @model @@ -21,21 +21,21 @@ class PlaylistId(YandexMusicObject): kind: int client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.uid, self.kind) @property - def playlist_id(self): + def playlist_id(self) -> str: return f'{self.uid}:{self.kind}' - def fetch_playlist(self, *args, **kwargs): + def fetch_playlist(self, *args, **kwargs) -> Union['Playlist', List['Playlist']]: """Сокращение для:: client.users_playlists(kind, uid, *args, **kwargs) """ return self.client.users_playlists(self.kind, self.uid, *args, **kwargs) - async def fetch_playlist_async(self, *args, **kwargs): + async def fetch_playlist_async(self, *args, **kwargs) -> Union['Playlist', List['Playlist']]: """Сокращение для:: await client.users_playlists(kind, uid, *args, **kwargs) diff --git a/yandex_music/playlist/playlist_recommendation.py b/yandex_music/playlist/playlist_recommendation.py index e4e90649..41958d37 100644 --- a/yandex_music/playlist/playlist_recommendation.py +++ b/yandex_music/playlist/playlist_recommendation.py @@ -21,7 +21,7 @@ class PlaylistRecommendations(YandexMusicObject): batch_id: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.batch_id, self.tracks) @classmethod diff --git a/yandex_music/playlist/tag.py b/yandex_music/playlist/tag.py index c6894857..1dcc5305 100644 --- a/yandex_music/playlist/tag.py +++ b/yandex_music/playlist/tag.py @@ -27,7 +27,7 @@ class Tag(YandexMusicObject): og_image: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id,) @classmethod diff --git a/yandex_music/playlist/tag_result.py b/yandex_music/playlist/tag_result.py index 1845d424..ca6c3acc 100644 --- a/yandex_music/playlist/tag_result.py +++ b/yandex_music/playlist/tag_result.py @@ -21,7 +21,7 @@ class TagResult(YandexMusicObject): ids: List['PlaylistId'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.tag, self.ids) @classmethod diff --git a/yandex_music/playlist/user.py b/yandex_music/playlist/user.py index e85f1f5f..fd31f83a 100644 --- a/yandex_music/playlist/user.py +++ b/yandex_music/playlist/user.py @@ -42,7 +42,7 @@ class User(YandexMusicObject): regions: List[int] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.uid, self.login) @classmethod diff --git a/yandex_music/promo_code_status.py b/yandex_music/promo_code_status.py index 6ad02ce8..dcbbfc5a 100644 --- a/yandex_music/promo_code_status.py +++ b/yandex_music/promo_code_status.py @@ -23,7 +23,7 @@ class PromoCodeStatus(YandexMusicObject): account_status: Optional['Status'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.status, self.status_desc, self.account_status) @classmethod diff --git a/yandex_music/queue/context.py b/yandex_music/queue/context.py index 6139f7f0..e9145749 100644 --- a/yandex_music/queue/context.py +++ b/yandex_music/queue/context.py @@ -32,7 +32,7 @@ class Context(YandexMusicObject): description: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.type, self.id) @classmethod diff --git a/yandex_music/queue/queue.py b/yandex_music/queue/queue.py index 38b8b3e7..9d11e2d8 100644 --- a/yandex_music/queue/queue.py +++ b/yandex_music/queue/queue.py @@ -29,7 +29,7 @@ class Queue(YandexMusicObject): from_: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.tracks, self.context, self.modified) def get_current_track(self) -> 'TrackId': diff --git a/yandex_music/queue/queue_item.py b/yandex_music/queue/queue_item.py index 46ff565b..9703a1cf 100644 --- a/yandex_music/queue/queue_item.py +++ b/yandex_music/queue/queue_item.py @@ -23,7 +23,7 @@ class QueueItem(YandexMusicObject): modified: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id,) def fetch_queue(self, *args, **kwargs) -> Optional['Queue']: diff --git a/yandex_music/rotor/ad_params.py b/yandex_music/rotor/ad_params.py index 1cf2d19a..9b13b68d 100644 --- a/yandex_music/rotor/ad_params.py +++ b/yandex_music/rotor/ad_params.py @@ -36,7 +36,7 @@ class AdParams(YandexMusicObject): genre_name: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.partner_id, self.category_id, diff --git a/yandex_music/rotor/dashboard.py b/yandex_music/rotor/dashboard.py index cb949c68..494d900f 100644 --- a/yandex_music/rotor/dashboard.py +++ b/yandex_music/rotor/dashboard.py @@ -24,7 +24,7 @@ class Dashboard(YandexMusicObject): pumpkin: bool client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.dashboard_id, self.stations, self.pumpkin) @classmethod diff --git a/yandex_music/rotor/discrete_scale.py b/yandex_music/rotor/discrete_scale.py index b8c9efa2..36a224a1 100644 --- a/yandex_music/rotor/discrete_scale.py +++ b/yandex_music/rotor/discrete_scale.py @@ -28,7 +28,7 @@ class DiscreteScale(YandexMusicObject): max: Optional['Value'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.type, self.name, self.min, self.max) @classmethod diff --git a/yandex_music/rotor/enum.py b/yandex_music/rotor/enum.py index 1be77a1d..36baa3c2 100644 --- a/yandex_music/rotor/enum.py +++ b/yandex_music/rotor/enum.py @@ -24,7 +24,7 @@ class Enum(YandexMusicObject): possible_values: List['Value'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.type, self.name, self.possible_values) @classmethod diff --git a/yandex_music/rotor/id.py b/yandex_music/rotor/id.py index dc87a207..311dde3c 100644 --- a/yandex_music/rotor/id.py +++ b/yandex_music/rotor/id.py @@ -25,7 +25,7 @@ class Id(YandexMusicObject): tag: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.type, self.tag) @classmethod diff --git a/yandex_music/rotor/restrictions.py b/yandex_music/rotor/restrictions.py index ddc41536..0658eb07 100644 --- a/yandex_music/rotor/restrictions.py +++ b/yandex_music/rotor/restrictions.py @@ -29,7 +29,7 @@ class Restrictions(YandexMusicObject): mood_energy: Optional['Enum'] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.language, self.diversity) @classmethod diff --git a/yandex_music/rotor/rotor_settings.py b/yandex_music/rotor/rotor_settings.py index a902d2c2..91760d59 100644 --- a/yandex_music/rotor/rotor_settings.py +++ b/yandex_music/rotor/rotor_settings.py @@ -36,7 +36,7 @@ class RotorSettings(YandexMusicObject): mood_energy: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.language, self.diversity) @classmethod diff --git a/yandex_music/rotor/sequence.py b/yandex_music/rotor/sequence.py index af6102af..059130e3 100644 --- a/yandex_music/rotor/sequence.py +++ b/yandex_music/rotor/sequence.py @@ -26,7 +26,7 @@ class Sequence(YandexMusicObject): liked: bool client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.type, self.track, self.liked) @classmethod diff --git a/yandex_music/rotor/station.py b/yandex_music/rotor/station.py index 6b9d20e8..504487ac 100644 --- a/yandex_music/rotor/station.py +++ b/yandex_music/rotor/station.py @@ -43,7 +43,7 @@ class Station(YandexMusicObject): parent_id: Optional['Id'] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.id, self.name, diff --git a/yandex_music/rotor/station_data.py b/yandex_music/rotor/station_data.py index 53dd80bb..82a71e38 100644 --- a/yandex_music/rotor/station_data.py +++ b/yandex_music/rotor/station_data.py @@ -19,7 +19,7 @@ class StationData(YandexMusicObject): name: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.name,) @classmethod diff --git a/yandex_music/rotor/station_result.py b/yandex_music/rotor/station_result.py index bb610d87..fd5dddda 100644 --- a/yandex_music/rotor/station_result.py +++ b/yandex_music/rotor/station_result.py @@ -39,7 +39,7 @@ class StationResult(YandexMusicObject): custom_name: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.station, self.settings, self.settings2, self.ad_params) @classmethod diff --git a/yandex_music/rotor/station_tracks_result.py b/yandex_music/rotor/station_tracks_result.py index f0ac4afd..fdf39916 100644 --- a/yandex_music/rotor/station_tracks_result.py +++ b/yandex_music/rotor/station_tracks_result.py @@ -25,11 +25,11 @@ class StationTracksResult(YandexMusicObject): pumpkin: bool client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.sequence, self.batch_id, self.pumpkin) @classmethod - def de_json(cls, data, client) -> Optional['StationTracksResult']: + def de_json(cls, data: dict, client: 'Client') -> Optional['StationTracksResult']: """Десериализация объекта. Args: diff --git a/yandex_music/rotor/value.py b/yandex_music/rotor/value.py index 1548dfc0..596051dd 100644 --- a/yandex_music/rotor/value.py +++ b/yandex_music/rotor/value.py @@ -21,7 +21,7 @@ class Value(YandexMusicObject): name: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.value, self.name) @classmethod diff --git a/yandex_music/search/best.py b/yandex_music/search/best.py index 33717537..88d7d5af 100644 --- a/yandex_music/search/best.py +++ b/yandex_music/search/best.py @@ -36,7 +36,7 @@ class Best(YandexMusicObject): text: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.type, self.result) @classmethod diff --git a/yandex_music/search/search.py b/yandex_music/search/search.py index af946a5b..f56251f0 100644 --- a/yandex_music/search/search.py +++ b/yandex_music/search/search.py @@ -53,7 +53,7 @@ class Search(YandexMusicObject): nocorrect: Optional[bool] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.search_request_id, self.text, diff --git a/yandex_music/search/search_result.py b/yandex_music/search/search_result.py index 99b01c1c..f3eb9a00 100644 --- a/yandex_music/search/search_result.py +++ b/yandex_music/search/search_result.py @@ -45,7 +45,7 @@ class SearchResult(YandexMusicObject, Generic[T]): results: List[T] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.total, self.per_page, self.order, self.results) @classmethod diff --git a/yandex_music/search/suggestions.py b/yandex_music/search/suggestions.py index 2d70afd7..00bc49a8 100644 --- a/yandex_music/search/suggestions.py +++ b/yandex_music/search/suggestions.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, List, Optional +from typing import TYPE_CHECKING, Iterable, List, Optional from yandex_music import YandexMusicObject from yandex_music.utils import model @@ -21,13 +21,13 @@ class Suggestions(YandexMusicObject): suggestions: List[str] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.best, self.suggestions) - def __getitem__(self, item): + def __getitem__(self, item: int) -> str: return self.suggestions[item] - def __iter__(self): + def __iter__(self) -> Iterable[str]: return iter(self.suggestions) @classmethod diff --git a/yandex_music/settings.py b/yandex_music/settings.py index ea8fa603..93fab179 100644 --- a/yandex_music/settings.py +++ b/yandex_music/settings.py @@ -27,7 +27,7 @@ class Settings(YandexMusicObject): web_payment_month_product_price: Optional['Price'] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.in_app_products, self.native_products, self.web_payment_url, self.promo_codes_enabled) @classmethod diff --git a/yandex_music/shot/shot.py b/yandex_music/shot/shot.py index 73ddc8ec..43c185e7 100644 --- a/yandex_music/shot/shot.py +++ b/yandex_music/shot/shot.py @@ -30,7 +30,7 @@ class Shot(YandexMusicObject): status: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.order, self.played, self.shot_data, self.shot_id, self.status) @classmethod diff --git a/yandex_music/shot/shot_data.py b/yandex_music/shot/shot_data.py index 4a8e6b91..6bbd12b4 100644 --- a/yandex_music/shot/shot_data.py +++ b/yandex_music/shot/shot_data.py @@ -25,7 +25,7 @@ class ShotData(YandexMusicObject): shot_type: 'ShotType' client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.cover_uri, self.mds_url, self.shot_text, self.shot_type) def get_cover_url(self, size: str = '200x200') -> str: diff --git a/yandex_music/shot/shot_event.py b/yandex_music/shot/shot_event.py index c66a5206..333218fa 100644 --- a/yandex_music/shot/shot_event.py +++ b/yandex_music/shot/shot_event.py @@ -21,7 +21,7 @@ class ShotEvent(YandexMusicObject): shots: List['Shot'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.event_id, self.shots) @classmethod diff --git a/yandex_music/shot/shot_type.py b/yandex_music/shot/shot_type.py index a9285916..288255e6 100644 --- a/yandex_music/shot/shot_type.py +++ b/yandex_music/shot/shot_type.py @@ -21,7 +21,7 @@ class ShotType(YandexMusicObject): title: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.title) @classmethod diff --git a/yandex_music/supplement/lyrics.py b/yandex_music/supplement/lyrics.py index d8f72b62..a8f278bb 100644 --- a/yandex_music/supplement/lyrics.py +++ b/yandex_music/supplement/lyrics.py @@ -36,7 +36,7 @@ class Lyrics(YandexMusicObject): url: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.id, self.lyrics, diff --git a/yandex_music/supplement/supplement.py b/yandex_music/supplement/supplement.py index c89b3747..e1f3689b 100644 --- a/yandex_music/supplement/supplement.py +++ b/yandex_music/supplement/supplement.py @@ -31,7 +31,7 @@ class Supplement(YandexMusicObject): description: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.lyrics, self.videos) @classmethod diff --git a/yandex_music/supplement/video_supplement.py b/yandex_music/supplement/video_supplement.py index dbafb937..bef2d711 100644 --- a/yandex_music/supplement/video_supplement.py +++ b/yandex_music/supplement/video_supplement.py @@ -31,7 +31,7 @@ class VideoSupplement(YandexMusicObject): embed: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.cover, self.title, self.provider_video_id) @classmethod diff --git a/yandex_music/track/licence_text_part.py b/yandex_music/track/licence_text_part.py index f5b75fac..267a3e09 100644 --- a/yandex_music/track/licence_text_part.py +++ b/yandex_music/track/licence_text_part.py @@ -21,7 +21,7 @@ class LicenceTextPart(YandexMusicObject): url: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.text,) @classmethod diff --git a/yandex_music/track/lyrics_info.py b/yandex_music/track/lyrics_info.py index 24f64afa..0d1f3a7a 100644 --- a/yandex_music/track/lyrics_info.py +++ b/yandex_music/track/lyrics_info.py @@ -21,7 +21,7 @@ class LyricsInfo(YandexMusicObject): has_available_text_lyrics: bool client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.has_available_sync_lyrics, self.has_available_text_lyrics) @classmethod diff --git a/yandex_music/track/lyrics_major.py b/yandex_music/track/lyrics_major.py index 9859d513..e012b54a 100644 --- a/yandex_music/track/lyrics_major.py +++ b/yandex_music/track/lyrics_major.py @@ -23,7 +23,7 @@ class LyricsMajor(YandexMusicObject): pretty_name: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id,) @classmethod diff --git a/yandex_music/track/major.py b/yandex_music/track/major.py index 1aa28b30..6adbdc3c 100644 --- a/yandex_music/track/major.py +++ b/yandex_music/track/major.py @@ -21,7 +21,7 @@ class Major(YandexMusicObject): name: str client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.name) @classmethod diff --git a/yandex_music/track/meta_data.py b/yandex_music/track/meta_data.py index fa1fa80e..14e43b08 100644 --- a/yandex_music/track/meta_data.py +++ b/yandex_music/track/meta_data.py @@ -33,7 +33,7 @@ class MetaData(YandexMusicObject): composer: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.album, self.volume, self.year) @classmethod diff --git a/yandex_music/track/normalization.py b/yandex_music/track/normalization.py index b07aa000..e7dcafc2 100644 --- a/yandex_music/track/normalization.py +++ b/yandex_music/track/normalization.py @@ -21,7 +21,7 @@ class Normalization(YandexMusicObject): peak: int client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.gain, self.peak) @classmethod diff --git a/yandex_music/track/poetry_lover_match.py b/yandex_music/track/poetry_lover_match.py index d682f617..cbf65907 100644 --- a/yandex_music/track/poetry_lover_match.py +++ b/yandex_music/track/poetry_lover_match.py @@ -26,7 +26,7 @@ class PoetryLoverMatch(YandexMusicObject): line: int client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.begin, self.end, self.line) @classmethod diff --git a/yandex_music/track/r128.py b/yandex_music/track/r128.py index 9f0bdae6..62f3f223 100644 --- a/yandex_music/track/r128.py +++ b/yandex_music/track/r128.py @@ -23,7 +23,7 @@ class R128(YandexMusicObject): tp: float client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.i, self.tp) @classmethod diff --git a/yandex_music/track/track.py b/yandex_music/track/track.py index 0d749dc1..d0a585bb 100644 --- a/yandex_music/track/track.py +++ b/yandex_music/track/track.py @@ -138,11 +138,11 @@ class Track(YandexMusicObject): track_sharing_flag: Optional[str] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self.download_info = None self._id_attrs = (self.id,) - def get_download_info(self, get_direct_links=False) -> List['DownloadInfo']: + def get_download_info(self, get_direct_links: bool = False) -> List['DownloadInfo']: """Сокращение для:: client.tracks_download_info(self.track_id, get_direct_links) @@ -151,7 +151,7 @@ def get_download_info(self, get_direct_links=False) -> List['DownloadInfo']: return self.download_info - async def get_download_info_async(self, get_direct_links=False) -> List['DownloadInfo']: + async def get_download_info_async(self, get_direct_links: bool = False) -> List['DownloadInfo']: """Сокращение для:: await client.tracks_download_info(self.track_id, get_direct_links) diff --git a/yandex_music/track/track_lyrics.py b/yandex_music/track/track_lyrics.py index ec245828..d03321f9 100644 --- a/yandex_music/track/track_lyrics.py +++ b/yandex_music/track/track_lyrics.py @@ -27,7 +27,7 @@ class TrackLyrics(YandexMusicObject): major: 'LyricsMajor' client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = ( self.lyric_id, self.external_lyric_id, diff --git a/yandex_music/track/tracks_similar.py b/yandex_music/track/tracks_similar.py index 4d063434..d5ac22db 100644 --- a/yandex_music/track/tracks_similar.py +++ b/yandex_music/track/tracks_similar.py @@ -21,10 +21,10 @@ class SimilarTracks(YandexMusicObject): similar_tracks: List['Track'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.track, self.similar_tracks) - def __getitem__(self, item) -> 'Track': + def __getitem__(self, item: int) -> 'Track': return self.similar_tracks[item] def __iter__(self) -> Iterator['Track']: diff --git a/yandex_music/track_short.py b/yandex_music/track_short.py index 91936ccb..e0e35b23 100644 --- a/yandex_music/track_short.py +++ b/yandex_music/track_short.py @@ -36,7 +36,7 @@ class TrackShort(YandexMusicObject): original_index: Optional[int] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.id, self.album_id) def fetch_track(self) -> 'Track': diff --git a/yandex_music/tracks_list.py b/yandex_music/tracks_list.py index b096697a..60b9a4bc 100644 --- a/yandex_music/tracks_list.py +++ b/yandex_music/tracks_list.py @@ -23,10 +23,10 @@ class TracksList(YandexMusicObject): tracks: List['TrackShort'] client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.uid, self.tracks) - def __getitem__(self, item) -> 'TrackShort': + def __getitem__(self, item: int) -> 'TrackShort': return self.tracks[item] def __iter__(self) -> Iterator['TrackShort']: diff --git a/yandex_music/utils/__init__.py b/yandex_music/utils/__init__.py index 786dd59c..8a657bf1 100644 --- a/yandex_music/utils/__init__.py +++ b/yandex_music/utils/__init__.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -def model(cls): +def model(cls): # noqa: ANN001, ANN201 return dataclass(cls, eq=False, repr=False) diff --git a/yandex_music/utils/difference.py b/yandex_music/utils/difference.py index 71137b5b..577c3d05 100644 --- a/yandex_music/utils/difference.py +++ b/yandex_music/utils/difference.py @@ -33,7 +33,7 @@ class Difference: operations (:obj:`list` из :obj:`dict`): Перечень операция для изменения плейлиста. """ - def __init__(self): + def __init__(self) -> None: self.operations = [] def to_json(self) -> str: diff --git a/yandex_music/video.py b/yandex_music/video.py index 0f7cd2e4..6bc0636d 100644 --- a/yandex_music/video.py +++ b/yandex_music/video.py @@ -39,7 +39,7 @@ class Video(YandexMusicObject): regions: Optional[List[str]] = None client: Optional['Client'] = None - def __post_init__(self): + def __post_init__(self) -> None: self._id_attrs = (self.provider_video_id, self.youtube_url, self.title) @classmethod