Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""LICENSE Copyright 2018 Hermann Krumrey <hermann@krumreyh.com>
This file is part of anime-list-apis.
anime-list-apis is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
anime-list-apis is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with anime-list-apis. If not, see <http://www.gnu.org/licenses/>. LICENSE"""
AnimeData, MangaData, MediaData AnimeUserData, MangaUserData, MediaUserData
""" Class that models a user's media list entry """
""" Retrieves the cache entry's ID :return: The ID """
""" Retrieves the media type :return: The media type """
""" Retrieves the username, if applicable. Else None :return: The username or None if not applicable """
""" Retrieves the cache model type :return: The model type """
media_data: MediaData, user_data: MediaUserData): """ Initializes the media list entry. :param media_data: The media data :param user_data: The user data :raises TypeError: If any of the parameters has a wrong type :raises ValueError: If the media and user data do not match """ MediaData.get_class_for_media_type(media_type)) MediaUserData.get_class_for_media_type(media_type))
or media_data.media_type != user_data.media_type \ or media_type != media_data.media_type:
""" Generates a new MediaData object from the internal representation :return: The generated MediaData object :raises TypeError: If any of the internal parameters has a wrong type """ raise NotImplementedError() # pragma: no cover
""" Generates a new MediaUserData object from the internal representation :return: The generated MediaUserData object :raises TypeError: If any of the internal parameters has a wrong type """ raise NotImplementedError() # pragma: no cover
""" Checks if the data has a valid combination of entry data :return: True, if all required attributes are valid and present """ ConsumingStatus.CURRENT, ConsumingStatus.PAUSED, ConsumingStatus.DROPPED ]
ReleasingStatus.FINISHED ]:
ReleasingStatus.RELEASING, ReleasingStatus.CANCELLED, ]:
else: # AiringStatus.NOT_RELEASESD and not consuming_complete and not started_watching
""" Maps a class to a media type :param media_type: The media type :return: The class mapped to that media type """ if media_type == MediaType.ANIME \ else MangaListEntry
or Dict or List or Tuple or Set]]: """ Serializes the object into a dictionary :return: The serialized form of this object """ "media_type": self.media_type.name, "media_data": self.get_media_data().serialize(), "user_data": self.get_user_data().serialize() }
cls, data: Dict[str, Optional[str or int or float or bool or Dict or List or Tuple or Set]]) \ -> Dict[str, Optional[str or int or float or bool or Dict or List or Tuple or Set]]: """ Deserializes the common child components of the data dictionary :param data: The data to deserialize :return: The deserialized dictionary """ "media_type": MediaType[data["media_type"]], "media_data": MediaData.deserialize(data["media_data"]), "user_data": MediaUserData.deserialize(data["user_data"]) }
cls, data: Dict[str, Optional[str or int or float or bool or Dict or List or Tuple or Set]]) \ -> Dict[str, Optional[str or int or float or bool or Dict or List or Tuple or Set]]: """ Deserializes class-specific child components of the data dictionary :param data: The data to deserialize :return: The deserialized dictionary """
""" Generates an order of constructor parameters for the common attributes used for media classes :return: The order of common parameters """
""" Generates the order of class-specific additional constructor parameters :return: The order of the additional parameters """
""" Class that models a user's anime list entry """
""" Initializes the anime list entry. :param anime_data: The anime data :param user_data: The user data :raises TypeError: If any of the parameters has a wrong type """
""" Generates a new AnimeData object from the internal representation :return: The generated AnimeData object :raises TypeError: If any of the internal parameters has a wrong type """ self.format, self.id, self.title, self.relations, self.releasing_status, self.releasing_start, self.releasing_end, self.cover_url, self.episode_count, self.episode_duration )
""" Generates a new AnimeUserData object from the internal representation :return: The generated AnimeUserData object :raises TypeError: If any of the internal parameters has a wrong type """ self.id, self.username, self.score, self.consuming_status, self.consuming_start, self.consuming_end, self.episode_progress )
""" Class that models a user's manga list entry """
""" Initializes the manga list entry. :param manga_data: The manga data :param user_data: The user data :raises TypeError: If any of the parameters has a wrong type """
""" Generates a new MangaData object from the internal representation :return: The generated MangaData object :raises TypeError: If any of the internal parameters has a wrong type """ self.format, self.id, self.title, self.relations, self.releasing_status, self.releasing_start, self.releasing_end, self.cover_url, self.chapter_count, self.volume_count )
""" Generates a new MangaUserData object from the internal representation :return: The generated MangaUserData object :raises TypeError: If any of the internal parameters has a wrong type """ self.id, self.username, self.score, self.consuming_status, self.consuming_start, self.consuming_end, self.chapter_progress, self.volume_progress ) |