Skip to content
Snippets Groups Projects
Commit dfad62ca authored by Matthias Bussonnier's avatar Matthias Bussonnier
Browse files

Correct N804/N805 for __init_subclass__

According to pep 0487, the `__init_subclass__` method is implicitly
considered a classmethod. Thus it should be considered as an exception
of N804/N805 (first argument should be named self/cls). This is already
implemented for `__new__` so extend using the same logic.
parent 06cd421a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -154,7 +154,7 @@ class NamingChecker(object):
continue
 
node.function_type = 'method'
if node.name == '__new__':
if node.name in ('__new__', '__init_subclass__'):
node.function_type = 'classmethod'
 
if node.name in late_decoration:
Loading
Loading
Loading
Loading
@@ -11,3 +11,6 @@ class Foo(object):
@calling()
def test(self, ads):
pass
def __init_subclass(self, ads):
pass
Loading
Loading
@@ -14,3 +14,8 @@ class Foo(object):
@classmethod
def __prepare__(cls):
pass
#: Okay
class Foo(object):
def __init_subclass__(cls):
pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment