From cbee5ead0d4530f49adeaaccafdfc59030ce3eb0 Mon Sep 17 00:00:00 2001 From: Joakim Soderlund Date: Sat, 25 May 2019 22:15:00 +0200 Subject: [PATCH] Add iterable and sized protocols to fetchers --- fimfarchive/fetchers/directory.py | 4 ++-- fimfarchive/fetchers/fimfarchive.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fimfarchive/fetchers/directory.py b/fimfarchive/fetchers/directory.py index d6d143f..f21da27 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, Iterator, Optional, Set, Union +from typing import Any, Dict, Iterable, Iterator, Optional, Set, Sized, Union from fimfarchive.exceptions import InvalidStoryError, StorySourceError from fimfarchive.flavors import Flavor @@ -40,7 +40,7 @@ __all__ = ( ) -class DirectoryFetcher(Fetcher): +class DirectoryFetcher(Iterable[Story], Sized, Fetcher): """ Fetches stories from file system. """ diff --git a/fimfarchive/fetchers/fimfarchive.py b/fimfarchive/fetchers/fimfarchive.py index dc926cd..5ff62bf 100644 --- a/fimfarchive/fetchers/fimfarchive.py +++ b/fimfarchive/fetchers/fimfarchive.py @@ -27,8 +27,8 @@ import marshal from io import BufferedReader from multiprocessing import Pool from typing import ( - cast, Any, Callable, Dict, IO, Iterator, - Mapping, Optional, Tuple, Union, + cast, Any, Callable, Dict, IO, Iterable, Iterator, + Mapping, Optional, Sized, Tuple, Union, ) from zipfile import ZipFile, BadZipFile @@ -144,7 +144,7 @@ class MemoryIndex(Index): self.data.clear() -class FimfarchiveFetcher(Fetcher): +class FimfarchiveFetcher(Iterable[Story], Sized, Fetcher): """ Fetcher for Fimfarchive. """