Blacken quotes
This commit is contained in:
@ -8,12 +8,12 @@ from books.models import Author, Book
|
||||
|
||||
|
||||
class AuthorViewSet(viewsets.ModelViewSet):
|
||||
queryset = Author.objects.all().order_by('-created')
|
||||
queryset = Author.objects.all().order_by("-created")
|
||||
serializer_class = AuthorSerializer
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
|
||||
class BookViewSet(viewsets.ModelViewSet):
|
||||
queryset = Book.objects.all().order_by('-created')
|
||||
queryset = Book.objects.all().order_by("-created")
|
||||
serializer_class = BookSerializer
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
@ -46,7 +46,7 @@ def process_koreader_sqlite_file(sqlite_file_path, user_id):
|
||||
book_table = cur.execute("SELECT * FROM book")
|
||||
new_scrobbles = []
|
||||
for book_row in book_table:
|
||||
authors = book_row[KoReaderBookColumn.AUTHORS.value].split('\n')
|
||||
authors = book_row[KoReaderBookColumn.AUTHORS.value].split("\n")
|
||||
author_list = []
|
||||
for author_str in authors:
|
||||
logger.debug(f"Looking up author {author_str}")
|
||||
@ -119,6 +119,6 @@ def process_koreader_sqlite_file(sqlite_file_path, user_id):
|
||||
created = Scrobble.objects.bulk_create(new_scrobbles)
|
||||
logger.info(
|
||||
f"Created {len(created)} scrobbles",
|
||||
extra={'created_scrobbles': created},
|
||||
extra={"created_scrobbles": created},
|
||||
)
|
||||
return created
|
||||
|
||||
@ -28,7 +28,7 @@ class Author(TimeStampedModel):
|
||||
|
||||
|
||||
class Book(ScrobblableMixin):
|
||||
COMPLETION_PERCENT = getattr(settings, 'BOOK_COMPLETION_PERCENT', 95)
|
||||
COMPLETION_PERCENT = getattr(settings, "BOOK_COMPLETION_PERCENT", 95)
|
||||
|
||||
title = models.CharField(max_length=255)
|
||||
authors = models.ManyToManyField(Author)
|
||||
@ -59,7 +59,7 @@ class Book(ScrobblableMixin):
|
||||
return self.authors.first()
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("books:book_detail", kwargs={'slug': self.uuid})
|
||||
return reverse("books:book_detail", kwargs={"slug": self.uuid})
|
||||
|
||||
@property
|
||||
def pages_for_completion(self) -> int:
|
||||
|
||||
@ -26,12 +26,12 @@ def lookup_book_from_openlibrary(title: str, author: str = None) -> dict:
|
||||
|
||||
results = json.loads(response.content)
|
||||
|
||||
if len(results.get('docs')) == 0:
|
||||
if len(results.get("docs")) == 0:
|
||||
logger.warn(f"No results found from OL for {title}")
|
||||
return {}
|
||||
|
||||
top = results.get('docs')[0]
|
||||
if author and author not in top['author_name']:
|
||||
top = results.get("docs")[0]
|
||||
if author and author not in top["author_name"]:
|
||||
logger.warn(
|
||||
f"Lookup for {title} found top result with mismatched author"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user