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.
|
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)
|
self.logdir = get_path(logdir)
|
||||||
|
|
||||||
if self.logdir and not self.logdir.is_dir():
|
if self.logdir and not self.logdir.is_dir():
|
||||||
|
|
|
@ -49,8 +49,8 @@ class DirectoryFetcher(Iterable[Story], Sized, Fetcher):
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
meta_path: Union[Path, str] = None,
|
meta_path: Union[None, Path, str] = None,
|
||||||
data_path: Union[Path, str] = None,
|
data_path: Union[None, Path, str] = None,
|
||||||
flavors: Iterable[Flavor] = tuple(),
|
flavors: Iterable[Flavor] = tuple(),
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -134,7 +134,7 @@ class StorySlugMapper(Mapper[str]):
|
||||||
Returns a slug-based file path for a story.
|
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.
|
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
|
from fimfarchive.exceptions import StorySourceError
|
||||||
|
|
||||||
|
@ -48,9 +48,9 @@ class Story:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
key: int,
|
key: int,
|
||||||
fetcher: Fetcher = None,
|
fetcher: Optional[Fetcher] = None,
|
||||||
meta: Dict[str, Any] = None,
|
meta: Optional[Dict[str, Any]] = None,
|
||||||
data: bytes = None,
|
data: Optional[bytes] = None,
|
||||||
flavors: Iterable[Flavor] = (),
|
flavors: Iterable[Flavor] = (),
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -52,8 +52,8 @@ class BuildTask:
|
||||||
self,
|
self,
|
||||||
output: PathArg,
|
output: PathArg,
|
||||||
upcoming: Iterable[Story],
|
upcoming: Iterable[Story],
|
||||||
previous: Fetcher = None,
|
previous: Optional[Fetcher] = None,
|
||||||
extras: PathArg = None,
|
extras: Optional[PathArg] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Constructor.
|
Constructor.
|
||||||
|
|
|
@ -76,8 +76,8 @@ class UpdateTask(SignalSender):
|
||||||
self,
|
self,
|
||||||
fimfarchive: Fetcher,
|
fimfarchive: Fetcher,
|
||||||
fimfiction: Fetcher,
|
fimfiction: Fetcher,
|
||||||
selector: Selector = None,
|
selector: Optional[Selector] = None,
|
||||||
stamper: Stamper = None,
|
stamper: Optional[Stamper] = None,
|
||||||
workdir: str = DEFAULT_WORKDIR,
|
workdir: str = DEFAULT_WORKDIR,
|
||||||
retries: int = DEFAULT_RETRIES,
|
retries: int = DEFAULT_RETRIES,
|
||||||
skips: int = DEFAULT_SKIPS,
|
skips: int = DEFAULT_SKIPS,
|
||||||
|
|
|
@ -281,7 +281,11 @@ class ResourceLoader:
|
||||||
self.package = package
|
self.package = package
|
||||||
self.binary = binary
|
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.
|
Loads a package resource.
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class TestEmpty:
|
||||||
"""
|
"""
|
||||||
Tests `Empty` class evaluates to `False`.
|
Tests `Empty` class evaluates to `False`.
|
||||||
"""
|
"""
|
||||||
assert not Empty
|
assert bool(Empty) is False
|
||||||
|
|
||||||
def test_empty_class_is_empty(self):
|
def test_empty_class_is_empty(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue