Skip to content

Commit

Permalink
276 - Cleaning is_class method as now is unecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
dineshtrivedi committed Jan 21, 2022
1 parent 9033c72 commit fe95a12
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pylint_django/augmentations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,11 +769,6 @@ def __call__(self, node):
return node_is_subclass(node, self.class_name)


def is_class(class_name) -> IsClass:
"""Shortcut for node_is_subclass."""
return IsClass(class_name)


def wrap(orig_method, with_method):
@functools.wraps(orig_method)
def wrap_func(*args, **kwargs):
Expand Down Expand Up @@ -879,29 +874,29 @@ def apply_augmentations(linter):
linter,
MisdesignChecker.visit_classdef,
"too-many-ancestors",
is_class("django.views.generic.edit.FormView"),
IsClass("django.views.generic.edit.FormView"),
)

# class-based generic views just have a longer inheritance chain
suppress_message(
linter,
MisdesignChecker.visit_classdef,
"too-many-ancestors",
is_class("django.views.generic.detail.BaseDetailView"),
IsClass("django.views.generic.detail.BaseDetailView"),
)
suppress_message(
linter,
MisdesignChecker.visit_classdef,
"too-many-ancestors",
is_class("django.views.generic.edit.ProcessFormView"),
IsClass("django.views.generic.edit.ProcessFormView"),
)

# model forms have no __init__ method anywhere in their bases
suppress_message(
linter,
ClassChecker.visit_classdef,
"W0232",
is_class("django.forms.models.ModelForm"),
IsClass("django.forms.models.ModelForm"),
)

# Meta
Expand Down

0 comments on commit fe95a12

Please sign in to comment.