diff --git a/.pylintrc b/.pylintrc index e465020954..e89f7d5363 100644 --- a/.pylintrc +++ b/.pylintrc @@ -14,6 +14,8 @@ disable = too-many-instance-attributes, unnecessary-lambda-assignment, unsubscriptable-object, +enable = + useless-suppression [FORMAT] max-line-length=88 diff --git a/bookwyrm/activitypub/book.py b/bookwyrm/activitypub/book.py index a53222053c..9a268f905d 100644 --- a/bookwyrm/activitypub/book.py +++ b/bookwyrm/activitypub/book.py @@ -67,7 +67,6 @@ class Edition(Book): type: str = "Edition" -# pylint: disable=invalid-name @dataclass(init=False) class Work(Book): """work instance of a book object""" diff --git a/bookwyrm/activitypub/ordered_collection.py b/bookwyrm/activitypub/ordered_collection.py index 32e37c9966..250490041d 100644 --- a/bookwyrm/activitypub/ordered_collection.py +++ b/bookwyrm/activitypub/ordered_collection.py @@ -18,7 +18,6 @@ class OrderedCollection(ActivityObject): type: str = "OrderedCollection" -# pylint: disable=invalid-name @dataclass(init=False) class OrderedCollectionPrivate(OrderedCollection): """an ordered collection with privacy settings""" diff --git a/bookwyrm/activitypub/verbs.py b/bookwyrm/activitypub/verbs.py index a365f4cc07..549f14c9c0 100644 --- a/bookwyrm/activitypub/verbs.py +++ b/bookwyrm/activitypub/verbs.py @@ -22,7 +22,6 @@ def action(self, allow_external_connections=True): self.object.to_model(allow_external_connections=allow_external_connections) -# pylint: disable=invalid-name @dataclass(init=False) class Create(Verb): """Create activity""" @@ -33,7 +32,6 @@ class Create(Verb): type: str = "Create" -# pylint: disable=invalid-name @dataclass(init=False) class Delete(Verb): """Create activity""" @@ -63,7 +61,6 @@ def action(self, allow_external_connections=True): # if we can't find it, we don't need to delete it because we don't have it -# pylint: disable=invalid-name @dataclass(init=False) class Update(Verb): """Update activity""" @@ -227,7 +224,6 @@ def action(self, allow_external_connections=True): self.to_model(allow_external_connections=allow_external_connections) -# pylint: disable=invalid-name @dataclass(init=False) class Announce(Verb): """boosting a status""" diff --git a/bookwyrm/activitystreams.py b/bookwyrm/activitystreams.py index 0009ac7a36..08fb757d5a 100644 --- a/bookwyrm/activitystreams.py +++ b/bookwyrm/activitystreams.py @@ -32,7 +32,7 @@ def unread_by_status_type_id(self, user_id): stream_id = self.stream_id(user_id) return f"{stream_id}-unread-by-type" - def get_rank(self, obj): # pylint: disable=no-self-use + def get_rank(self, obj): """statuses are sorted by date published""" return obj.published_date.timestamp() diff --git a/bookwyrm/apps.py b/bookwyrm/apps.py index 41b1a17a2e..d5384bb7b5 100644 --- a/bookwyrm/apps.py +++ b/bookwyrm/apps.py @@ -33,7 +33,6 @@ class BookwyrmConfig(AppConfig): name = "bookwyrm" verbose_name = "BookWyrm" - # pylint: disable=no-self-use def ready(self): """set up OTLP and preview image files, if desired""" if settings.OTEL_EXPORTER_OTLP_ENDPOINT or settings.OTEL_EXPORTER_CONSOLE: diff --git a/bookwyrm/book_search.py b/bookwyrm/book_search.py index cf48f4832e..c11cdb8f1b 100644 --- a/bookwyrm/book_search.py +++ b/bookwyrm/book_search.py @@ -36,7 +36,6 @@ def search( ... -# pylint: disable=arguments-differ def search( query: str, *, diff --git a/bookwyrm/context_processors.py b/bookwyrm/context_processors.py index 0047bfce11..bec704a2c7 100644 --- a/bookwyrm/context_processors.py +++ b/bookwyrm/context_processors.py @@ -2,7 +2,7 @@ from bookwyrm import models, settings -def site_settings(request): # pylint: disable=unused-argument +def site_settings(request): """include the custom info about the site""" request_protocol = "https://" if not request.is_secure(): diff --git a/bookwyrm/forms/custom_form.py b/bookwyrm/forms/custom_form.py index ec29d7d2f5..6b425d216a 100644 --- a/bookwyrm/forms/custom_form.py +++ b/bookwyrm/forms/custom_form.py @@ -15,7 +15,6 @@ def __init__(self, *args, **kwargs): css_classes["number"] = "input" css_classes["checkbox"] = "checkbox" css_classes["textarea"] = "textarea" - # pylint: disable=super-with-arguments super().__init__(*args, **kwargs) for visible in self.visible_fields(): input_type = "" diff --git a/bookwyrm/forms/landing.py b/bookwyrm/forms/landing.py index 1da4fc4f11..831d1d539a 100644 --- a/bookwyrm/forms/landing.py +++ b/bookwyrm/forms/landing.py @@ -34,7 +34,6 @@ def infer_username(self): def add_invalid_password_error(self): """We don't want to be too specific about this""" - # pylint: disable=attribute-defined-outside-init self.non_field_errors = _("Username or password are incorrect") diff --git a/bookwyrm/forms/widgets.py b/bookwyrm/forms/widgets.py index ee9345aa03..001fdbec40 100644 --- a/bookwyrm/forms/widgets.py +++ b/bookwyrm/forms/widgets.py @@ -5,8 +5,6 @@ class ArrayWidget(forms.widgets.TextInput): """Inputs for postgres array fields""" - # pylint: disable=unused-argument - # pylint: disable=no-self-use def value_from_datadict(self, data, files, name): """get all values for this name""" return [i for i in data.getlist(name) if i] diff --git a/bookwyrm/importers/importer.py b/bookwyrm/importers/importer.py index 5b3192fa5b..03176691c4 100644 --- a/bookwyrm/importers/importer.py +++ b/bookwyrm/importers/importer.py @@ -36,7 +36,6 @@ class Importer: "reading": ["currently-reading", "reading", "currently reading"], } - # pylint: disable=too-many-locals def create_job( self, user: User, csv_file: Iterable[str], include_reviews: bool, privacy: str ) -> ImportJob: diff --git a/bookwyrm/importers/librarything_import.py b/bookwyrm/importers/librarything_import.py index 145657ba08..24a2626bf6 100644 --- a/bookwyrm/importers/librarything_import.py +++ b/bookwyrm/importers/librarything_import.py @@ -20,7 +20,7 @@ class LibrarythingImporter(Importer): def normalize_row( self, entry: dict[str, str], mappings: dict[str, Optional[str]] - ) -> dict[str, Optional[str]]: # pylint: disable=no-self-use + ) -> dict[str, Optional[str]]: """use the dataclass to create the formatted row of data""" normalized = { k: _remove_brackets(entry.get(v) if v else None) diff --git a/bookwyrm/lists_stream.py b/bookwyrm/lists_stream.py index 148b81a78b..479eacb193 100644 --- a/bookwyrm/lists_stream.py +++ b/bookwyrm/lists_stream.py @@ -18,7 +18,7 @@ def stream_id(self, user): # pylint: disable=no-self-use return f"{user}-lists" return f"{user.id}-lists" - def get_rank(self, obj): # pylint: disable=no-self-use + def get_rank(self, obj): """lists are sorted by updated date""" return obj.updated_date.timestamp() diff --git a/bookwyrm/models/activitypub_mixin.py b/bookwyrm/models/activitypub_mixin.py index 06ef373e68..54ad115119 100644 --- a/bookwyrm/models/activitypub_mixin.py +++ b/bookwyrm/models/activitypub_mixin.py @@ -31,7 +31,7 @@ PropertyField = namedtuple("PropertyField", ("set_activity_from_field")) -# pylint: disable=invalid-name + def set_activity_from_property_field(activity, obj, field): """assign a model property value to the activity json""" activity[field[1]] = getattr(obj, field[0]) diff --git a/bookwyrm/models/book.py b/bookwyrm/models/book.py index 4ff377dbbb..368276523f 100644 --- a/bookwyrm/models/book.py +++ b/bookwyrm/models/book.py @@ -133,7 +133,6 @@ def merge_into(self, canonical: Self, dry_run=False) -> Dict[str, Any]: related_models = [ (r.remote_field.name, r.related_model) for r in self._meta.related_objects ] - # pylint: disable=protected-access for related_field, related_model in related_models: # Skip the ManyToMany fields that aren’t auto-created. These # should have a corresponding OneToMany field in the model for diff --git a/bookwyrm/models/bookwyrm_export_job.py b/bookwyrm/models/bookwyrm_export_job.py index 870910c000..a42562f30a 100644 --- a/bookwyrm/models/bookwyrm_export_job.py +++ b/bookwyrm/models/bookwyrm_export_job.py @@ -27,7 +27,7 @@ class BookwyrmAwsSession(BotoSession): """a boto session that always uses settings.AWS_S3_ENDPOINT_URL""" - def client(self, *args, **kwargs): # pylint: disable=arguments-differ + def client(self, *args, **kwargs): kwargs["endpoint_url"] = settings.AWS_S3_ENDPOINT_URL return super().client("s3", *args, **kwargs) diff --git a/bookwyrm/models/fields.py b/bookwyrm/models/fields.py index 6643bdc193..75d3acf76d 100644 --- a/bookwyrm/models/fields.py +++ b/bookwyrm/models/fields.py @@ -193,8 +193,7 @@ class UsernameField(ActivitypubFieldMixin, models.CharField): def __init__(self, activitypub_field="preferredUsername", **kwargs): self.activitypub_field = activitypub_field - # I don't totally know why pylint is mad at this, but it makes it work - super(ActivitypubFieldMixin, self).__init__( # pylint: disable=bad-super-call + super(ActivitypubFieldMixin, self).__init__( _("username"), max_length=150, unique=True, @@ -234,7 +233,6 @@ class PrivacyField(ActivitypubFieldMixin, models.CharField): def __init__(self, *args, **kwargs): super().__init__(*args, max_length=255, choices=PrivacyLevels, default="public") - # pylint: disable=invalid-name def set_field_from_activity( self, instance, data, overwrite=True, allow_external_connections=True ): @@ -276,7 +274,6 @@ def set_activity_from_field(self, activity, instance): if hasattr(instance, "mention_users"): mentions = [u.remote_id for u in instance.mention_users.all()] # this is a link to the followers list - # pylint: disable=protected-access followers = instance.user.followers_url if instance.privacy == "public": activity["to"] = [self.public] @@ -444,7 +441,7 @@ def __init__(self, *args, alt_field=None, **kwargs): self.alt_field = alt_field super().__init__(*args, **kwargs) - # pylint: disable=arguments-differ,arguments-renamed,too-many-arguments + # pylint: disable=arguments-renamed,too-many-arguments def set_field_from_activity( self, instance, data, save=True, overwrite=True, allow_external_connections=True ): diff --git a/bookwyrm/models/import_job.py b/bookwyrm/models/import_job.py index f5d86ad2e8..6392f6d20d 100644 --- a/bookwyrm/models/import_job.py +++ b/bookwyrm/models/import_job.py @@ -352,7 +352,7 @@ def import_item_task(item_id): try: item.resolve() - except Exception as err: # pylint: disable=broad-except + except Exception as err: item.fail_reason = _("Error loading book") item.save() item.update_job() diff --git a/bookwyrm/models/relationship.py b/bookwyrm/models/relationship.py index 745ff78b67..ed630fbe58 100644 --- a/bookwyrm/models/relationship.py +++ b/bookwyrm/models/relationship.py @@ -135,7 +135,7 @@ class UserFollowRequest(ActivitypubMixin, UserRelationship): status = "follow_request" activity_serializer = activitypub.Follow - def save(self, *args, broadcast=True, **kwargs): # pylint: disable=arguments-differ + def save(self, *args, broadcast=True, **kwargs): """make sure the follow or block relationship doesn't already exist""" # if there's a request for a follow that already exists, accept it # without changing the local database state diff --git a/bookwyrm/models/status.py b/bookwyrm/models/status.py index 9dc60e6477..2b357ebd22 100644 --- a/bookwyrm/models/status.py +++ b/bookwyrm/models/status.py @@ -98,7 +98,7 @@ def save(self, *args, update_fields: Optional[Iterable[str]] = None, **kwargs): self.thread_id = self.id super().save(broadcast=False, update_fields=["thread_id"]) - def delete(self, *args, **kwargs): # pylint: disable=unused-argument + def delete(self, *args, **kwargs): """ "delete" a status""" if hasattr(self, "boosted_status"): # okay but if it's a boost really delete it @@ -213,7 +213,7 @@ def to_replies(self, **kwargs): **kwargs, ).serialize() - def to_activity_dataclass(self, pure=False): # pylint: disable=arguments-differ + def to_activity_dataclass(self, pure=False): """return tombstone if the status is deleted""" if self.deleted: return activitypub.Tombstone( diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index ed5c59e9c8..80f1c2d9a9 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -409,7 +409,6 @@ def save(self, *args, update_fields: Optional[Iterable[str]] = None, **kwargs): def delete(self, *args, **kwargs): """We don't actually delete the database entry""" - # pylint: disable=attribute-defined-outside-init self.is_active = False self.allow_reactivation = False self.is_deleted = True @@ -452,7 +451,6 @@ def erase_user_statuses(self, broadcast=True): def deactivate(self): """Disable the user but allow them to reactivate""" - # pylint: disable=attribute-defined-outside-init self.is_active = False self.deactivation_reason = "self_deactivation" self.allow_reactivation = True @@ -460,7 +458,6 @@ def deactivate(self): def reactivate(self): """Now you want to come back, huh?""" - # pylint: disable=attribute-defined-outside-init if not self.allow_reactivation: return self.is_active = True diff --git a/bookwyrm/preview_images.py b/bookwyrm/preview_images.py index a213490abf..66d2e2d4b9 100644 --- a/bookwyrm/preview_images.py +++ b/bookwyrm/preview_images.py @@ -420,7 +420,6 @@ def save_and_cleanup(image, instance=None): return True -# pylint: disable=invalid-name @app.task(queue=IMAGES) def generate_site_preview_image_task(): """generate preview_image for the website""" @@ -445,7 +444,6 @@ def generate_site_preview_image_task(): save_and_cleanup(image, instance=site) -# pylint: disable=invalid-name @app.task(queue=IMAGES) def generate_edition_preview_image_task(book_id): """generate preview_image for a book""" diff --git a/bookwyrm/signatures.py b/bookwyrm/signatures.py index 08780b7317..f59367b51e 100644 --- a/bookwyrm/signatures.py +++ b/bookwyrm/signatures.py @@ -6,7 +6,7 @@ from Crypto import Random from Crypto.PublicKey import RSA -from Crypto.Signature import pkcs1_15 # pylint: disable=no-name-in-module +from Crypto.Signature import pkcs1_15 from Crypto.Hash import SHA256 MAX_SIGNATURE_AGE = 300 @@ -84,7 +84,6 @@ def __init__(self, key_id, headers, signature): self.headers = headers self.signature = signature - # pylint: disable=invalid-name @classmethod def parse(cls, request): """extract and parse a signature from an http request""" diff --git a/bookwyrm/suggested_users.py b/bookwyrm/suggested_users.py index a13ee97fd0..3e1cf17bde 100644 --- a/bookwyrm/suggested_users.py +++ b/bookwyrm/suggested_users.py @@ -34,7 +34,6 @@ def store_id(self, user): # pylint: disable=no-self-use def get_counts_from_rank(self, rank): # pylint: disable=no-self-use """calculate mutuals count and shared books count from rank""" - # pylint: disable=c-extension-no-member return { "mutuals": math.floor(rank), # "shared_books": int(1 / (-1 * (rank % 1 - 1))) - 1, @@ -128,7 +127,6 @@ def get_annotated_users(viewer, *args, **kwargs): ), distinct=True, ), - # pylint: disable=line-too-long # shared_books=Count( # "shelfbook", # filter=Q( @@ -202,7 +200,7 @@ def update_suggestions_on_unfollow(sender, instance, **kwargs): @receiver(signals.post_save, sender=models.User) -# pylint: disable=unused-argument, too-many-arguments +# pylint: disable=unused-argument def update_user(sender, instance, created, update_fields=None, **kwargs): """an updated user, neat""" # a new user is found, create suggestions for them diff --git a/bookwyrm/tests/connectors/test_abstract_connector.py b/bookwyrm/tests/connectors/test_abstract_connector.py index 1a8421c12e..d849f23d7a 100644 --- a/bookwyrm/tests/connectors/test_abstract_connector.py +++ b/bookwyrm/tests/connectors/test_abstract_connector.py @@ -115,7 +115,6 @@ def test_get_or_create_book_deduped(self): @responses.activate def test_get_or_create_author(self): """load an author""" - # pylint: disable=attribute-defined-outside-init self.connector.author_mappings = [ Mapping("id"), Mapping("name"), @@ -141,7 +140,6 @@ def test_get_or_create_author_existing(self): def test_update_author_from_remote(self): """trigger the function that looks up the remote data""" author = models.Author.objects.create(name="Test", openlibrary_key="OL123A") - # pylint: disable=attribute-defined-outside-init self.connector.author_mappings = [ Mapping("id"), Mapping("name"), diff --git a/bookwyrm/tests/models/test_activitypub_mixin.py b/bookwyrm/tests/models/test_activitypub_mixin.py index c7949cd280..d5967b1a38 100644 --- a/bookwyrm/tests/models/test_activitypub_mixin.py +++ b/bookwyrm/tests/models/test_activitypub_mixin.py @@ -20,7 +20,7 @@ from bookwyrm.settings import PAGE_LENGTH -# pylint: disable=invalid-name,too-many-public-methods +# pylint: disable=too-many-public-methods @patch("bookwyrm.activitystreams.add_status_task.delay") @patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async") class ActivitypubMixins(TestCase): diff --git a/bookwyrm/tests/models/test_base_model.py b/bookwyrm/tests/models/test_base_model.py index f16bdfa785..ddde41d048 100644 --- a/bookwyrm/tests/models/test_base_model.py +++ b/bookwyrm/tests/models/test_base_model.py @@ -42,7 +42,7 @@ class BookWyrmTestModel(base_model.BookWyrmModel): def test_remote_id(self): """these should be generated""" - self.test_model.id = 1 # pylint: disable=invalid-name + self.test_model.id = 1 expected = self.test_model.get_remote_id() self.assertEqual(expected, f"{BASE_URL}/bookwyrmtestmodel/1") diff --git a/bookwyrm/tests/models/test_bookwyrm_import_job.py b/bookwyrm/tests/models/test_bookwyrm_import_job.py index 259d8f5a42..7d4bdb5996 100644 --- a/bookwyrm/tests/models/test_bookwyrm_import_job.py +++ b/bookwyrm/tests/models/test_bookwyrm_import_job.py @@ -13,7 +13,7 @@ from bookwyrm.models import bookwyrm_import_job -class BookwyrmImport(TestCase): # pylint: disable=too-many-public-methods +class BookwyrmImport(TestCase): """testing user import functions""" def setUp(self): diff --git a/bookwyrm/tests/models/test_shelf_model.py b/bookwyrm/tests/models/test_shelf_model.py index d510952ea4..f17970c509 100644 --- a/bookwyrm/tests/models/test_shelf_model.py +++ b/bookwyrm/tests/models/test_shelf_model.py @@ -6,7 +6,6 @@ from bookwyrm import models, settings -# pylint: disable=unused-argument @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.activitystreams.populate_stream_task.delay") @patch("bookwyrm.lists_stream.populate_lists_task.delay") diff --git a/bookwyrm/tests/test_merge.py b/bookwyrm/tests/test_merge.py index 933751832a..46f39384e5 100644 --- a/bookwyrm/tests/test_merge.py +++ b/bookwyrm/tests/test_merge.py @@ -10,7 +10,7 @@ class MergeBookDataModel(TestCase): """test merging of subclasses of BookDataModel""" @classmethod - def setUpTestData(cls): # pylint: disable=invalid-name + def setUpTestData(cls): """shared data""" models.SiteSettings.objects.create() diff --git a/bookwyrm/tests/validate_html.py b/bookwyrm/tests/validate_html.py index 11bc84880c..618d27f6c9 100644 --- a/bookwyrm/tests/validate_html.py +++ b/bookwyrm/tests/validate_html.py @@ -42,7 +42,7 @@ def validate_html(html): validator.feed(str(html.content)) -class HtmlValidator(HTMLParser): # pylint: disable=abstract-method +class HtmlValidator(HTMLParser): """Checks for custom html validation requirements""" def __init__(self): diff --git a/bookwyrm/tests/views/imports/test_user_import.py b/bookwyrm/tests/views/imports/test_user_import.py index a8214e74ea..3e097fb0fa 100644 --- a/bookwyrm/tests/views/imports/test_user_import.py +++ b/bookwyrm/tests/views/imports/test_user_import.py @@ -14,7 +14,6 @@ class ImportUserViews(TestCase): """user import views""" - # pylint: disable=invalid-name def setUp(self): """we need basic test data and mocks""" self.factory = RequestFactory() diff --git a/bookwyrm/tests/views/inbox/test_inbox.py b/bookwyrm/tests/views/inbox/test_inbox.py index c29aa71a28..6deae38b77 100644 --- a/bookwyrm/tests/views/inbox/test_inbox.py +++ b/bookwyrm/tests/views/inbox/test_inbox.py @@ -11,7 +11,6 @@ from bookwyrm import models, views -# pylint: disable=too-many-public-methods class Inbox(TestCase): """readthrough tests""" diff --git a/bookwyrm/tests/views/inbox/test_inbox_add.py b/bookwyrm/tests/views/inbox/test_inbox_add.py index 0a11053e47..b3d50fe46f 100644 --- a/bookwyrm/tests/views/inbox/test_inbox_add.py +++ b/bookwyrm/tests/views/inbox/test_inbox_add.py @@ -7,7 +7,6 @@ from bookwyrm import models, views -# pylint: disable=too-many-public-methods class InboxAdd(TestCase): """inbox tests""" diff --git a/bookwyrm/tests/views/inbox/test_inbox_announce.py b/bookwyrm/tests/views/inbox/test_inbox_announce.py index d499629a7e..1bc508d115 100644 --- a/bookwyrm/tests/views/inbox/test_inbox_announce.py +++ b/bookwyrm/tests/views/inbox/test_inbox_announce.py @@ -7,7 +7,6 @@ from bookwyrm import models, views -# pylint: disable=too-many-public-methods class InboxActivities(TestCase): """inbox tests""" diff --git a/bookwyrm/tests/views/inbox/test_inbox_block.py b/bookwyrm/tests/views/inbox/test_inbox_block.py index 19b0eb97fe..923a87a761 100644 --- a/bookwyrm/tests/views/inbox/test_inbox_block.py +++ b/bookwyrm/tests/views/inbox/test_inbox_block.py @@ -6,7 +6,6 @@ from bookwyrm import models, views -# pylint: disable=too-many-public-methods class InboxBlock(TestCase): """inbox tests""" diff --git a/bookwyrm/tests/views/inbox/test_inbox_create.py b/bookwyrm/tests/views/inbox/test_inbox_create.py index e8a3a8b121..0bb3907af5 100644 --- a/bookwyrm/tests/views/inbox/test_inbox_create.py +++ b/bookwyrm/tests/views/inbox/test_inbox_create.py @@ -9,7 +9,6 @@ from bookwyrm.activitypub import ActivitySerializerError -# pylint: disable=too-many-public-methods class TransactionInboxCreate(TransactionTestCase): """readthrough tests""" diff --git a/bookwyrm/tests/views/inbox/test_inbox_delete.py b/bookwyrm/tests/views/inbox/test_inbox_delete.py index a72898857b..8d7582a21b 100644 --- a/bookwyrm/tests/views/inbox/test_inbox_delete.py +++ b/bookwyrm/tests/views/inbox/test_inbox_delete.py @@ -7,7 +7,6 @@ from bookwyrm import models, views -# pylint: disable=too-many-public-methods class InboxActivities(TestCase): """inbox tests""" diff --git a/bookwyrm/tests/views/inbox/test_inbox_follow.py b/bookwyrm/tests/views/inbox/test_inbox_follow.py index aad52937b1..ccc58c974b 100644 --- a/bookwyrm/tests/views/inbox/test_inbox_follow.py +++ b/bookwyrm/tests/views/inbox/test_inbox_follow.py @@ -7,7 +7,6 @@ from bookwyrm import models, views -# pylint: disable=too-many-public-methods class InboxRelationships(TestCase): """inbox tests""" diff --git a/bookwyrm/tests/views/inbox/test_inbox_like.py b/bookwyrm/tests/views/inbox/test_inbox_like.py index 2ab8c4701d..88dc24fbb6 100644 --- a/bookwyrm/tests/views/inbox/test_inbox_like.py +++ b/bookwyrm/tests/views/inbox/test_inbox_like.py @@ -6,7 +6,6 @@ from bookwyrm import models, views -# pylint: disable=too-many-public-methods class InboxActivities(TestCase): """inbox tests""" diff --git a/bookwyrm/tests/views/inbox/test_inbox_remove.py b/bookwyrm/tests/views/inbox/test_inbox_remove.py index ab92eb9959..89f66c9bb8 100644 --- a/bookwyrm/tests/views/inbox/test_inbox_remove.py +++ b/bookwyrm/tests/views/inbox/test_inbox_remove.py @@ -6,7 +6,6 @@ from bookwyrm import models, views -# pylint: disable=too-many-public-methods class InboxRemove(TestCase): """inbox tests""" diff --git a/bookwyrm/tests/views/inbox/test_inbox_update.py b/bookwyrm/tests/views/inbox/test_inbox_update.py index 99f4c20777..a0f74a3fb0 100644 --- a/bookwyrm/tests/views/inbox/test_inbox_update.py +++ b/bookwyrm/tests/views/inbox/test_inbox_update.py @@ -8,7 +8,6 @@ from bookwyrm import models, views -# pylint: disable=too-many-public-methods class InboxUpdate(TestCase): """inbox tests""" @@ -161,7 +160,6 @@ def test_update_edition_links(self): datafile = pathlib.Path(__file__).parent.joinpath("../../data/bw_edition.json") bookdata = json.loads(datafile.read_bytes()) del bookdata["authors"] - # pylint: disable=line-too-long link_data = { "href": "https://openlibrary.org/books/OL11645413M/Queen_Victoria/daisy", "mediaType": "Daisy", diff --git a/bookwyrm/tests/views/landing/test_login.py b/bookwyrm/tests/views/landing/test_login.py index 7d4a066121..00e4468552 100644 --- a/bookwyrm/tests/views/landing/test_login.py +++ b/bookwyrm/tests/views/landing/test_login.py @@ -11,7 +11,6 @@ from bookwyrm.tests.validate_html import validate_html -# pylint: disable=too-many-public-methods @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.activitystreams.populate_stream_task.delay") class LoginViews(TestCase): diff --git a/bookwyrm/tests/views/lists/test_curate.py b/bookwyrm/tests/views/lists/test_curate.py index af6116efaa..458d0b1e83 100644 --- a/bookwyrm/tests/views/lists/test_curate.py +++ b/bookwyrm/tests/views/lists/test_curate.py @@ -11,7 +11,6 @@ from bookwyrm.tests.validate_html import validate_html -# pylint: disable=unused-argument class ListViews(TestCase): """list view""" diff --git a/bookwyrm/tests/views/lists/test_embed.py b/bookwyrm/tests/views/lists/test_embed.py index 2d2d5ec8c0..69462a0075 100644 --- a/bookwyrm/tests/views/lists/test_embed.py +++ b/bookwyrm/tests/views/lists/test_embed.py @@ -11,7 +11,6 @@ from bookwyrm.tests.validate_html import validate_html -# pylint: disable=unused-argument class ListViews(TestCase): """list view""" diff --git a/bookwyrm/tests/views/lists/test_list.py b/bookwyrm/tests/views/lists/test_list.py index 6af9d1db11..38af920a19 100644 --- a/bookwyrm/tests/views/lists/test_list.py +++ b/bookwyrm/tests/views/lists/test_list.py @@ -13,7 +13,6 @@ from bookwyrm.tests.validate_html import validate_html -# pylint: disable=unused-argument # pylint: disable=too-many-public-methods class ListViews(TestCase): """list view""" diff --git a/bookwyrm/tests/views/lists/test_list_item.py b/bookwyrm/tests/views/lists/test_list_item.py index e70eabf1b7..bb64329f04 100644 --- a/bookwyrm/tests/views/lists/test_list_item.py +++ b/bookwyrm/tests/views/lists/test_list_item.py @@ -7,8 +7,6 @@ from bookwyrm import models, views -# pylint: disable=unused-argument -# pylint: disable=too-many-public-methods class ListItemViews(TestCase): """list view""" diff --git a/bookwyrm/tests/views/lists/test_lists.py b/bookwyrm/tests/views/lists/test_lists.py index 069fd7008d..3f24f669df 100644 --- a/bookwyrm/tests/views/lists/test_lists.py +++ b/bookwyrm/tests/views/lists/test_lists.py @@ -11,7 +11,7 @@ from bookwyrm import models, views from bookwyrm.tests.validate_html import validate_html -# pylint: disable=unused-argument + class ListViews(TestCase): """lists of lists""" diff --git a/bookwyrm/tests/views/preferences/test_export.py b/bookwyrm/tests/views/preferences/test_export.py index f125e90096..2b8fafc87e 100644 --- a/bookwyrm/tests/views/preferences/test_export.py +++ b/bookwyrm/tests/views/preferences/test_export.py @@ -18,7 +18,7 @@ class ExportViews(TestCase): """viewing and creating statuses""" @classmethod - def setUpTestData(cls): # pylint: disable=invalid-name + def setUpTestData(cls): """we need basic test data and mocks""" with ( patch("bookwyrm.suggested_users.rerank_suggestions_task.delay"), @@ -41,7 +41,6 @@ def setUpTestData(cls): # pylint: disable=invalid-name bnf_id="beep", ) - # pylint: disable=invalid-name def setUp(self): """individual test setup""" self.factory = RequestFactory() diff --git a/bookwyrm/tests/views/preferences/test_two_factor_auth.py b/bookwyrm/tests/views/preferences/test_two_factor_auth.py index 3b16236ed0..73f6d2f5e1 100644 --- a/bookwyrm/tests/views/preferences/test_two_factor_auth.py +++ b/bookwyrm/tests/views/preferences/test_two_factor_auth.py @@ -11,7 +11,7 @@ from bookwyrm import forms, models, views -# pylint: disable=too-many-public-methods + @patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") @patch("bookwyrm.activitystreams.populate_stream_task.delay") class TwoFactorViews(TestCase): diff --git a/bookwyrm/tests/views/test_directory.py b/bookwyrm/tests/views/test_directory.py index a169551aca..3ea2241542 100644 --- a/bookwyrm/tests/views/test_directory.py +++ b/bookwyrm/tests/views/test_directory.py @@ -9,7 +9,7 @@ from bookwyrm import models, views from bookwyrm.tests.validate_html import validate_html -# pylint: disable=unused-argument + class DirectoryViews(TestCase): """tag views""" diff --git a/bookwyrm/tests/views/test_outbox.py b/bookwyrm/tests/views/test_outbox.py index bbd4aa37ba..370f818008 100644 --- a/bookwyrm/tests/views/test_outbox.py +++ b/bookwyrm/tests/views/test_outbox.py @@ -10,7 +10,6 @@ from bookwyrm.settings import USER_AGENT -# pylint: disable=too-many-public-methods @patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async") class OutboxView(TestCase): """sends out activities""" diff --git a/bookwyrm/utils/partial_date.py b/bookwyrm/utils/partial_date.py index d20fc315e5..03d1e64387 100644 --- a/bookwyrm/utils/partial_date.py +++ b/bookwyrm/utils/partial_date.py @@ -52,7 +52,6 @@ def from_datetime(cls, dt: datetime) -> Self: Use subclasses to specify precision. If `dt` is naive, `ValueError` is raised. """ - # pylint: disable=invalid-name if timezone.is_naive(dt): raise ValueError("naive datetime not accepted") return cls.combine(dt.date(), dt.time(), tzinfo=dt.tzinfo) diff --git a/bookwyrm/views/admin/dashboard.py b/bookwyrm/views/admin/dashboard.py index 21b19bf166..87af434c58 100644 --- a/bookwyrm/views/admin/dashboard.py +++ b/bookwyrm/views/admin/dashboard.py @@ -43,7 +43,6 @@ def get(self, request): ) or not re.match(regex.DOMAIN, settings.EMAIL_SENDER_DOMAIN) data["email_config_error"] = email_config_error - # pylint: disable=line-too-long data[ "email_sender" ] = f"{settings.EMAIL_SENDER_NAME}@{settings.EMAIL_SENDER_DOMAIN}" diff --git a/bookwyrm/views/admin/federation.py b/bookwyrm/views/admin/federation.py index e1cb80949f..13666705a2 100644 --- a/bookwyrm/views/admin/federation.py +++ b/bookwyrm/views/admin/federation.py @@ -152,7 +152,7 @@ def get(self, request, server): } return TemplateResponse(request, "settings/federation/instance.html", data) - def post(self, request, server): # pylint: disable=unused-argument + def post(self, request, server): """update note""" server = get_object_or_404(models.FederatedServer, id=server) server.notes = request.POST.get("notes") diff --git a/bookwyrm/views/admin/imports.py b/bookwyrm/views/admin/imports.py index 1009f41491..ad704a2e86 100644 --- a/bookwyrm/views/admin/imports.py +++ b/bookwyrm/views/admin/imports.py @@ -63,7 +63,6 @@ def get(self, request, status="active"): } return TemplateResponse(request, "settings/imports/imports.html", data) - # pylint: disable=unused-argument def post(self, request, import_id): """Mark an import as complete""" import_job = get_object_or_404(models.ImportJob, id=import_id) @@ -95,7 +94,6 @@ def enable_imports(request): @require_POST @permission_required("bookwyrm.edit_instance_settings", raise_exception=True) -# pylint: disable=unused-argument def set_import_size_limit(request): """Limit the amount of books users can import at once""" site = models.SiteSettings.objects.get() @@ -120,7 +118,6 @@ def set_user_import_completed(request, import_id): @require_POST @permission_required("bookwyrm.edit_instance_settings", raise_exception=True) -# pylint: disable=unused-argument def set_user_import_limit(request): """Limit how ofter users can import and export their account""" site = models.SiteSettings.objects.get() diff --git a/bookwyrm/views/books/books.py b/bookwyrm/views/books/books.py index bbf0418508..c67d18cf3d 100644 --- a/bookwyrm/views/books/books.py +++ b/bookwyrm/views/books/books.py @@ -204,7 +204,6 @@ def resolve_book(request): @login_required @require_POST @permission_required("bookwyrm.edit_book", raise_exception=True) -# pylint: disable=unused-argument def update_book_from_remote(request, book_id, connector_identifier): """load the remote data for this book""" connector = connector_manager.load_connector( diff --git a/bookwyrm/views/books/edit_book.py b/bookwyrm/views/books/edit_book.py index b8ceece134..baf12a00b0 100644 --- a/bookwyrm/views/books/edit_book.py +++ b/bookwyrm/views/books/edit_book.py @@ -88,7 +88,6 @@ def get(self, request): data = {"form": forms.EditionForm()} return TemplateResponse(request, "book/edit/edit_book.html", data) - # pylint: disable=too-many-locals def post(self, request): """create a new book""" # returns None if no match is found diff --git a/bookwyrm/views/helpers.py b/bookwyrm/views/helpers.py index 391788b0ca..d89e195ca7 100644 --- a/bookwyrm/views/helpers.py +++ b/bookwyrm/views/helpers.py @@ -240,7 +240,7 @@ def redirect_to_referer(request, *args, **kwargs): return redirect(*args or "/", **kwargs) -# pylint: disable=redefined-builtin,invalid-name +# pylint: disable=redefined-builtin def get_mergeable_object_or_404(klass, id): """variant of get_object_or_404 that also redirects if id has been merged into another object""" diff --git a/bookwyrm/views/landing/register.py b/bookwyrm/views/landing/register.py index 9d9aedb50e..5debd03cdc 100644 --- a/bookwyrm/views/landing/register.py +++ b/bookwyrm/views/landing/register.py @@ -97,7 +97,7 @@ def post(self, request): class ConfirmEmailCode(View): """confirm email address""" - def get(self, request, code): # pylint: disable=unused-argument + def get(self, request, code): """you got the code! good work""" settings = models.SiteSettings.get() if request.user.is_authenticated: @@ -124,7 +124,7 @@ def get(self, request, code): # pylint: disable=unused-argument class ConfirmEmail(View): """enter code to confirm email address""" - def get(self, request): # pylint: disable=unused-argument + def get(self, request): """you need a code! keep looking""" settings = models.SiteSettings.get() if request.user.is_authenticated or not settings.require_confirm_email: diff --git a/bookwyrm/views/reading.py b/bookwyrm/views/reading.py index 478d27990e..e39ad10675 100644 --- a/bookwyrm/views/reading.py +++ b/bookwyrm/views/reading.py @@ -22,7 +22,6 @@ # pylint: disable=no-self-use -# pylint: disable=too-many-return-statements @method_decorator(login_required, name="dispatch") class ReadingStatus(View): """consider reading a book""" diff --git a/bookwyrm/views/rss_feed.py b/bookwyrm/views/rss_feed.py index ae1f6ae2db..9f5e97d597 100644 --- a/bookwyrm/views/rss_feed.py +++ b/bookwyrm/views/rss_feed.py @@ -7,7 +7,7 @@ from .helpers import get_user_from_username -# pylint: disable=no-self-use, unused-argument +# pylint: disable=no-self-use class RssFeed(Feed): """serialize user's posts in rss feed""" diff --git a/bookwyrm/views/shelf/shelf.py b/bookwyrm/views/shelf/shelf.py index a39512fe60..aaf957854b 100644 --- a/bookwyrm/views/shelf/shelf.py +++ b/bookwyrm/views/shelf/shelf.py @@ -119,7 +119,6 @@ def get(self, request, username, shelf_identifier=None): return TemplateResponse(request, "shelf/shelf.html", data) @method_decorator(login_required, name="dispatch") - # pylint: disable=unused-argument def post(self, request, username, shelf_identifier): """edit a shelf""" user = get_user_from_username(request.user, username) diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index f2f03405f4..1935c916b6 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -32,7 +32,7 @@ class EditStatus(View): """the view for *posting*""" - def get(self, request, status_id): # pylint: disable=unused-argument + def get(self, request, status_id): """load the edit panel""" status = get_object_or_404( models.Status.objects.select_subclasses(), id=status_id