Save an indentation level and make code more clear

This commit is contained in:
Hynek Schlawack 2020-03-29 14:22:33 +02:00
parent 048c2666c6
commit d3ca25550d
1 changed files with 11 additions and 9 deletions

View File

@ -412,7 +412,9 @@ def _transform_attrs(cls, these, auto_attribs, kw_only):
# Traverse the MRO and collect attributes. # Traverse the MRO and collect attributes.
for base_cls in cls.__mro__[1:-1]: for base_cls in cls.__mro__[1:-1]:
sub_attrs = getattr(base_cls, "__attrs_attrs__", None) sub_attrs = getattr(base_cls, "__attrs_attrs__", None)
if sub_attrs is not None: if sub_attrs is None:
continue
for a in sub_attrs: for a in sub_attrs:
prev_a = taken_attr_names.get(a.name) prev_a = taken_attr_names.get(a.name)
# Only add an attribute if it hasn't been defined before. This # Only add an attribute if it hasn't been defined before. This