From 19599a66d734b40417336f7c0cab300192162fab Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 12 Jun 2024 11:46:39 +0200 Subject: [PATCH] chore: Black formatting --- papis_extract/exporter.py | 3 +-- papis_extract/exporters/__init__.py | 1 - papis_extract/exporters/notes.py | 4 +++- papis_extract/extraction.py | 6 ++---- papis_extract/formatter.py | 7 +++++-- tests/test_formatting.py | 1 + 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/papis_extract/exporter.py b/papis_extract/exporter.py index de1fe6c..8358480 100644 --- a/papis_extract/exporter.py +++ b/papis_extract/exporter.py @@ -24,5 +24,4 @@ class Exporter(Protocol): def run( self, annot_docs: list[tuple[papis.document.Document, list[Annotation]]] - ) -> None: - ... + ) -> None: ... diff --git a/papis_extract/exporters/__init__.py b/papis_extract/exporters/__init__.py index 6b5208b..b9980e5 100644 --- a/papis_extract/exporters/__init__.py +++ b/papis_extract/exporters/__init__.py @@ -1,4 +1,3 @@ - import papis.logging from papis_extract.exporter import Exporter diff --git a/papis_extract/exporters/notes.py b/papis_extract/exporters/notes.py index 22b4ce0..3b2726d 100644 --- a/papis_extract/exporters/notes.py +++ b/papis_extract/exporters/notes.py @@ -29,7 +29,9 @@ class NotesExporter: """ for doc, annots in annot_docs: # first always true since we write single doc per note - formatted_annotations: list[str] = self.formatter(doc, annots, first=True).split("\n") + formatted_annotations: list[str] = self.formatter( + doc, annots, first=True + ).split("\n") if formatted_annotations: self._add_annots_to_note(doc, formatted_annotations, force=self.force) diff --git a/papis_extract/extraction.py b/papis_extract/extraction.py index 79c6d6a..1c69026 100644 --- a/papis_extract/extraction.py +++ b/papis_extract/extraction.py @@ -14,11 +14,9 @@ logger = papis.logging.get_logger(__name__) class Extractor(Protocol): - def can_process(self, filename: Path) -> bool: - ... + def can_process(self, filename: Path) -> bool: ... - def run(self, filename: Path) -> list[Annotation]: - ... + def run(self, filename: Path) -> list[Annotation]: ... def start( diff --git a/papis_extract/formatter.py b/papis_extract/formatter.py index 18e15b2..515a2c7 100644 --- a/papis_extract/formatter.py +++ b/papis_extract/formatter.py @@ -3,6 +3,7 @@ from papis.document import Document from papis_extract.annotation import Annotation + class Formatter(Protocol): """Basic formatter protocol. @@ -16,8 +17,10 @@ class Formatter(Protocol): exporter is used, if multiple entries are printed. This can be useful for adding a header if necessary for the format. """ - def __call__(self, document: Document, annotations: list[Annotation], first: bool) -> str: - ... + + def __call__( + self, document: Document, annotations: list[Annotation], first: bool + ) -> str: ... def format_markdown( diff --git a/tests/test_formatting.py b/tests/test_formatting.py index ac7f2c3..27eb702 100644 --- a/tests/test_formatting.py +++ b/tests/test_formatting.py @@ -60,6 +60,7 @@ def test_csv_default(): '"document-title","","myfile.pdf"' ) + def test_csv_with_header(): fmt = format_csv assert fmt(document, annotations, first=True) == (