diff --git a/bookwyrm/templatetags/utilities.py b/bookwyrm/templatetags/utilities.py index 229a3d0b1..7e771a179 100644 --- a/bookwyrm/templatetags/utilities.py +++ b/bookwyrm/templatetags/utilities.py @@ -73,17 +73,18 @@ def get_book_cover_thumbnail(book, size="medium", ext="jpg"): @register.filter(name="get_isni_bio") def get_isni_bio(existing, author): """Returns the isni bio string if an existing author has an isni listed""" - auth_isni = re.sub("\D","",str(author.isni)) + auth_isni = re.sub(r"\D", "", str(author.isni)) if len(existing) == 0: return "" for value in existing: - if "bio" in value and auth_isni == re.sub("\D","",str(value["isni"])): + if "bio" in value and auth_isni == re.sub(r"\D", "", str(value["isni"])): return value["bio"] return "" + @register.filter(name="remove_spaces") @stringfilter def remove_spaces(arg): """Removes spaces from argument passed in""" - return re.sub("\s","",str(arg)) + return re.sub(r"\s", "", str(arg)) diff --git a/bookwyrm/views/books/edit_book.py b/bookwyrm/views/books/edit_book.py index 939d99d0f..177ee7089 100644 --- a/bookwyrm/views/books/edit_book.py +++ b/bookwyrm/views/books/edit_book.py @@ -1,6 +1,6 @@ """ the good stuff! the books! """ -from dateutil.parser import parse as dateparse from re import sub +from dateutil.parser import parse as dateparse from django.contrib.auth.decorators import login_required, permission_required from django.contrib.postgres.search import SearchRank, SearchVector from django.db import transaction @@ -75,7 +75,7 @@ class EditBook(View): i for i in isni_authors for a in author_matches - if sub("\D","",str(i["isni"])) == sub("\D","",str(a.isni)) + if sub(r"\D", "", str(i["isni"])) == sub(r"\D", "", str(a.isni)) ] # pylint: disable=cell-var-from-loop