cheesechaser.datapool.nhentai

This module provides data pool classes for managing and accessing NHentai manga and image data.

The module includes two main classes:

  1. NHentaiImagesDataPool: A data pool for managing NHentai images.

  2. NHentaiMangaDataPool: A data pool for managing NHentai manga data, including image associations.

These classes provide functionality for retrieving manga information, downloading images, and managing resources from a Hugging Face dataset repository.

NHentaiImagesDataPool

class cheesechaser.datapool.nhentai.NHentaiImagesDataPool(revision: str = 'main')[source]

A data pool class for managing NHentai images.

This class extends the IncrementIDDataPool to provide specific functionality for handling NHentai image data.

Parameters:

revision (str) – The revision of the data to use, defaults to ‘main’.

__init__(revision: str = 'main')[source]

Initialize the NHentaiImagesDataPool.

Parameters:

revision (str) – The revision of the data to use, defaults to ‘main’.

NHentaiMangaDataPool

class cheesechaser.datapool.nhentai.NHentaiMangaDataPool(revision: str = 'main')[source]

A data pool class for managing NHentai manga data.

This class provides methods for retrieving manga information, downloading associated images, and managing manga resources.

Parameters:

revision (str) – The revision of the data to use, defaults to ‘main’.

__init__(revision: str = 'main')[source]

Initialize the NHentaiMangaDataPool.

Parameters:

revision (str) – The revision of the data to use, defaults to ‘main’.

classmethod manga_id_map(revision: str = 'main', local_files_prefer: bool = True)[source]

Get a mapping of manga IDs to their associated image IDs.

This method is cached for efficiency.

Parameters:
  • revision (str) – The revision of the data to use, defaults to ‘main’.

  • local_files_prefer (bool) – Whether to prefer local files, defaults to True.

Returns:

A dictionary mapping manga IDs to lists of image IDs.

Return type:

dict

classmethod manga_posts_table(revision: str = 'main', local_files_prefer: bool = True)[source]

Retrieve the manga posts table as a pandas DataFrame.

This method is cached for efficiency.

Parameters:
  • revision (str) – The revision of the data to use, defaults to ‘main’.

  • local_files_prefer (bool) – Whether to prefer local files, defaults to True.

Returns:

A pandas DataFrame containing manga post information.

Return type:

pandas.DataFrame

mock_resource(resource_id, resource_info) AbstractContextManager[Tuple[str, Any]][source]

Create a mock resource for a given manga.

This method downloads the associated images for a manga and organizes them in a temporary directory.

Parameters:
  • resource_id (int) – The ID of the manga resource.

  • resource_info (Any) – Additional information about the resource.

Yield:

A tuple containing the path to the temporary directory with the images and the resource info.

Return type:

Tuple[str, Any]

Raises:

ResourceNotFoundError – If the specified manga resource is not found.