autoformatter says things

This commit is contained in:
cellarspoon 2021-11-29 11:14:46 +01:00
parent 080d1e0d29
commit f5b7ff0ccd
No known key found for this signature in database
GPG Key ID: 03789458B3D0C410

View File

@ -1,14 +1,19 @@
from calibrestekje import Book, Comment, Publisher, init_session
from reportlab.lib.pagesizes import *
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
from reportlab.pdfgen import canvas
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from calibrestekje import Book, Publisher, Comment, init_session
from reportlab.platypus import PageBreak, Paragraph, SimpleDocTemplate, Spacer
pagewidth, pageheight = landscape(A6)
doc = SimpleDocTemplate("text.pdf", pagesize=landscape(A6),
rightMargin=18, leftMargin=18,
topMargin=0, bottomMargin=18)
doc = SimpleDocTemplate(
"text.pdf",
pagesize=landscape(A6),
rightMargin=18,
leftMargin=18,
topMargin=0,
bottomMargin=18,
)
content = []
styles = getSampleStyleSheet()
@ -19,26 +24,27 @@ session = init_session("sqlite:///metadata.db")
for book in session.query(Book).all():
for comment in session.query(Comment).all():
if (book.id) == (comment.book):
print (book.id)
print (book.title)
print (book.authors)
print (book.timestamp)
print (book.path)
print (book.tags)
print (comment.text)
print(book.id)
print(book.title)
print(book.authors)
print(book.timestamp)
print(book.path)
print(book.tags)
print(comment.text)
# create a paragraph and append content to it - e.g. book.title, book.authors etc
ptitle = Paragraph('<font size=12>{}</font>'.format(book.title), styles["Italic"])
ptime = Paragraph('<font size=10>Uploaded: {}</font>'.format(book.timestamp), styles["Normal"])
pcomments = Paragraph('<font size=10>{}</font>'.format(comment.text))
ptitle = Paragraph("<font size=12>{}</font>".format(book.title), styles["Italic"])
ptime = Paragraph(
"<font size=10>Uploaded: {}</font>".format(book.timestamp), styles["Normal"]
)
pcomments = Paragraph("<font size=10>{}</font>".format(comment.text))
# list comprehensions for authors and tags
format_string = '<font size=12>{}</font>'
format_string = "<font size=12>{}</font>"
all_authors = [author.name for author in book.authors]
glued_together = format_string.format(", ".join(all_authors))
format_string = '<font size=10>{}</font>'
format_string = "<font size=10>{}</font>"
all_tags = [tag.name for tag in book.tags]
tags_glued_together = format_string.format(", ".join(all_tags))
@ -75,5 +81,5 @@ for book in session.query(Book).all():
content.append(p)
content.append(PageBreak())
content.append(Spacer(6, 12))
doc.build(content)
doc.build(content)