mirror of
https://github.com/JockeTF/fimfarchive.git
synced 2024-11-22 05:17:59 +01:00
Explicitly declare optional parameters
This commit is contained in:
parent
3146eaa62b
commit
c71a9bb94c
8 changed files with 18 additions and 14 deletions
|
@ -77,7 +77,7 @@ class FpubEpubConverter(Converter):
|
|||
Converts story data from FPUB to EPUB.
|
||||
"""
|
||||
|
||||
def __init__(self, logdir: Union[Path, str] = None) -> None:
|
||||
def __init__(self, logdir: Union[None, Path, str] = None) -> None:
|
||||
self.logdir = get_path(logdir)
|
||||
|
||||
if self.logdir and not self.logdir.is_dir():
|
||||
|
|
|
@ -49,8 +49,8 @@ class DirectoryFetcher(Iterable[Story], Sized, Fetcher):
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
meta_path: Union[Path, str] = None,
|
||||
data_path: Union[Path, str] = None,
|
||||
meta_path: Union[None, Path, str] = None,
|
||||
data_path: Union[None, Path, str] = None,
|
||||
flavors: Iterable[Flavor] = tuple(),
|
||||
) -> None:
|
||||
"""
|
||||
|
|
|
@ -134,7 +134,7 @@ class StorySlugMapper(Mapper[str]):
|
|||
Returns a slug-based file path for a story.
|
||||
"""
|
||||
|
||||
def __init__(self, template: str = None) -> None:
|
||||
def __init__(self, template: Optional[str] = None) -> None:
|
||||
"""
|
||||
Constructor.
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Stories for Fimfarchive.
|
|||
#
|
||||
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Dict, Iterable, TypeVar
|
||||
from typing import TYPE_CHECKING, Any, Dict, Iterable, Optional, TypeVar
|
||||
|
||||
from fimfarchive.exceptions import StorySourceError
|
||||
|
||||
|
@ -48,9 +48,9 @@ class Story:
|
|||
def __init__(
|
||||
self,
|
||||
key: int,
|
||||
fetcher: Fetcher = None,
|
||||
meta: Dict[str, Any] = None,
|
||||
data: bytes = None,
|
||||
fetcher: Optional[Fetcher] = None,
|
||||
meta: Optional[Dict[str, Any]] = None,
|
||||
data: Optional[bytes] = None,
|
||||
flavors: Iterable[Flavor] = (),
|
||||
) -> None:
|
||||
"""
|
||||
|
|
|
@ -52,8 +52,8 @@ class BuildTask:
|
|||
self,
|
||||
output: PathArg,
|
||||
upcoming: Iterable[Story],
|
||||
previous: Fetcher = None,
|
||||
extras: PathArg = None,
|
||||
previous: Optional[Fetcher] = None,
|
||||
extras: Optional[PathArg] = None,
|
||||
) -> None:
|
||||
"""
|
||||
Constructor.
|
||||
|
|
|
@ -76,8 +76,8 @@ class UpdateTask(SignalSender):
|
|||
self,
|
||||
fimfarchive: Fetcher,
|
||||
fimfiction: Fetcher,
|
||||
selector: Selector = None,
|
||||
stamper: Stamper = None,
|
||||
selector: Optional[Selector] = None,
|
||||
stamper: Optional[Stamper] = None,
|
||||
workdir: str = DEFAULT_WORKDIR,
|
||||
retries: int = DEFAULT_RETRIES,
|
||||
skips: int = DEFAULT_SKIPS,
|
||||
|
|
|
@ -281,7 +281,11 @@ class ResourceLoader:
|
|||
self.package = package
|
||||
self.binary = binary
|
||||
|
||||
def __call__(self, name: str, binary: bool = None) -> Union[str, bytes]:
|
||||
def __call__(
|
||||
self,
|
||||
name: str,
|
||||
binary: Optional[bool] = None,
|
||||
) -> Union[str, bytes]:
|
||||
"""
|
||||
Loads a package resource.
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class TestEmpty:
|
|||
"""
|
||||
Tests `Empty` class evaluates to `False`.
|
||||
"""
|
||||
assert not Empty
|
||||
assert bool(Empty) is False
|
||||
|
||||
def test_empty_class_is_empty(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue