Skip to content

Commit a58fd15

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 26e8413 commit a58fd15

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

openlibrary/plugins/upstream/mybooks.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ def render_template(self, mb):
8080
def add_availability_with_edition_preference(docs):
8181
"""Check edition-level availability when available, fallback to work-level."""
8282
filtered_docs = [d for d in docs if d.get('title')]
83-
83+
8484
docs_with_editions = []
8585
editions_to_check = []
8686
docs_without_editions = []
87-
87+
8888
for doc in filtered_docs:
8989
# editions can be a list [edition] or dict {'docs': [edition]}
9090
editions = doc.get('editions')
@@ -95,15 +95,15 @@ def add_availability_with_edition_preference(docs):
9595
edition = editions['docs'][0]
9696
else:
9797
edition = None
98-
98+
9999
if edition:
100100
docs_with_editions.append((doc, edition))
101101
editions_to_check.append(edition)
102102
else:
103103
docs_without_editions.append(doc)
104104
else:
105105
docs_without_editions.append(doc)
106-
106+
107107
if editions_to_check:
108108
edition_olids = [
109109
edition['key'].split('/')[-1]
@@ -118,13 +118,15 @@ def add_availability_with_edition_preference(docs):
118118
if edition.get('key'):
119119
edition_olid = edition['key'].split('/')[-1]
120120
if edition_olid in edition_availabilities:
121-
doc['availability'] = edition_availabilities[edition_olid]
122-
121+
doc['availability'] = edition_availabilities[
122+
edition_olid
123+
]
124+
123125
if docs_without_editions:
124126
add_availability(docs_without_editions)
125-
127+
126128
return filtered_docs
127-
129+
128130
# Ideally, do all 3 lookups in one add_availability call
129131
want_to_read.docs = add_availability_with_edition_preference(
130132
want_to_read.docs

0 commit comments

Comments
 (0)