Fix H238 to allow parent classes to be returned by a function

There was a corner case that wasn't caught before where
you would want to declare a class like this:

    class Foo(six.with_metaclass(abc.ABCMeta, object)):

but this falsely triggered H238. This allows for that and
adds one more docstring update for a failure case.

Change-Id: Ie7cea4156f0da5bf72d16e5eb5f4e13b7c095d3f
This commit is contained in:
Julien Danjou 2015-01-20 14:46:24 +01:00 committed by Ben Nemec
parent ec6048f135
commit 8990ddbb21
1 changed files with 3 additions and 1 deletions

View File

@ -205,7 +205,7 @@ def hacking_no_removed_module(logical_line, noqa):
"removed in Python 3" % module_name)
RE_NEW_STYLE_CLASS = re.compile(r"^class [^(]+\([^)]+\):")
RE_NEW_STYLE_CLASS = re.compile(r"^class [^(]+\(.+\):")
@core.flake8ext
@ -216,7 +216,9 @@ def hacking_no_old_style_class(logical_line, noqa):
Okay: class Foo(object):\n pass
Okay: class Foo(Bar, Baz):\n pass
Okay: class Foo(object, Baz):\n pass
Okay: class Foo(somefunc()):\n pass
H238: class Bar:\n pass
H238: class Bar():\n pass
"""
if noqa:
return