From 59d12edcd222f2051cbebf02d70febdd4356cdc9 Mon Sep 17 00:00:00 2001 From: Sourcery AI <> Date: Sun, 17 Oct 2021 23:19:52 +0000 Subject: [PATCH] 'Refactored by Sourcery' --- Book Library/app/models/books.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Book Library/app/models/books.py b/Book Library/app/models/books.py index 33b9d37..cde2922 100644 --- a/Book Library/app/models/books.py +++ b/Book Library/app/models/books.py @@ -4,12 +4,8 @@ class Books(): def __init__(self, query="", start=0, testing=False, https=False): - if not testing: - self.json = google_book_search(query, start) - else: - self.json = testing - - self.https = True if https else False + self.json = google_book_search(query, start) if not testing else testing + self.https = bool(https) def parse(self): """ @@ -56,12 +52,11 @@ def _parse_thumbnail(self, imageLinks=""): """ if not imageLinks: return {"thumbnail": "static/images/booky-book.jpg"} - else: - if self.https: - for link in imageLinks: - imageLinks[link] = convert_to_https(imageLinks[link]) + if self.https: + for link in imageLinks: + imageLinks[link] = convert_to_https(imageLinks[link]) - return imageLinks + return imageLinks def payload(items, total):