未验证 提交 8954d6ee 编写于 作者: D David Amos

Add # noqa to quiet linter

上级 e30b5681
......@@ -41,8 +41,8 @@ for page in pdf.pages:
# Putting It All Together
# -----------------------
from pathlib import Path
from PyPDF2 import PdfFileReader
from pathlib import Path # noqa
from PyPDF2 import PdfFileReader # noqa
# Change the path below to the correct path for your computer.
pdf_path = (
......
......@@ -10,7 +10,7 @@ page = pdf_writer.addBlankPage(width=72, height=72)
print(type(page))
from pathlib import Path
from pathlib import Path # noqa
with Path("blank.pdf").open(mode="wb") as output_file:
pdf_writer.write(output_file)
......@@ -20,8 +20,8 @@ with Path("blank.pdf").open(mode="wb") as output_file:
# Extracting a Single Page From a PDF
# -----------------------------------
from pathlib import Path
from PyPDF2 import PdfFileReader, PdfFileWriter
from pathlib import Path # noqa
from PyPDF2 import PdfFileReader, PdfFileWriter # noqa
# Change the path to work on your computer if necessary
pdf_path = (
......@@ -45,8 +45,8 @@ with Path("first_page.pdf").open(mode="wb") as output_file:
# Extracting Multiple Pages From a PDF
# ------------------------------------
from PyPDF2 import PdfFileReader, PdfFileWriter
from pathlib import Path
from PyPDF2 import PdfFileReader, PdfFileWriter # noqa
from pathlib import Path # noqa
pdf_path = (
Path.home()
......
......@@ -10,7 +10,7 @@ pdf_merger = PdfFileMerger()
# Concatenating PDFs With .append()
# ---------------------------------
from pathlib import Path
from pathlib import Path # noqa
reports_dir = (
Path.home()
......@@ -39,8 +39,8 @@ with Path("expense_reports.pdf").open(mode="wb") as output_file:
# Merging PDFs With .merge()
# --------------------------
from pathlib import Path
from PyPDF2 import PdfFileMerger
from pathlib import Path # noqa
from PyPDF2 import PdfFileMerger # noqa
report_dir = (
Path.home()
......
......@@ -53,8 +53,8 @@ with Path("ugly_rotated2.pdf").open(mode="wb") as output_file:
# Cropping Pages
# --------------
from pathlib import Path
from PyPDF2 import PdfFileReader, PdfFileWriter
from pathlib import Path # noqa
from PyPDF2 import PdfFileReader, PdfFileWriter # noqa
pdf_path = (
Path.home()
......@@ -88,7 +88,7 @@ pdf_writer = PdfFileWriter()
first_page = pdf_reader.getPage(0)
import copy
import copy # noqa
left_side = copy.deepcopy(first_page)
current_coords = left_side.mediaBox.upperRight
......
......@@ -32,8 +32,8 @@ pdf_writer.encrypt(user_pwd=user_pwd, owner_pwd=owner_pwd)
# Decrypting PDFs
# ---------------
from pathlib import Path
from PyPDF2 import PdfFileReader, PdfFileWriter
from pathlib import Path # noqa
from PyPDF2 import PdfFileReader, PdfFileWriter # noqa
pdf_path = Path.home() / "newsletter_protected.pdf"
......
......@@ -13,14 +13,14 @@ canvas.save()
# Setting the Page Size
# ---------------------
from reportlab.lib.units import inch, cm
from reportlab.lib.units import inch, cm # noqa
print(cm)
print(inch)
canvas = Canvas("hello.pdf", pagesize=(8.5 * inch, 11 * inch))
from reportlab.lib.pagesizes import LETTER
from reportlab.lib.pagesizes import LETTER # noqa
canvas = Canvas("hello.pdf", pagesize=LETTER)
print(LETTER)
......@@ -36,10 +36,10 @@ canvas.drawString(1 * inch, 10 * inch, "Times New Roman (18 pt)")
canvas.save()
# The code below creates a PDF with blue text
from reportlab.lib.colors import blue
from reportlab.lib.pagesizes import LETTER
from reportlab.lib.units import inch
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.colors import blue # noqa
from reportlab.lib.pagesizes import LETTER # noqa
from reportlab.lib.units import inch # noqa
from reportlab.pdfgen.canvas import Canvas # noqa
canvas = Canvas("font-colors.pdf", pagesize=LETTER)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册