Skip to content

Commit

Permalink
STY: Ruff magic
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma committed Oct 8, 2023
1 parent c8f35c3 commit d87c33e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/json_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def items(self) -> list[tuple[str, int]]:
("Widget", self.Widget if self.Widget else 0),
]

def sum(self):
def sum(self) -> int:
return sum(value for _, value in self.items())


Expand Down Expand Up @@ -91,6 +91,7 @@ def pdf_to_datetime(date_str: str | None) -> datetime.datetime | None:


def get_annotation_counts(reader: PdfReader) -> dict[str, int]:
"""Get a dictionary with the annotation subtype counts."""
pdf_annotations = {}
for page in reader.pages:
if page.annotations:
Expand Down Expand Up @@ -147,7 +148,7 @@ def check_meta(entry: PdfEntry) -> None:
f" - {subtype}: {exp_count} vs {pdf_annotations.get(subtype, 0)}"
)
todo_subtypes = []
for subtype, count in sorted(pdf_annotations.items()):
for subtype, _ in sorted(pdf_annotations.items()):
if subtype not in seen_subtypes:
todo_subtypes.append(subtype)
if todo_subtypes:
Expand Down
3 changes: 2 additions & 1 deletion 024-annotations/create_annotated_pdf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from fpdf import FPDF # pip install fpdf2
from datetime import datetime

from fpdf import FPDF # pip install fpdf2

pdf = FPDF()
pdf.set_creation_date(datetime(1990, 4, 28, 0, 0, 0))
pdf.set_creator("created by Martin Thoma")
Expand Down

0 comments on commit d87c33e

Please sign in to comment.