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"""
""" An enumeration modelling the different kinds of relations between entries. """
""" Class that models a relation edge between two anime entries """
self, source: Id, source_type: MediaType, dest: Id, dest_type: MediaType, relation_type: RelationType ): """ Initializes the Relation object. :param source: The source node in the relation edge :param source_type: The media type of the source node :param dest: The destination node in the relation edge :param dest_type: The destination node's media type :param relation_type: The type of the relation :raises TypeError: If invalid ID types are provided or other types mismatch :raises ValueError: If both IDs are the same, i.e. an invalid relation """ lambda x: self.ensure_type(x, MediaType), [source_type, dest_type] ))
# For easier access
""" Checks if this relation is "important", meaning if it's a direct connection (Sequel, Prequel, Parent, Side Story or a summary) or not :return: True if the relation is important, False otherwise """ # noinspection PyTypeChecker
or Dict or List or Tuple or Set]]: """ Serializes the object into a dictionary :return: The serialized form of this object """ "source": self.source.serialize(), "source_type": self.source_type.name, "dest": self.dest.serialize(), "dest_type": self.dest_type.name, "type": self.type.name }
or Dict or List or Tuple or Set]]): """ Deserializes a dictionary into an object of this type :param data: The data to deserialize :return: The deserialized object :raises TypeError: If a type error occurred :raises ValueError: If the data could not be deserialized """ source, source_type, dest, dest_type, relation_type ) # type: Relation |