Skip to content

Commit

Permalink
__qualname__ is always present if f-strings work
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinche committed May 22, 2021
1 parent fc7d991 commit f37fc13
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/attr/_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -1912,13 +1912,9 @@ def _make_repr(attrs, ns, cls):
repr_fragment = ", ".join(attribute_fragments)

if ns is None:
qualname = getattr(cls, "__qualname__", None)
if qualname is not None:
cls_name_fragment = (
'{self.__class__.__qualname__.rsplit(">.", 1)[-1]}'
)
else:
cls_name_fragment = "{self.__class__.__name__}"
cls_name_fragment = (
'{self.__class__.__qualname__.rsplit(">.", 1)[-1]}'
)
else:
cls_name_fragment = ns + ".{self.__class__.__name__}"

Expand Down

0 comments on commit f37fc13

Please sign in to comment.