chore: Refactor for strict pyright analysis

This commit is contained in:
Marty Oehme 2024-06-13 21:20:53 +02:00
parent 19599a66d7
commit 7261e7d80c
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -7,16 +7,16 @@ import papis.notes
import papis.strings import papis.strings
from papis.document import Document from papis.document import Document
from papis_extract.annotation import Annotation
from papis_extract import extraction from papis_extract import extraction
from papis_extract.annotation import Annotation
from papis_extract.exporter import Exporter from papis_extract.exporter import Exporter
from papis_extract.extractors import all_extractors
from papis_extract.exporters import all_exporters from papis_extract.exporters import all_exporters
from papis_extract.extractors import all_extractors
from papis_extract.formatter import Formatter, formatters from papis_extract.formatter import Formatter, formatters
logger = papis.logging.get_logger(__name__) logger = papis.logging.get_logger(__name__)
DEFAULT_OPTIONS = { DEFAULT_OPTIONS: dict[str, dict[str, bool | float | dict[str, str]]] = {
"plugins.extract": { "plugins.extract": {
"tags": {}, "tags": {},
"on_import": False, "on_import": False,
@ -129,15 +129,16 @@ def run(
git: bool = False, git: bool = False,
force: bool = False, force: bool = False,
) -> None: ) -> None:
exporter: Exporter
if write: if write:
exporter: Exporter = all_exporters["notes"]( exporter = all_exporters["notes"](
formatter=formatter or formatters["markdown-atx"], formatter=formatter or formatters["markdown-atx"],
edit=edit, edit=edit,
git=git, git=git,
force=force, force=force,
) )
else: else:
exporter: Exporter = all_exporters["stdout"]( exporter = all_exporters["stdout"](
formatter=formatter or formatters["markdown"] formatter=formatter or formatters["markdown"]
) )