mirror of
https://github.com/JockeTF/fimfarchive.git
synced 2024-11-22 05:17:59 +01:00
Add iterable and sized protocols to fetchers
This commit is contained in:
parent
7a9191cf36
commit
cbee5ead0d
2 changed files with 5 additions and 5 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, Iterator, Optional, Set, Union
|
from typing import Any, Dict, Iterable, Iterator, Optional, Set, Sized, Union
|
||||||
|
|
||||||
from fimfarchive.exceptions import InvalidStoryError, StorySourceError
|
from fimfarchive.exceptions import InvalidStoryError, StorySourceError
|
||||||
from fimfarchive.flavors import Flavor
|
from fimfarchive.flavors import Flavor
|
||||||
|
@ -40,7 +40,7 @@ __all__ = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class DirectoryFetcher(Fetcher):
|
class DirectoryFetcher(Iterable[Story], Sized, Fetcher):
|
||||||
"""
|
"""
|
||||||
Fetches stories from file system.
|
Fetches stories from file system.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -27,8 +27,8 @@ import marshal
|
||||||
from io import BufferedReader
|
from io import BufferedReader
|
||||||
from multiprocessing import Pool
|
from multiprocessing import Pool
|
||||||
from typing import (
|
from typing import (
|
||||||
cast, Any, Callable, Dict, IO, Iterator,
|
cast, Any, Callable, Dict, IO, Iterable, Iterator,
|
||||||
Mapping, Optional, Tuple, Union,
|
Mapping, Optional, Sized, Tuple, Union,
|
||||||
)
|
)
|
||||||
from zipfile import ZipFile, BadZipFile
|
from zipfile import ZipFile, BadZipFile
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ class MemoryIndex(Index):
|
||||||
self.data.clear()
|
self.data.clear()
|
||||||
|
|
||||||
|
|
||||||
class FimfarchiveFetcher(Fetcher):
|
class FimfarchiveFetcher(Iterable[Story], Sized, Fetcher):
|
||||||
"""
|
"""
|
||||||
Fetcher for Fimfarchive.
|
Fetcher for Fimfarchive.
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue