diff --git a/cheesechaser/datapool/anime_pictures.py b/cheesechaser/datapool/anime_pictures.py index 2b0d4b921..faa2eed8b 100644 --- a/cheesechaser/datapool/anime_pictures.py +++ b/cheesechaser/datapool/anime_pictures.py @@ -1,13 +1,20 @@ """ -This module provides a data pool implementation for anime pictures. +This module provides data pool implementations for anime pictures. -It defines a class `AnimePicturesDataPool` which inherits from `IncrementIDDataPool`. -This class is designed to manage and access a repository of anime pictures, -utilizing an incremental ID system for efficient data retrieval. +It defines two classes: + +1. `AnimePicturesDataPool`: Manages and accesses a repository of anime pictures. +2. `AnimePicturesWebpDataPool`: Manages and accesses a repository of WebP-formatted anime pictures. + +Both classes inherit from `IncrementIDDataPool` and utilize an incremental ID system +for efficient data retrieval. .. note:: - The dataset `deepghs/anime_pictures_full `_ - is gated, you have to get the access of it before using this module. + The datasets used by these classes are gated. You must have access to the + respective Hugging Face repositories before using this module: + + - `deepghs/anime_pictures_full `_ + - `deepghs/anime_pictures-webp-4Mpixel `_ """ from typing import Optional @@ -65,7 +72,40 @@ def __init__(self, revision: str = 'main', hf_token: Optional[str] = None): class AnimePicturesWebpDataPool(IncrementIDDataPool): + """ + A data pool class for managing and accessing WebP-formatted anime pictures. + + This class extends the IncrementIDDataPool to provide specific functionality + for handling WebP-formatted anime picture data. It uses a predefined repository + for storing and retrieving these pictures. + + :param revision: The revision of the data to use, defaults to 'main'. + :type revision: str + :param hf_token: Optional Hugging Face token for authentication, defaults to None. + :type hf_token: Optional[str] + + Usage: + >>> pool = AnimePicturesWebpDataPool() + >>> pool = AnimePicturesWebpDataPool(revision='main') + >>> pool = AnimePicturesWebpDataPool(revision='main', hf_token='your_hf_token') + + .. note:: + The class uses the same repository for both data and index storage. + The pictures in this pool are in WebP format and have a maximum size of 4 megapixels. + """ + def __init__(self, revision: str = 'main', hf_token: Optional[str] = None): + """ + Initialize the AnimePicturesWebpDataPool. + + This method sets up the data pool by calling the parent class constructor + with specific parameters for the WebP-formatted anime pictures repository. + + :param revision: The revision of the data to use, defaults to 'main'. + :type revision: str + :param hf_token: Optional Hugging Face token for authentication, defaults to None. + :type hf_token: Optional[str] + """ IncrementIDDataPool.__init__( self, data_repo_id=_ANIME_PICTURES_WEBP_REPO,