From ffd57dfef48e6dd92ab3c43abd5bac51ce8dc2d7 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 25 Feb 2021 10:26:24 -0800 Subject: [PATCH] Use modern string formatting syntax in status model --- bookwyrm/models/status.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bookwyrm/models/status.py b/bookwyrm/models/status.py index 16b32891a..62ce5f1c0 100644 --- a/bookwyrm/models/status.py +++ b/bookwyrm/models/status.py @@ -258,13 +258,12 @@ class Review(Status): def pure_name(self): ''' clarify review names for mastodon serialization ''' if self.rating: - #pylint: disable=bad-string-format-type - return 'Review of "%s" (%d stars): %s' % ( + return 'Review of "{}" ({:d} stars): {}'.format( self.book.title, self.rating, self.name ) - return 'Review of "%s": %s' % ( + return 'Review of "{}": {}'.format( self.book.title, self.name ) @@ -282,13 +281,13 @@ class ReviewRating(Review): ''' a subtype of review that only contains a rating ''' def save(self, *args, **kwargs): if not self.rating: - raise ValueError('Rating object must include a numerical rating') + raise ValueError( + 'ReviewRating object must include a numerical rating') return super().save(*args, **kwargs) @property def pure_content(self): - #pylint: disable=bad-string-format-type - return 'Rated "%s": %d stars' % (self.book.title, self.rating) + return 'Rated "{}": {:d} stars'.format(self.book.title, self.rating) activity_serializer = activitypub.Rating pure_type = 'Note'