forked from mirrors/bookwyrm
[lint] Fix indentation in .py files.
This commit is contained in:
parent
4a8d9bee73
commit
1266a740e5
5 changed files with 12 additions and 8 deletions
|
@ -10,7 +10,7 @@ class ActivitypubResponse(JsonResponse):
|
||||||
JsonResponse.
|
JsonResponse.
|
||||||
"""
|
"""
|
||||||
def __init__(self, data, encoder=ActivityEncoder, safe=False,
|
def __init__(self, data, encoder=ActivityEncoder, safe=False,
|
||||||
json_dumps_params=None, **kwargs):
|
json_dumps_params=None, **kwargs):
|
||||||
|
|
||||||
if 'content_type' not in kwargs:
|
if 'content_type' not in kwargs:
|
||||||
kwargs['content_type'] = 'application/activity+json'
|
kwargs['content_type'] = 'application/activity+json'
|
||||||
|
|
|
@ -224,7 +224,7 @@ def isbn_10_to_13(isbn_10):
|
||||||
# multiply the odd digits by 1 and the even digits by 3 and sum them
|
# multiply the odd digits by 1 and the even digits by 3 and sum them
|
||||||
try:
|
try:
|
||||||
checksum = sum(int(i) for i in converted[::2]) + \
|
checksum = sum(int(i) for i in converted[::2]) + \
|
||||||
sum(int(i) * 3 for i in converted[1::2])
|
sum(int(i) * 3 for i in converted[1::2])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return None
|
return None
|
||||||
# add the checksum mod 10 to the end
|
# add the checksum mod 10 to the end
|
||||||
|
|
|
@ -46,9 +46,11 @@ def validate_username(value):
|
||||||
|
|
||||||
class ActivitypubFieldMixin:
|
class ActivitypubFieldMixin:
|
||||||
''' make a database field serializable '''
|
''' make a database field serializable '''
|
||||||
def __init__(self, *args, \
|
def __init__(
|
||||||
activitypub_field=None, activitypub_wrapper=None,
|
self, *args, \
|
||||||
deduplication_field=False, **kwargs):
|
activitypub_field=None, activitypub_wrapper=None,
|
||||||
|
deduplication_field=False, **kwargs
|
||||||
|
):
|
||||||
self.deduplication_field = deduplication_field
|
self.deduplication_field = deduplication_field
|
||||||
if activitypub_wrapper:
|
if activitypub_wrapper:
|
||||||
self.activitypub_wrapper = activitypub_field
|
self.activitypub_wrapper = activitypub_field
|
||||||
|
|
|
@ -74,8 +74,10 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
||||||
for mention_user in self.mention_users.all():
|
for mention_user in self.mention_users.all():
|
||||||
# avoid double-notifying about this status
|
# avoid double-notifying about this status
|
||||||
if not mention_user.local or \
|
if not mention_user.local or \
|
||||||
(self.reply_parent and \
|
(
|
||||||
mention_user == self.reply_parent.user):
|
self.reply_parent and \
|
||||||
|
mention_user == self.reply_parent.user
|
||||||
|
):
|
||||||
continue
|
continue
|
||||||
notification_model.objects.create(
|
notification_model.objects.create(
|
||||||
user=mention_user,
|
user=mention_user,
|
||||||
|
|
|
@ -201,7 +201,7 @@ class StatusViews(TestCase):
|
||||||
'archive.org/details/dli.granth.72113/page/n25/mode/2up</a>' \
|
'archive.org/details/dli.granth.72113/page/n25/mode/2up</a>' \
|
||||||
% url)
|
% url)
|
||||||
url = 'https://openlibrary.org/search' \
|
url = 'https://openlibrary.org/search' \
|
||||||
'?q=arkady+strugatsky&mode=everything'
|
'?q=arkady+strugatsky&mode=everything'
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
views.status.format_links(url),
|
views.status.format_links(url),
|
||||||
'<a href="%s">openlibrary.org/search' \
|
'<a href="%s">openlibrary.org/search' \
|
||||||
|
|
Loading…
Reference in a new issue