diff --git a/enma/__init__.py b/enma/__init__.py index 0d2af74..4b25e27 100644 --- a/enma/__init__.py +++ b/enma/__init__.py @@ -1,7 +1,7 @@ import sys from enma.application.core.utils.logger import LogMode, logger from enma.application.use_cases.download_chapter import Threaded -from enma.infra.entrypoints.lib import Enma, SourcesEnum +from enma.infra.entrypoints.lib import Enma, Sources from enma.infra.adapters.repositories.nhentai import CloudFlareConfig, NHentai, Sort as NHentaiSort from enma.infra.adapters.repositories.mangadex import Mangadex, Sort as MangadexSort from enma.infra.adapters.repositories.manganato import Manganato diff --git a/enma/infra/core/utils/cache.py b/enma/infra/core/utils/cache.py index 40c8d27..71f515a 100644 --- a/enma/infra/core/utils/cache.py +++ b/enma/infra/core/utils/cache.py @@ -19,8 +19,6 @@ def wrapper(*args, **kwargs): else: _args = list([*list(kwargs.values()), *args[1:]]) - print(_args) - if self._CACHE.get(str(_args)) is not None: logger.debug(f'Retrieving cached object with key {str(_args)}') return self._CACHE.get(str(_args)) diff --git a/enma/infra/entrypoints/lib/__init__.py b/enma/infra/entrypoints/lib/__init__.py index 9d5e4d3..29ed5fd 100644 --- a/enma/infra/entrypoints/lib/__init__.py +++ b/enma/infra/entrypoints/lib/__init__.py @@ -26,7 +26,7 @@ from enma.infra.adapters.repositories.nhentai import NHentai, CloudFlareConfig from enma.infra.core.interfaces.lib import IEnma -class SourcesEnum(Enum): +class Sources(Enum): NHENTAI = 'nhentai' MANGADEX = 'mangadex' MANGANATO = 'manganato' @@ -34,7 +34,7 @@ class SourcesEnum(Enum): class ExtraConfigs(TypedDict): cloudflare_config: CloudFlareConfig -AvailableSources = TypeVar('AvailableSources', bound=SourcesEnum) +AvailableSources = TypeVar('AvailableSources', bound=Sources) class SourceManager(Generic[AvailableSources]): """ @@ -59,7 +59,7 @@ def get_source(self, Retrieves a source repository by name. Args: - source_name (Union[AvailableSources, str]): The name of the source to retrieve, either as a string or an enum. + source_name (Union[Sources, str]): The name of the source to retrieve, either as a string or an enum. Returns: IMangaRepository: The manga repository source. @@ -89,13 +89,13 @@ def set_source(self, self.source_name = source_name def add_source(self, - source_name: Union[str, SourcesEnum], + source_name: Union[str, Sources], source: IMangaRepository) -> None: """ Adds a new source repository to the available sources. Args: - source_name (Union[str, SourcesEnum]): The name of the source to add. + source_name (Union[str, Sources]): The name of the source to add. source (IMangaRepository): The manga repository source instance. Raises: @@ -160,9 +160,9 @@ def __create_default_sources(self) -> None: """ Creates and adds the default manga sources to the source manager. Currently, NHentai, Manganato, and Mangadex are added. """ - self.source_manager.add_source(SourcesEnum.NHENTAI, NHentai()) - self.source_manager.add_source(SourcesEnum.MANGANATO, Manganato()) - self.source_manager.add_source(SourcesEnum.MANGADEX, Mangadex()) + self.source_manager.add_source(Sources.NHENTAI, NHentai()) + self.source_manager.add_source(Sources.MANGANATO, Manganato()) + self.source_manager.add_source(Sources.MANGADEX, Mangadex()) def __initialize_use_case(self, source: IMangaRepository) -> None: """ diff --git a/tests/test_mangadex_source.py b/tests/test_mangadex_source.py index 2833e1b..6c0749b 100644 --- a/tests/test_mangadex_source.py +++ b/tests/test_mangadex_source.py @@ -52,7 +52,6 @@ def test_response_when_it_could_not_get_doujin(self): @patch('requests.get') def test_raise_forbidden_in_case_of_403_status_code(self, mock_method: MagicMock): - print() mock = Mock() mock.status_code = 403 mock_method.return_value = mock