Skip to content
Snippets Groups Projects
Unverified Commit 311f3302 authored by Ian Stapleton Cordasco's avatar Ian Stapleton Cordasco Committed by GitHub
Browse files

Merge pull request #55 from PyCQA/bug/53

Only check ast.Name for their id in metaclass check
parents fbb261bf 821c00b3
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -180,9 +180,10 @@ class NamingChecker(object):
if isinstance(meth, ast.Name):
late_decoration[meth.id] = self.decorator_to_type[func_name]
 
cls_bases = [b for b in cls_node.bases if isinstance(b, ast.Name)]
# If this class inherits from `type`, it's a metaclass, and we'll
# consider all of it's methods to be classmethods.
ismetaclass = any(name for name in cls_node.bases if name.id == 'type')
ismetaclass = any(name for name in cls_bases if name.id == 'type')
 
# iterate over all functions and tag them
for node in iter_child_nodes(cls_node):
Loading
Loading
Loading
Loading
@@ -27,3 +27,10 @@ class Meta(type):
class MetaMethod(type):
def test(cls):
pass
#: Okay
class NotMeta(object):
otherclass = Foo
class AttributeParent(NotMeta.otherclass):
pass
class CallParent(type('_tmp', (), {})):
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