From 1fbe133e7f39d1e80695634061d00890fdeb9f4d Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Mon, 18 Feb 2019 14:03:06 +0100 Subject: [PATCH] linted --- pdftools/cli.py | 6 +++--- pdftools/formfill.py | 4 ---- pdftools/nameplate.py | 1 + pdftools/ruler.py | 9 ++++----- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/pdftools/cli.py b/pdftools/cli.py index c00c5d0..81fafd4 100644 --- a/pdftools/cli.py +++ b/pdftools/cli.py @@ -66,13 +66,13 @@ def nameplates(attendees, logo, size, adjust_x, adjust_y): size and adjustment options. """ if logo is not None: - logo = nameplate.Logo(logo, size * mm, adjust_x=adjust_x, adjust_y=adjust_y) + logo = nameplate.Logo( + logo, size * mm, adjust_x=adjust_x, adjust_y=adjust_y + ) npc = nameplate.NamePlateCards(logo) npc.generate(attendees, show=True) - - @click.command() @click.argument( "pdf", diff --git a/pdftools/formfill.py b/pdftools/formfill.py index 49ebf5e..0be893b 100644 --- a/pdftools/formfill.py +++ b/pdftools/formfill.py @@ -1,11 +1,9 @@ import pdfrw import subprocess -import itertools import tempfile from pathlib import Path from reportlab.pdfgen import canvas -from reportlab.lib.units import mm from reportlab.lib.pagesizes import A4 @@ -48,5 +46,3 @@ def fill(original_form, values, draw_function, output_file="filled.pdf"): # write the combined file to the output pdfrw.PdfWriter().write(output_file, form) subprocess.run(["open", output_file]) - - diff --git a/pdftools/nameplate.py b/pdftools/nameplate.py index 334f0b0..5a54b79 100644 --- a/pdftools/nameplate.py +++ b/pdftools/nameplate.py @@ -41,6 +41,7 @@ false_and_true = itertools.cycle([False, True]) imtek_logo_path = Path(__file__).parent / "logo_imtek.png" + class NamePlateCards: def __init__( self, diff --git a/pdftools/ruler.py b/pdftools/ruler.py index 3b9020d..53ab79e 100644 --- a/pdftools/ruler.py +++ b/pdftools/ruler.py @@ -5,20 +5,19 @@ from . import formfill def ruler_overlay(original_form): - def ruler(c, item): c.setStrokeColorRGB(0, 0, 1) c.setFillColorRGB(0, 0, 1) c.setLineWidth(0.5) c.setFont("Helvetica", 8) - x_grid = [x*mm for x in range(10, 210, 10)] - y_grid = [y*mm for y in range(10, 297, 10)] + x_grid = [x * mm for x in range(10, 210, 10)] + y_grid = [y * mm for y in range(10, 297, 10)] c.grid(x_grid, y_grid) for x in range(10, 210, 10): - c.drawString((x-2)*mm, 5*mm, str(x)) + c.drawString((x - 2) * mm, 5 * mm, str(x)) for y in range(10, 297, 10): - c.drawString(4*mm, (y-0.5)*mm, str(y)) + c.drawString(4 * mm, (y - 0.5) * mm, str(y)) ofp = Path(original_form) out_path = ofp.parent / f"{ofp.stem}_ruler.pdf"