diff --git a/fimfarchive/fetchers/directory.py b/fimfarchive/fetchers/directory.py index 1fb2025..c5443cb 100644 --- a/fimfarchive/fetchers/directory.py +++ b/fimfarchive/fetchers/directory.py @@ -25,7 +25,7 @@ Directory fetcher. import json from itertools import chain from pathlib import Path -from typing import Any, Dict, Iterable, Optional, Set +from typing import Any, Dict, Iterable, Iterator, Optional, Set from fimfarchive.exceptions import InvalidStoryError, StorySourceError from fimfarchive.flavors import Flavor @@ -64,7 +64,7 @@ class DirectoryFetcher(Fetcher): self.data_path = data_path self.flavors = frozenset(flavors) - def iter_path_keys(self, path: Optional[Path]) -> Iterable[int]: + def iter_path_keys(self, path: Optional[Path]) -> Iterator[int]: """ Yields all story keys found in the specified directory. @@ -113,7 +113,7 @@ class DirectoryFetcher(Fetcher): """ return len(self.list_keys()) - def __iter__(self) -> Iterable[Story]: + def __iter__(self) -> Iterator[Story]: """ Yields all stories in the directories, ordered by ID. """ diff --git a/fimfarchive/fetchers/fimfarchive.py b/fimfarchive/fetchers/fimfarchive.py index a2c48af..eab3208 100644 --- a/fimfarchive/fetchers/fimfarchive.py +++ b/fimfarchive/fetchers/fimfarchive.py @@ -23,7 +23,7 @@ Fimfarchive fetcher. import json -from typing import cast, Any, Dict, IO, Iterable, Optional, Tuple, Union +from typing import cast, Any, Dict, IO, Iterator, Optional, Tuple, Union from zipfile import ZipFile, BadZipFile from boltons.cacheutils import LRU @@ -107,7 +107,7 @@ class FimfarchiveFetcher(Fetcher): self.paths = LRU() self.is_open = True - def load_index(self, source: IO[bytes]) -> Iterable[Tuple[int, str]]: + def load_index(self, source: IO[bytes]) -> Iterator[Tuple[int, str]]: """ Yields unparsed index items from a byte stream. @@ -147,7 +147,7 @@ class FimfarchiveFetcher(Fetcher): """ return len(self.index) - def __iter__(self) -> Iterable[Story]: + def __iter__(self) -> Iterator[Story]: """ Yields all stories in the archive, ordered by ID. """