chore: Black formatting

This commit is contained in:
Marty Oehme 2024-06-12 11:46:39 +02:00
parent c2aec7add6
commit 19599a66d7
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
6 changed files with 12 additions and 10 deletions

View file

@ -24,5 +24,4 @@ class Exporter(Protocol):
def run( def run(
self, annot_docs: list[tuple[papis.document.Document, list[Annotation]]] self, annot_docs: list[tuple[papis.document.Document, list[Annotation]]]
) -> None: ) -> None: ...
...

View file

@ -1,4 +1,3 @@
import papis.logging import papis.logging
from papis_extract.exporter import Exporter from papis_extract.exporter import Exporter

View file

@ -29,7 +29,9 @@ class NotesExporter:
""" """
for doc, annots in annot_docs: for doc, annots in annot_docs:
# first always true since we write single doc per note # 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: if formatted_annotations:
self._add_annots_to_note(doc, formatted_annotations, force=self.force) self._add_annots_to_note(doc, formatted_annotations, force=self.force)

View file

@ -14,11 +14,9 @@ logger = papis.logging.get_logger(__name__)
class Extractor(Protocol): 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( def start(

View file

@ -3,6 +3,7 @@ from papis.document import Document
from papis_extract.annotation import Annotation from papis_extract.annotation import Annotation
class Formatter(Protocol): class Formatter(Protocol):
"""Basic formatter protocol. """Basic formatter protocol.
@ -16,8 +17,10 @@ class Formatter(Protocol):
exporter is used, if multiple entries are printed. exporter is used, if multiple entries are printed.
This can be useful for adding a header if necessary for the format. 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( def format_markdown(

View file

@ -60,6 +60,7 @@ def test_csv_default():
'"document-title","","myfile.pdf"' '"document-title","","myfile.pdf"'
) )
def test_csv_with_header(): def test_csv_with_header():
fmt = format_csv fmt = format_csv
assert fmt(document, annotations, first=True) == ( assert fmt(document, annotations, first=True) == (