Skip to content

Commit

Permalink
276 - Converted is_class local function using closure to be callable …
Browse files Browse the repository at this point in the history
…class
  • Loading branch information
dineshtrivedi committed Jan 21, 2022
1 parent a36b9e7 commit 9033c72
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pylint_django/augmentations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,9 +761,17 @@ def allow_meta_protected_access(node):
return False


def is_class(class_name):
class IsClass:
def __init__(self, class_name):
self.class_name = class_name

def __call__(self, node):
return node_is_subclass(node, self.class_name)


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


def wrap(orig_method, with_method):
Expand Down

0 comments on commit 9033c72

Please sign in to comment.