mirror of
https://github.com/JockeTF/fimfarchive.git
synced 2024-11-22 13:28:00 +01:00
Change return types from Iterable to Iterator
This commit is contained in:
parent
0587144a5d
commit
9d9c3e05e3
2 changed files with 6 additions and 6 deletions
|
@ -25,7 +25,7 @@ Directory fetcher.
|
||||||
import json
|
import json
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from pathlib import Path
|
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.exceptions import InvalidStoryError, StorySourceError
|
||||||
from fimfarchive.flavors import Flavor
|
from fimfarchive.flavors import Flavor
|
||||||
|
@ -64,7 +64,7 @@ class DirectoryFetcher(Fetcher):
|
||||||
self.data_path = data_path
|
self.data_path = data_path
|
||||||
self.flavors = frozenset(flavors)
|
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.
|
Yields all story keys found in the specified directory.
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class DirectoryFetcher(Fetcher):
|
||||||
"""
|
"""
|
||||||
return len(self.list_keys())
|
return len(self.list_keys())
|
||||||
|
|
||||||
def __iter__(self) -> Iterable[Story]:
|
def __iter__(self) -> Iterator[Story]:
|
||||||
"""
|
"""
|
||||||
Yields all stories in the directories, ordered by ID.
|
Yields all stories in the directories, ordered by ID.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -23,7 +23,7 @@ Fimfarchive fetcher.
|
||||||
|
|
||||||
|
|
||||||
import json
|
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 zipfile import ZipFile, BadZipFile
|
||||||
|
|
||||||
from boltons.cacheutils import LRU
|
from boltons.cacheutils import LRU
|
||||||
|
@ -107,7 +107,7 @@ class FimfarchiveFetcher(Fetcher):
|
||||||
self.paths = LRU()
|
self.paths = LRU()
|
||||||
self.is_open = True
|
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.
|
Yields unparsed index items from a byte stream.
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ class FimfarchiveFetcher(Fetcher):
|
||||||
"""
|
"""
|
||||||
return len(self.index)
|
return len(self.index)
|
||||||
|
|
||||||
def __iter__(self) -> Iterable[Story]:
|
def __iter__(self) -> Iterator[Story]:
|
||||||
"""
|
"""
|
||||||
Yields all stories in the archive, ordered by ID.
|
Yields all stories in the archive, ordered by ID.
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue