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"""
# noinspection PyAbstractClass """ Models a user's entry data for an anime series """
""" 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 """
self, media_id: Id, media_type: MediaType, username: str, score: Score, consuming_status: ConsumingStatus, consuming_start: Optional[Date], consuming_end: Optional[Date] ): """ Initializes the MediaUserData object :param media_id: The ID of the corresponding MediaData object :param media_type: The type of media represented :param username: The user's username :param score: The user's score for this entry :param consuming_status: The user's current consuming status :param consuming_start: The date on which the user started consuming :param consuming_end: The date on which the user completed the entry :raises TypeError: If any of the parameters has a wrong type """
""" Checks if the data has a valid combination of entry data :return: True, if all required attributes are valid and present """
ConsumingStatus.COMPLETED, ConsumingStatus.REPEATING ]:
ConsumingStatus.DROPPED, ConsumingStatus.CURRENT, ConsumingStatus.PAUSED ]:
else: # self.consuming_status == WatchingStatus.PLANNING:
or Dict or List or Tuple or Set]]: """ Serializes the object into a dictionary :return: The serialized form of this object """ "media_id": self.id.serialize(), "media_type": self.media_type.name, "username": self.username, "score": self.score.serialize(), "consuming_status": self.consuming_status.name, "consuming_start": self.consuming_start, "consuming_end": self.consuming_end }
""" 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 MangaUserData
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_id": Id.deserialize(data["media_id"]), "media_type": MediaType[data["media_type"]], "username": data["username"], "score": Score.deserialize(data["score"]), "consuming_status": ConsumingStatus[data["consuming_status"]] }
else:
""" Generates an order of constructor parameters for the common attributes used for media classes :return: The order of common parameters """ "media_id", "username", "score", "consuming_status", "consuming_start", "consuming_end" ]
""" Models a user's entry data for an anime series """
self, media_id: Id, username: str, score: Score, consuming_status: ConsumingStatus, consuming_start: Optional[Date], consuming_end: Optional[Date], episode_progress: int ): """ Initializes the AnimeUserData object :param media_id: The ID of the corresponding AnimeData object :param username: The user's username :param score: The user's score for this anime :param consuming_status: The user's current watching status :param consuming_start: The date on which the user started watching :param consuming_end: The date on which the user completed the show :param episode_progress: The user's progress :raises TypeError: If any of the parameters has a wrong type """ media_id, MediaType.ANIME, username, score, consuming_status, consuming_start, consuming_end )
or Dict or List or Tuple or Set]]: """ Serializes the object into a dictionary :return: The serialized form of this object """
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 """ "episode_progress": data["episode_progress"] }
""" Generates the order of class-specific additional constructor parameters :return: The order of the additional parameters """
""" Models a user's entry data for a manga series """
self, media_id: Id, username: str, score: Score, consuming_status: ConsumingStatus, consuming_start: Optional[Date], consuming_end: Optional[Date], chapter_progress: int, volume_progress: int ): """ Initializes the MangaUserData object :param media_id: The ID of the corresponding MangaData object :param username: The user's username :param score: The user's score for this manga :param consuming_status: The user's current reading status :param consuming_start: The date on which the user started reading :param consuming_end: The date on which the user completed the series :param chapter_progress: The user's chapter progress :param volume_progress: The user's volume progress :raises TypeError: If any of the parameters has a wrong type """ media_id, MediaType.MANGA, username, score, consuming_status, consuming_start, consuming_end )
Optional[str or int or float or bool or Dict or List or Tuple or Set]]: """ Serializes the object into a dictionary :return: The serialized form of this object """
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 """ "chapter_progress": data["chapter_progress"], "volume_progress": data["volume_progress"] }
""" Generates the order of class-specific additional constructor parameters :return: The order of the additional parameters """ |